Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Exemplar keeps stale span context when a reservoir cell is overwritten outside a span

Aperta Adatta ai principianti
#8,869 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
observability

Direzione di ricerca

Inizia in sdk/metrics/.../internal/exemplar/ReservoirCell.java, in offerMeasurement(), soprattutto alle righe 73-76. Riproduci il problema con exemplars sempre attivi registrando all'interno di uno span campionato e poi al di fuori di uno nello stesso bucket, quindi raccogli. È completato quando il contesto dello span dell'exemplar sovrascritto appartiene alla nuova misurazione ed è non valido per la registrazione al di fuori dello span.

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

Descrizione

Describe the bug
When an exemplar reservoir cell is overwritten within one collection cycle by a measurement recorded outside a span, the exported exemplar has the new value, time and attributes but keeps the trace/span id of the previous measurement.

Steps to reproduce

  1. Build an SdkMeterProvider with setExemplarFilter(ExemplarFilter.alwaysOn()) (or otel.metrics.exemplar.filter=always_on).
  2. On a histogram with default buckets, call record(1.0) inside a sampled span, then record(2.0) with no active span (same bucket).
  3. Collect.

What did you expect to see?
An exemplar with value=2.0 and an invalid span context. The spec defines an exemplar as one recorded measurement, with the trace/span id of the span active when it was recorded.

What did you see instead?
value=2.0 with the span id of the first measurement. ReservoirCell.offerMeasurement() (sdk/metrics/.../internal/exemplar/ReservoirCell.java lines 73-76) always overwrites value, time and attributes, but updates spanContext only when the new span context is valid.

What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-metrics
Version: main @ ce32c1205
How did you reference these artifacts? Local build

Environment
Compiler: Temurin 21
OS: N/A

Additional context
Not visible with the default trace_based filter, since every measurement it lets through has a sampled span.

Spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#exemplar

Lingua principale
Java
Stelle
2.5k
Fork
1k
Merge medio
2g 19h
PR unite (30g)
64

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-telemetry/opentelemetry-java

Tutte le issue di open-telemetry/opentelemetry-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.