-
Notifications
You must be signed in to change notification settings - Fork 292
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
Add dynamic config support for log injection #5221
Conversation
BenchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 22 cases. |
…ogs-wip # Conflicts: # dd-java-agent/instrumentation/jboss-logmanager/src/main/java/datadog/trace/instrumentation/jbosslogmanager/ExtLogRecordInstrumentation.java # dd-java-agent/instrumentation/log4j1/src/main/java/datadog/trace/instrumentation/log4j1/LoggingEventInstrumentation.java # dd-java-agent/instrumentation/logback-1/src/main/java/datadog/trace/instrumentation/logback/LoggingEventInstrumentation.java # internal-api/src/main/java/datadog/trace/api/InstrumenterConfig.java
6f2f0f2
to
f0c049e
Compare
f0c049e
to
5f59ab7
Compare
…ogs-wip # Conflicts: # dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java
# Conflicts: # dd-trace-core/src/main/java/datadog/trace/core/TracingConfigPoller.java # internal-api/src/main/java/datadog/trace/api/DynamicConfig.java
…ogs-wip # Conflicts: # dd-smoke-tests/dynamic-config/build.gradle # dd-smoke-tests/dynamic-config/src/test/groovy/datadog/smoketest/DynamicServiceMappingSmokeTest.groovy # dd-trace-core/src/main/java/datadog/trace/core/TracingConfigPoller.java # internal-api/src/main/java/datadog/trace/api/DynamicConfig.java
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.
Looks good, but I would like some null
check guards unless I missed something.
...7/src/main/java/datadog/trace/instrumentation/log4j27/SpanDecoratingContextDataInjector.java
Outdated
Show resolved
Hide resolved
dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy
Show resolved
Hide resolved
...src/main/java/datadog/trace/instrumentation/jbosslogmanager/ExtLogRecordInstrumentation.java
Show resolved
Hide resolved
...n/log4j1/src/main/java/datadog/trace/instrumentation/log4j1/LoggingEventInstrumentation.java
Show resolved
Hide resolved
...ent/agent-tooling/src/main/java/datadog/trace/agent/tooling/log/LogContextScopeListener.java
Outdated
Show resolved
Hide resolved
Heads-up that I'm adding the rest of the dynamic-config plumbing in #5437 - once that's merged you'll be able to simplify this PR to just the pieces that act on the dynamic-config |
…ogs-wip # Conflicts: # dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java # dd-trace-core/src/main/java/datadog/trace/core/TracingConfigPoller.java # internal-api/src/main/java/datadog/trace/api/DynamicConfig.java # internal-api/src/main/java/datadog/trace/api/TraceConfig.java
...ent/agent-tooling/src/main/java/datadog/trace/agent/tooling/log/LogContextScopeListener.java
Outdated
Show resolved
Hide resolved
@@ -63,6 +63,7 @@ tasks.named('processLoggingResources').configure { | |||
|
|||
|
|||
dependencies { | |||
implementation project(path: ':dd-trace-ot', configuration: 'shadow') |
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.
I wasn't able to see where dd-trace-ot
is required in the tests - is this extra dependency still needed?
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.
It's there to be able to get a reference to ConfigCollector
which is how I test in the application that the config was updated. (ConfigCollector
is in internal-api
). It's a bit of a hack but I didn't want to go down the path of exposing a public api for dynamic config
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.
Understood, thanks for the explanation
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.
LGTM - just some minor cleanup to do before merging
2b3376e
to
fb30ab5
Compare
What Does This Do
Supports dynamic config with log injection. There are 3 main changes:
1. Instrumentation enable/disable is no longer controlled by the log injection flag
For "reasons", log injection was special-cased to also control instrumentation enable/disable. In order to support dynamic config, the instrumentations need to be enabled. We already have a separate mechanism for disabling instrumentations
2. "Event Instrumentation"s are wrapped in config checks
These are the parts of the instrumentations where the
AgentContext
is store in anInstrumentationContext
. With this PR, the instrumentation is skipped if log injection is not enabled (orTraceConfig
is null meaning a NOOP span)3. MDC operations are wrapped in config checks
These are parts of the instrumentations that might not occur during a span (the LogAppender writing an event). With these instrumentations, the PR checks if a context was stored (meaning log injection was enabled when the log message was created) or if log injection is enabled at the tracer level.
Testing
The smoke tests test:
enabled by default -> disabled by remote config -> reenabled by remote config reset.