Skip to content

feat(otelgin): add the WithGinMetricAttributes option to allow setting dynamic, per-request metric attributes based on *gin.Context #6932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

tranngoclam
Copy link
Contributor

@tranngoclam tranngoclam commented Mar 15, 2025

  • This PR adds a new func GinMetricAttributeFn of package otelgin.
  • The main purpose is to extract the path template using FullPath() func of gin.Context

@tranngoclam tranngoclam requested a review from a team as a code owner March 15, 2025 08:52
@github-actions github-actions bot requested a review from akats7 March 15, 2025 08:52
@dmathieu
Copy link
Member

This is a breaking change. We should at least deprecate the method for one release before breaking user's apps.

@dmathieu
Copy link
Member

In #5743, we added a new helper that took specifically a gin context.

@tranngoclam tranngoclam force-pushed the otelgin-use-gin-context-metrics branch from dc94339 to b3e26be Compare March 17, 2025 15:08
@tranngoclam tranngoclam changed the title otelgin: use gin.Context in MetricAttributeFn otelgin: add new func GinMetricAttributeFn Mar 17, 2025
@tranngoclam
Copy link
Contributor Author

Hi @dmathieu , I have updated to use a new func instead

Co-authored-by: Damien Mathieu <[email protected]>
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.7%. Comparing base (cbc79e4) to head (4576990).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #6932   +/-   ##
=====================================
  Coverage   75.7%   75.7%           
=====================================
  Files        207     207           
  Lines      19396   19403    +7     
=====================================
+ Hits       14685   14692    +7     
  Misses      4275    4275           
  Partials     436     436           
Files with missing lines Coverage Δ
...ntation/github.com/gin-gonic/gin/otelgin/config.go 100.0% <100.0%> (ø)
...umentation/github.com/gin-gonic/gin/otelgin/gin.go 92.6% <100.0%> (+0.1%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Damien Mathieu <[email protected]>
@tranngoclam tranngoclam changed the title otelgin: add new func GinMetricAttributeFn feat(otelgin): add the WithGinMetricAttributes option to allow setting dynamic, per-request metric attributes based on *gin.Context Mar 18, 2025
@dmathieu dmathieu merged commit 5b41ad8 into open-telemetry:main Mar 24, 2025
25 checks passed
@tranngoclam tranngoclam deleted the otelgin-use-gin-context-metrics branch March 24, 2025 09:18
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.

4 participants