New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slf4JEventListener support custom key #160
Conversation
@@ -23,4 +23,5 @@ dependencies { | |||
testImplementation 'org.junit.jupiter:junit-jupiter' | |||
testImplementation 'org.assertj:assertj-core' | |||
testImplementation 'org.mockito:mockito-core' | |||
testImplementation 'ch.qos.logback:logback-classic' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we need StaticMDCBinder
to init MDC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it used?
Here https://github.com/qos-ch/slf4j/blob/v_1.7.36/slf4j-api/src/main/java/org/slf4j/MDC.java#L97
...-tracing-bridge-otel/src/main/java/io/micrometer/tracing/otel/bridge/Slf4JEventListener.java
Show resolved
Hide resolved
...tracing-bridge-otel/src/test/java/io/micrometer/tracing/otel/bridge/OtelTracingApiTests.java
Outdated
Show resolved
Hide resolved
...tracing-bridge-otel/src/test/java/io/micrometer/tracing/otel/bridge/OtelTracingApiTests.java
Outdated
Show resolved
Hide resolved
|
||
private final String customSpanIdKey = "customSpanId"; | ||
|
||
Slf4JEventListener slf4JEventListenerCustom = new Slf4JEventListener(customTraceIdKey, customSpanIdKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we call this customSlf4JEventListener
?
Also, is it possible to move these three lines to the new test method you created?
I'm still wondering about this - do you want to use this with Spring Boot? I'm wondering cause you can't modify these when using Brave and we would like to be pretty consistent I guess, WDYT @shakuzen @jonatan-ivanov ? |
Hey we discussed it with the team and we will merge this, however we're not planning to add any additional support for this in Spring Boot. You will need to create a bean of this type and use the new constructor if you want to use different keys in MDC. |
I am still new to the Brave. I think I can fix this , but not right now |
see #158