opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

otelgrpc: Allow adding custom attributes to otelgrpc metrics

Open inigohu opened this issue 2 years ago • 6 comments

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 avatar May 31 '23 07:05 inigohu

@inigohu @MrAlias Does this need to be updated on all instrumentations? Let me know instrumentations which can be updated, I can take it.

rehanpfmr avatar Aug 22 '23 16:08 rehanpfmr

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

inigohu avatar Jan 15 '24 12:01 inigohu

Any updates on this? Had to copy-paste stats handler and allow custom attributes to be passed outside.

upalinski avatar Feb 04 '24 18:02 upalinski

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.

dmathieu avatar Feb 05 '24 09:02 dmathieu

Hi, is there any update on this :D it is really useful for our usecase to tag extra labels to our grpc traffic

duongcongtoai avatar Apr 27 '24 05:04 duongcongtoai

Hi @dmathieu, I've opened a PR if you want to take a look at it.

inigohu avatar May 09 '24 16:05 inigohu