Closed
Conversation
c624e7c to
6063d6a
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a mechanism to disable APM tracing via DD_APM_TRACING_ENABLED=false, while allowing at least one trace per second to be sampled when disabled, and propagates the new config flag through agent, tracer, and telemetry components.
- Added
ApmDisabledTraceSamplerfor rate-limited sampling when tracing is disabled - Introduced
apm_tracing_enabledflag across config loading, agent, tracer, and telemetry - Switched to
ErasedTraceSamplerto unify sampler interfaces
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/datadog/trace_sampler.cpp | Implemented ApmDisabledTraceSampler, updated erasure model |
| src/datadog/telemetry/telemetry_impl.cpp | Added APM_TRACING_ENABLED serialization in telemetry names |
| src/datadog/tags.{h,cpp} | Declared _dd.p.ts and _dd.apm.enabled internal tags |
| src/datadog/extraction_util.cpp | Extended trace tag parsing for _dd.p.ts |
| src/datadog/datadog_agent_config.{h,cpp} | Loaded and finalized apm_tracing_enabled from env/user |
| src/datadog/datadog_agent.{h,cpp} | Stored flag on agent and conditionally set HTTP header |
| src/datadog/config_manager.{h,cpp} | Wrapped TraceSampler in ErasedTraceSampler |
| include/datadog/{tracer_config,tracer}.h | Exposed APM tracing flag and disabled sampler in tracer API |
| include/datadog/trace_segment.h | Added member apm_tracing_enabled_ to TraceSegment |
| include/datadog/{collector,config,environment}.h | Updated enums and environment lookup for new flag |
| include/datadog/sampling_mechanism.h | Updated enum comment for APP_SEC mechanism |
| include/datadog/injection_options.h | Added has_appsec_matches field |
Comments suppressed due to low confidence (2)
include/datadog/tracer.h:42
- [nitpick] The field name
apm_tracing_disabled_sampler_is potentially confusing; consider renaming to something likeapm_disabled_sampler_ordisabled_trace_sampler_to clarify its intent.
std::shared_ptr<ErasedTraceSampler> apm_tracing_disabled_sampler_;
src/datadog/trace_sampler.cpp:128
- Consider adding unit tests for
ApmDisabledTraceSamplerto verify rate-limiting behavior and ensure that at least one trace per second is retained when tracing is disabled.
SamplingDecision ApmDisabledTraceSampler::decide(const SpanData& span_data) {
e7329bb to
749f18b
Compare
Collaborator
|
Feature implemented in #224. Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Implement DD_APM_TRACING_ENABLED=false, as described in the relevant RFC ("Configuration to Disable APM Tracing"). It also tries to keep at least about roughly 1 trace/second, so the application is deemed active.