-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Pass the context to the telemetry hooks #874
Comments
Which context? The client context closes only when the client is closed. I'm not opposed, although this doubles the surface area of hooks for a pretty marginal gain. Would you be open to contributing this? |
I was referring to the context passed to |
Which hook? |
I'm not sure how related this is (if not, I'll happily open a new issue) but I also need the context passed down to get trace info, specifically to logs. This would allow to modify the logger adapters and for the specific loggers which support passing the context (such as zerolog, see the This change might however break the |
@twmb all hooks that are executed after producing. In our specific case, I referring to |
I believe @0xjac has a good solution above, "So a better approach might be to pass the context as a field and in the adapters to set it as the context if possible or ignore it." This pairs well with the incoming #907, so that users can use the same context for the logger adapters as they use for the client. Internally, the context is wrapped in a few places so that it can have a more scoped cancellation. So, whatever context is passed to the adapter would not be able to catch cancellation, but this is pretty minor. Is catching cancellation needed, or is the context being used to pass around values? |
Hi, it would be very useful if we would have access to the producer context in the telemetry hooks. This would allow us to trace application specific and connect metrics points specific to the trace in the context. This would work with OpenTelemetry.
My proposal is to pass the ctx as the first parameter to the functions.
The text was updated successfully, but these errors were encountered: