open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.94k stars 845 forks source link

Add support for jboss-logmanager-mdc-1.1 library instrumentation #10036

Open ryandens opened 10 months ago

ryandens commented 10 months ago

Is your feature request related to a problem? Please describe.

Currently, the jboss-logmanager-mdc-1.1 module, responsible for injecting context from the current span into the mdc, is only supported via the javaagent instrumentation module. However, other logging runtimes logback support library instrumentation. I would like to use this logic without using a javaagent. For context, I use quarkus and the OpenTelemetry extension to instrument my application.

Describe the solution you'd like

We would create an org.jboss.logmanager.ExtHandler implementation to configure the MDC in the spirit of the exiting bytecode instrumentation approach that decorates the ExtLogRecord.getMdc() method to add in the context.

We would then provide documentation, like logbacks, to show users how to configure this ExtHandler

Describe alternatives you've considered

Another alternative would be to instrument my library using the static-instrumenter at compile time

Additional context

I'm happy to work on this issue myself! Please let me know if I missed any context. I looked around for evidence of why this might not have been done and couldn't find any reason not to.

laurit commented 10 months ago

@ryandens sure, feel free to create a PR.