Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#8,869 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
observability

調査の方向性

sdk/metrics/.../internal/exemplar/ReservoirCell.java の offerMeasurement() から始め、特に 73-76 行目を確認します。同じ bucket 内で、サンプリングされた span の内部で記録し、その後 span の外部で記録してから collect することで、常に有効化された exemplars で再現します。上書きされた exemplar の span context が新しい測定に属し、span 外部での記録に対して無効であれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Java
スター
2.5k
フォーク
1k
平均マージ
2日 19時間
マージ済み PR(30日)
64

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

open-telemetry/opentelemetry-java のほかの issue

open-telemetry/opentelemetry-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。