-
Notifications
You must be signed in to change notification settings - Fork 933
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
Conversation
ctx, span := tracing.StartSpan(ctx) | ||
defer span.End() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
No description provided.