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

fix(http): use route name from 'r.Pattern' instead #875

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

aldy505
Copy link
Contributor

@aldy505 aldy505 commented Aug 25, 2024

I have a Go project running latest Chi - v5.1.0 and Go 1.22.x. Every root span becomes: GET /*/*/*. I don't think this is an issue on Chi though. Hoping this would fix that.

Copy link

codecov bot commented Aug 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.90%. Comparing base (e5d46d5) to head (f4e8894).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #875      +/-   ##
==========================================
- Coverage   82.94%   82.90%   -0.05%     
==========================================
  Files          53       55       +2     
  Lines        4592     4603      +11     
==========================================
+ Hits         3809     3816       +7     
- Misses        630      633       +3     
- Partials      153      154       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aldy505
Copy link
Contributor Author

aldy505 commented Aug 26, 2024

So http.Request.Pattern only exists on Go 1.23, yet the route matching exists on Go 1.22 :/

@@ -102,7 +101,7 @@ func (h *Handler) handle(handler http.Handler) http.HandlerFunc {
}

transaction := sentry.StartTransaction(ctx,
fmt.Sprintf("%s %s", r.Method, r.URL.Path),
getHTTPSpanName(r),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be added to negroni integration as well. Thus getHTTPSpanName needs to be moved to the root of the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer it to be inside something like github.com/getsentry/sentry-go/internal instead. Dunno if we have that already. I'll see this again tomorrow (my timezone).

@aldy505 aldy505 requested a review from ribice August 28, 2024 00:43
@ribice
Copy link
Collaborator

ribice commented Aug 28, 2024

Looks good to me. Please update changelog as well.

@ribice ribice merged commit 7085a1d into getsentry:master Sep 3, 2024
25 checks passed
@aldy505 aldy505 deleted the fix/http/use-value-from-pattern branch September 15, 2024 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants