question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include exemplars in OpenCensus instrumentation

See original GitHub issue

Is 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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dapengzhang0commented, Oct 20, 2020

would you be open to a PR for this?

@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?

1reaction
aabmasscommented, Oct 9, 2020

I am happy to submit a PR for this 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exemplars - census-instrumentation/opencensus-specs - GitHub
Exemplars consist of a value that was recorded, an exact timestamp of when that value was recorded, and a set of attachments. Attachments....
Read more >
exemplar.go - Google Git
// limitations under the License. // Package exemplar implements support for exemplars. Exemplars are additional. // data associated with each measurement.
Read more >
exemplar - Go Packages
Package exemplar implements support for exemplars. Exemplars are additional data associated with each measurement. Their purpose it to provide ...
Read more >
Prometheus and OpenMetrics Compatibility | OpenTelemetry
If no exemplars exist on a bucket, the highest exemplar from a lower bucket MUST be used, even though it is a duplicate...
Read more >
census-instrumentation/Lobby - Gitter
All you need to do is to include opencensus-impl-core, register the RPC views, configure sampling and enable exporters. These tutorials may be helpful: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found