-
Notifications
You must be signed in to change notification settings - Fork 845
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
support for adding baggage to log4j 2 ContextData #8810
Conversation
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.
Thanks for contributing @lu-xiaoshuang !
I left a couple comments.
...etry/javaagent/instrumentation/log4j/contextdata/v2_7/SpanDecoratingContextDataInjector.java
Outdated
Show resolved
Hide resolved
...etry/javaagent/instrumentation/log4j/contextdata/v2_7/SpanDecoratingContextDataInjector.java
Outdated
Show resolved
Hide resolved
.../opentelemetry/instrumentation/log4j/contextdata/v2_17/OpenTelemetryContextDataProvider.java
Outdated
Show resolved
Hide resolved
.../opentelemetry/instrumentation/log4j/contextdata/v2_17/OpenTelemetryContextDataProvider.java
Outdated
Show resolved
Hide resolved
...rumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/README.md
Outdated
Show resolved
Hide resolved
4ae27f1
to
c6a0618
Compare
@mateuszrzeszutek update completed. |
@@ -43,6 +54,14 @@ public StringMap injectContextData(List<Property> list, StringMap stringMap) { | |||
newContextData.putValue(TRACE_ID, currentContext.getTraceId()); | |||
newContextData.putValue(SPAN_ID, currentContext.getSpanId()); | |||
newContextData.putValue(TRACE_FLAGS, currentContext.getTraceFlags().asHex()); | |||
|
|||
if (BAGGAGE_ENABLED) { |
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.
Can you add tests for the new feature? You can take a look at the logback implementation and do it in a similar way
Lines 15 to 21 in 47159e6
val addBaggageTest by registering(JvmTestSuite::class) { | |
targets { | |
all { | |
testTask.configure { | |
jvmArgs("-Dotel.instrumentation.logback-mdc.add-baggage=true") | |
} | |
} |
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.
Sorry. I am not familiar with the unit testing modules of this project. It would be great if some volunteers could provide testing cases in future. By the way, my private built agent with this feature works well for me.
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.
Hmm, I'll create a follow-up task for that instead.
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.
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.
Sure ~
@@ -43,6 +54,14 @@ public StringMap injectContextData(List<Property> list, StringMap stringMap) { | |||
newContextData.putValue(TRACE_ID, currentContext.getTraceId()); | |||
newContextData.putValue(SPAN_ID, currentContext.getSpanId()); | |||
newContextData.putValue(TRACE_FLAGS, currentContext.getTraceFlags().asHex()); | |||
|
|||
if (BAGGAGE_ENABLED) { |
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.
Hmm, I'll create a follow-up task for that instead.
Thanks @lu-xiaoshuang ! |
No description provided.