open-telemetry / open-telemetry/opentelemetry-java-instrumentation

get route info in spring-cloud-gateway with opentelemetry-spring-boot-starter

Open
#14,395 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

contribution welcome enhancement
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Describe the bug

Metrics for dynamic routes exposed by Spring Cloud Gateway do not include the http.route attribute. The same issue was previously found in the Java agent and addressed here: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/9597

Steps to reproduce

Create a spring cloud gateway application with 'io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter'

Expected behavior

http.route attribute filled with the correct information

Actual behavior

While using spring-cloud-gateway, we always get null http.route because spring-cloud-gateway does not put the HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE in exchange object,

Javaagent or library instrumentation version

opentelemetry-spring-boot-starter 2.18.1

Environment

JDK: 21
OS: macOs 15:4
Spring Cloud Gateway: 2023.0.0
opentelemetry-spring-boot-starter: 2.18.1

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with Spring Cloud Gateway and opentelemetry-spring-boot-starter, then read the referenced Java agent pull request for its handling of dynamic routes. The work is complete when dynamic gateway routes report the correct http.route attribute instead of null.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.