Allow for dynamic log injection configuration #2992
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2542
As part of Dynamic Configuration, we want to allow users to enable or disable log injection at any time.
The main limitation we have in Ruby Tracing is that we need to patch an integration to enable log injection.
This PR enables all integrations that perform log correlation to always inject the correlation patch methods, but allow it to be safely disabled when
Datadog.configuration.tracing.log_injection
is set tofalse
at runtime.Rails, for example, was making decision at the application startup that couldn't be changed later. This PR addresses that.
We still depend on users having instrumented the integration itself for correlation to work.
Our
SemanticLogger
andLograge
integrations already support dynamic configuration of log injection; onlyRails
core logger andActiveJob
logging needed changes.