open-telemetry / open-telemetry/opentelemetry-java-instrumentation
get route info in spring-cloud-gateway with opentelemetry-spring-boot-starter
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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