Skip to content

otelmux: Adding http.route attribute to metrics#7966

Merged
dmathieu merged 10 commits into
open-telemetry:mainfrom
vinayvennela:add-http-route-attribute-to-metrics
Oct 4, 2025
Merged

otelmux: Adding http.route attribute to metrics#7966
dmathieu merged 10 commits into
open-telemetry:mainfrom
vinayvennela:add-http-route-attribute-to-metrics

Conversation

@vinayvennela
Copy link
Copy Markdown
Contributor

Changes Made in the PR:

  1. Re-use the "route" attribute thats captured during span creation in the metric attributes
  2. Test covering the metric attribute "http.route" is present
  3. Fixed existing unit test that has incorrect metric names and added changes to fail the test when such changes happen in future.

Implements - #7954

@vinayvennela vinayvennela requested a review from a team as a code owner October 2, 2025 09:44
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Oct 2, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions Bot requested a review from akats7 October 2, 2025 09:44
@akats7
Copy link
Copy Markdown
Contributor

akats7 commented Oct 2, 2025

Hi @vinayvennela, please sign the cla and add a change log entry as this is a user facing change

@vinayvennela
Copy link
Copy Markdown
Contributor Author

Hi @vinayvennela, please sign the cla and add a change log entry as this is a user facing change

Signed and added the CL

Comment thread CHANGELOG.md Outdated
Comment thread instrumentation/github.com/gorilla/mux/otelmux/mux.go Outdated
@dmathieu
Copy link
Copy Markdown
Member

dmathieu commented Oct 2, 2025

Running CI so you see the failures. But your changes won't work. The semconv package is generated (as is mentioned at the top of each file).
You need to update the template in https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/internal/shared/semconv, and to run make generate.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.6%. Comparing base (ca22ed4) to head (4e5be9b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #7966   +/-   ##
=====================================
  Coverage   78.5%   78.6%           
=====================================
  Files        184     184           
  Lines      14636   14673   +37     
=====================================
+ Hits       11496   11533   +37     
  Misses      2789    2789           
  Partials     351     351           
Files with missing lines Coverage Δ
.../go-restful/otelrestful/internal/semconv/server.go 82.0% <100.0%> (+0.4%) ⬆️
...m/gin-gonic/gin/otelgin/internal/semconv/server.go 82.0% <100.0%> (+0.4%) ⬆️
...com/gorilla/mux/otelmux/internal/semconv/server.go 82.0% <100.0%> (+0.4%) ⬆️
...trumentation/github.com/gorilla/mux/otelmux/mux.go 97.9% <100.0%> (+<0.1%) ⬆️
.../labstack/echo/otelecho/internal/semconv/server.go 82.0% <100.0%> (+0.4%) ⬆️
...httptrace/otelhttptrace/internal/semconv/server.go 82.0% <100.0%> (+0.4%) ⬆️
...ation/net/http/otelhttp/internal/semconv/server.go 82.0% <100.0%> (+0.4%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vinayvennela
Copy link
Copy Markdown
Contributor Author

Running CI so you see the failures. But your changes won't work. The semconv package is generated (as is mentioned at the top of each file). You need to update the template in https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/internal/shared/semconv, and to run make generate.

It really didn't strike my mind at all. Again thanks for being patient with me in explaining it.

@dmathieu dmathieu merged commit ee5a277 into open-telemetry:main Oct 4, 2025
29 checks passed
@vinayvennela
Copy link
Copy Markdown
Contributor Author

Hey @dmathieu , do you know when is the next release planned that contains this feature?

@dmathieu
Copy link
Copy Markdown
Member

It should be in the coming weeks.

@flc1125
Copy link
Copy Markdown
Member

flc1125 commented Oct 14, 2025

Hey @dmathieu , do you know when is the next release planned that contains this feature?

If you need to use it urgently, you can use go get -u go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux@main to use the unreleased version.

@MrAlias MrAlias added this to the v1.39.0 milestone Oct 14, 2025
@MrAlias MrAlias mentioned this pull request Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants