opentelemetry-go-contrib
opentelemetry-go-contrib copied to clipboard
otelgrpc: Allow adding custom attributes to otelgrpc metrics
Problem Statement
The otelgrpc instrumentation does not allow adding custom attributes to the metrics.
Proposed Solution
The otelhttp instrumentation, for example, provides a labeler for adding custom attributes.
@inigohu @MrAlias Does this need to be updated on all instrumentations? Let me know instrumentations which can be updated, I can take it.
I see that the new otelgrpc.StatsHandler has been implemented. Would it be possible to include this feature? Maybe make gRPCContextKey and gRPCContext public to pass custom attributes? WDYT @pellared
Any updates on this? Had to copy-paste stats handler and allow custom attributes to be passed outside.
I believe a similar approach to what's being done in net/http (the Labeler mentioned in the issue's description) would be fine, if you want to open a PR.
Hi, is there any update on this :D it is really useful for our usecase to tag extra labels to our grpc traffic
Hi @dmathieu, I've opened a PR if you want to take a look at it.