elastic / elastic/ecs-logging-java
support for OTel APM trace_id and span_id
- 主要言語
- Java
- スター
- 148
- フォーク
- 82
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 3
説明
Assume you want to use the OTel APM library (for tracing) along with this ECS logging library for ECS-formatted logs (to be ingested, for example, via Filebeat). In Elasticsearch, we want correlation between OTel APM traces and app logs.
The OTel APM library (via OTel's [Logback MDC](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-mdc-1.0/library)) today puts trace_id and span_id on the MDC (good), but of course today, these field names are not ECS-compliant (e.g., "trace.id" and "span.id"). To allow Elasticsearch to correlate today, we need to translate these fields either in Filebeat (Agent) or in an ingest pipeline.
One solution might be to convince OTel's Logback MDC to adopt a flexible naming convention, or [to align to ECS](https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/9390#issuecomment-1719734044).
That said, given that "trace.id" and "span.id" are first-class ECS fields, it kind of feels like the ECS logging library should explicitly handle (special case) these fields, rather than just assuming they are named correctly on the MDC (e.g., as our own APM library would do). I saw another PR that suggested [prefixing MDC field with "label" (make sense)](https://github.com/elastic/ecs-logging-java/issues/142), but that would of course further obscure trace.id and span.id.
Should we consider special handling for "trace.id" and "span.id" (always top-level), perhaps with specific code to pick these up from our own APM library (basically pass-through copy from the MDC) and from OTel (with translation from trace_id and span_id)?
コントリビューションガイド
調査の方向性
まず、ECS logging library の MDC 処理と、リンクされている OpenTelemetry Logback MDC の動作を確認してください。要求されている trace_id と span_id の変換について確定した設計があるかどうかを判断してください。ECS trace.id と span.id の相関を維持する合意済みのアプローチが決まれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- observability-sre
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100