elastic / elastic/ecs-logging-java
support for OTel APM trace_id and span_id
- Lenguaje dominante
- Java
- Estrellas
- 148
- Forks
- 82
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 3
Descripción
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)?
Guía de contribución
Línea de trabajo
Revisa primero el manejo de MDC de la ECS logging library y el comportamiento de MDC de OpenTelemetry Logback enlazado. Determina si existe un diseño establecido para la traducción solicitada de trace_id y span_id; se consideraría terminado cuando exista un enfoque acordado que preserve la correlación de ECS trace.id y span.id.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- observability-sre
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100