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

X-Ray formatted trace ID injection

Open willarmiros opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. I would like to be able to instrument common logging libraries like Log4J and Logback to inject trace IDs that are formatted in the AWS X-Ray format, as opposed to the default W3C format.

Describe the solution you'd like This solution is already available in the downstream AWS-distributed Java agent (source). I would like a similar library instrumentation available so I can use it without needing the agent.

Describe alternatives you've considered Injecting trace IDs in W3C format works for manual trace -> log correlation, but for automated correlation done by AWS services like ServiceLens, the X-Ray format is required.

cc @anuraaga

willarmiros avatar Dec 14 '21 14:12 willarmiros

hey @willarmiros, have you seen https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/log4j/log4j-appender-2.17/library and https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-appender-1.0/library?

trask avatar May 22 '23 23:05 trask

I think this is more about context data, which gets a fixed formatting here

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/log4j/contextdata/v2_17/OpenTelemetryContextDataProvider.java#L40

Perhaps the propagator can be used instead of fixed key/values there

anuraaga avatar May 22 '23 23:05 anuraaga