Include exemplars in OpenCensus instrumentation
See original GitHub issueIs your feature request related to a problem?
The OpenCensus GRPC instrumentation does not attach exemplar spans along with the distribution stats it collects.
Exemplars are example points that may be used to annotate aggregated distribution values. They are metadata that gives information about a particular value added to a Distribution bucket, such as a trace ID that was active when a value was added. They may contain further information, such as a example values and timestamps, origin, etc.
Google cloud monitoring can interpret and display these exemplars to link metrics to example spans.
Describe the solution you’d like
Add exemplars to grcp-census instrumentation directly near this code: https://github.com/grpc/grpc-java/blob/020325617129b6ae9b25da1126ba0f98b044bb1b/census/src/main/java/io/grpc/census/CensusStatsModule.java#L647
Adding something like this should work:
ExemplarUtils.putSpanContextAttachments(measureMap, tracer.getCurrentSpan().getContext());
Describe alternatives you’ve considered
I don’t think there is a way to do this without updating the grpc-census instrumentation code. AFAIK adding the exemplar to the MeasureMap
directly is the only way to do it.
Additional context
I’m not sure how to get the OpenCensus Tracer for tracer.getCurrentSpan()
inside of CensusStatsModule
. It may also be beneficial to check if the current span is being sampled before attaching it to the MeasureMap
.
cc @nilebox
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
@aabmass We would like to know why we/google cloud want this feature before making a PR. Would you send some more detail feature request doc internally and let grpc-java-team@ review?
I am happy to submit a PR for this 🙂