opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

feature: allow to customize trace id, span id and trace flag attribute name in log

Open RouxAntoine opened this issue 2 years ago • 2 comments

this pull request allow to use a custom name for trace id related attributes

Usage exemple :

      <appender name="OTEL_COLLECTOR" class="io.opentelemetry.instrumentation.logback.mdc.v1_0.OpenTelemetryAppender">
        <traceFlagsAttributeName>trace.flags</traceFlagsAttributeName>
        <spanIdAttributeName>span.id</spanIdAttributeName>
        <traceIdAttributeName>trace.id</traceIdAttributeName>
      </appender>

maybe there is some documentation to update related to this ?

RouxAntoine avatar Mar 06 '23 13:03 RouxAntoine

hi @RouxAntoine! can you expand on the motivation, e.g. I'm curious if this is for integrating with an ECS-based system (Elastic Common Schema)?

trask avatar Mar 07 '23 05:03 trask

hello @trask,

yes this is exactly the purpose, in the OpenTelemetryAppender we reference the default logback ch.qos.logback.core.ConsoleAppender which contain itself the encoder <encoder class="co.elastic.logging.logback.EcsEncoder">

RouxAntoine avatar Mar 07 '23 08:03 RouxAntoine

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 14 days.

github-actions[bot] avatar Oct 03 '25 00:10 github-actions[bot]

closes as it is now supported

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/logback/logback-mdc-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java#L59-L61

RouxAntoine avatar Oct 03 '25 07:10 RouxAntoine