Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: trace httpapi.{Read,Write} #4134

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
merged 8 commits into from
Sep 21, 2022
Merged

feat: trace httpapi.{Read,Write} #4134

merged 8 commits into from
Sep 21, 2022

Conversation

coadler
Copy link
Contributor

@coadler coadler commented Sep 20, 2022

No description provided.

@coadler coadler self-assigned this Sep 20, 2022
@coadler coadler marked this pull request as ready for review September 20, 2022 17:47
@coadler coadler requested a review from kylecarbs September 20, 2022 17:47
Comment on lines +110 to +111
ctx, span := tracing.StartSpan(ctx)
defer span.End()
Copy link
Member

Choose a reason for hiding this comment

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

Why do we care about tracing this? It seems like this function is so simple, that it's weird to trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For httpapi.Read I would agree, but that was mostly to make them consistent. I thought it would be weird if one was traced and the other wasn't.

httpapi.Write is a lot more useful. JSON marshaling can sometimes take a non-insignificant amount of time, and this could help us catch outliers. Additionally, we can enrich span data a bit more since we have access to the actual interface{} we're marshalling, such as the number of elements in an array, which could help us spot routes that need to be paginated.

Copy link
Member

@kylecarbs kylecarbs Sep 21, 2022

Choose a reason for hiding this comment

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

Toss this gorgeous comment next to httpapi.Write and I'll approve!

@coadler coadler merged commit 5de6f86 into main Sep 21, 2022
@coadler coadler deleted the colin/json-tracing branch September 21, 2022 22:07
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