Skip to content
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

otelgin: add routeName argument to SpanNameFormatter function #5741

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

NeoCN
Copy link
Contributor

@NeoCN NeoCN commented Jun 6, 2024

For Gin framework, the route name can only be get by using FullPath() function in gin.Context, the original SpanNameFormatter only has the http.Request argument that can not get the right route name if route parameters used.

This PR add routeName argument to SpanNameFormatter function, align with SpanNameFormatter in otelmux.

@NeoCN NeoCN requested a review from hanyuancheung as a code owner June 6, 2024 04:57
@NeoCN NeoCN requested a review from a team June 6, 2024 04:57
Copy link
Member

@dmathieu dmathieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had #4280 which didn't get traction, but did the same thing, using *gin.Context instead of a new argument.
Are there any other information from the gin context we may want to use in span name formatter?

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Damien Mathieu <[email protected]>
@NeoCN
Copy link
Contributor Author

NeoCN commented Jun 6, 2024

@dmathieu Currently no other info needed from the gin.Context. Honestly, using gin.Context will be more flexible as lots of things can be got from the context. Do we need the flexibility ?

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.6%. Comparing base (0a25107) to head (1fd7392).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5741   +/-   ##
=====================================
  Coverage   66.6%   66.6%           
=====================================
  Files        192     192           
  Lines      15525   15525           
=====================================
+ Hits       10351   10354    +3     
+ Misses      4883    4881    -2     
+ Partials     291     290    -1     
Files with missing lines Coverage Δ
...ation/github.com/gin-gonic/gin/otelgin/gintrace.go 84.0% <100.0%> (ø)
...ntation/github.com/gin-gonic/gin/otelgin/option.go 100.0% <100.0%> (ø)

... and 1 file with indirect coverage changes

@NeoCN NeoCN requested a review from dmathieu June 7, 2024 05:47
@dmathieu
Copy link
Member

Ping @hanyuancheung

@NeoCN
Copy link
Contributor Author

NeoCN commented Jun 17, 2024

@dmathieu @hanyuancheung Any suggestions for this PR?

@NeoCN
Copy link
Contributor Author

NeoCN commented Jul 10, 2024

@hanyuancheung Any suggestions? Or any principles to follow?

@NeoCN NeoCN requested a review from a team as a code owner October 21, 2024 09:35
@NeoCN
Copy link
Contributor Author

NeoCN commented Oct 21, 2024

@dmathieu @hanyuancheung Do you have any suggestions for this PR? Or should I change to add new function like WithSpanNameGinFormatter ?

@dmathieu
Copy link
Member

otelgin is now deprecated due to a lack of owner: #6190
While we would be happy to get a new owner for this package, I'm not sure introducing breaking changes at this stage makes sense.
If you're interested in stepping up to own this package, I'd recommend starting with smaller, more trivial changes.

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.

2 participants