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 6 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 <42@dmathieu.com>
@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 64.2%. Comparing base (2dc32c1) to head (26c54e1).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5741   +/-   ##
=====================================
  Coverage   64.2%   64.2%           
=====================================
  Files        199     199           
  Lines      12454   12454           
=====================================
  Hits        8001    8001           
  Misses      4219    4219           
  Partials     234     234           
Files Coverage Δ
...ation/github.com/gin-gonic/gin/otelgin/gintrace.go 81.1% <100.0%> (ø)
...ntation/github.com/gin-gonic/gin/otelgin/option.go 100.0% <100.0%> (ø)

@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?

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