grpc / grpc/grpc-java

Include exemplars in OpenCensus instrumentation

Aperta
#7,505 6 commenti 1 reazione 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

### Is your feature request related to a problem?

The OpenCensus GRPC instrumentation does not attach [exemplar](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/TypedValue#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:
```java
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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in grpc-java's census/src/main/java/io/grpc/census/CensusStatsModule.java vicino alla riga 647, quindi esamina come viene popolata la MeasureMap e come è possibile accedere allo span OpenCensus corrente. Conferma il comportamento appropriato di ExemplarUtils e del campionamento prima di modificare la strumentazione. Il lavoro è completato quando le misurazioni di distribuzione includono esemplari di span utilizzabili a cui Google Cloud Monitoring può collegarsi, con una copertura del nuovo comportamento se il repository fornisce test pertinenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
grpc, java
Ambito
observability-sre
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.