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

Add transactions to fiber #807

Merged
merged 10 commits into from
Apr 11, 2024
Merged

Add transactions to fiber #807

merged 10 commits into from
Apr 11, 2024

Conversation

ribice
Copy link
Collaborator

@ribice ribice commented Apr 2, 2024

No description provided.

@ribice ribice requested a review from cleptric April 2, 2024 23:33
@ribice ribice self-assigned this Apr 2, 2024
@ribice
Copy link
Collaborator Author

ribice commented Apr 2, 2024

@cleptric For failing tests, not sure where the POS method is coming from.

fiber/sentryfiber.go Show resolved Hide resolved

transaction := sentry.StartTransaction(
sentry.SetHubOnContext(ctx.Context(), hub),
fmt.Sprintf("%s %s", method, ctx.Path()),
Copy link
Member

@cleptric cleptric Apr 4, 2024

Choose a reason for hiding this comment

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

Could you verify that parameters are properly parameterized?
https://docs.gofiber.io/guide/routing/#parameters

So for e.g. app.Get("/user/:id", func(c *fiber.Ctx) with a request like /user/1 we would want a transaction name of GET /user/:id.
If this is the case, we should add some tests. If not, and there is not always a way to get a parameterized route, we need to change the transaction source to SourceURL.

Copy link
Collaborator Author

@ribice ribice Apr 6, 2024

Choose a reason for hiding this comment

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

They are not, I changed it. The way to get it in fiber is by using ctx.Route().Name, but that's only filled after .Next which wouldn't work in this case.

gofiber/fiber#2195

},
},
TransactionInfo: &sentry.TransactionInfo{Source: "route"},
Extra: map[string]any{"http.request.method": http.MethodGet},
Copy link
Member

Choose a reason for hiding this comment

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

This should end up on Context instead of Extra. Extra is considered deprecated, and the UI in Sentry is much better for Context.

This is ofc not caused by this PR, it's due to the fact that we apply span.Data to event.Extra.

Let me verify this.

Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.23%. Comparing base (9311a06) to head (5f1e237).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #807      +/-   ##
==========================================
+ Coverage   81.08%   81.23%   +0.15%     
==========================================
  Files          49       49              
  Lines        4087     4120      +33     
==========================================
+ Hits         3314     3347      +33     
  Misses        632      632              
  Partials      141      141              

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

@cleptric cleptric merged commit 5d6374c into master Apr 11, 2024
20 checks passed
@cleptric cleptric deleted the fiber-transactions branch April 11, 2024 11:29
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