Allow forcing trace head-sampling per DAG run via conf#68860
Draft
dstandish wants to merge 2 commits into
Draft
Conversation
Builds on the head-sampling foundation (apache#68591) by forwarding run-identity attributes (dag_id, run_type) to the trace sampler, so a custom sampler can differentiate the head-sampling decision by run kind.
Deployments running a head sampler sometimes need to guarantee a specific run is traced (debugging a flaky DAG) or excluded (a noisy run), regardless of the configured sampling ratio. A reserved run conf key, airflow/trace_sampled, provides that per-run override: true always traces the run, false never does, and absent leaves the decision to the sampler. Only an explicit bool is honored so a malformed value can neither silently change sampling nor fail run creation.
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.
Adds a reserved run conf key,
airflow/trace_sampled, that overrides the head-sampling decision for an individual DAG run:true— always trace this runfalse— never trace itOTEL_TRACES_SAMPLER)This lets a deployment running a head sampler guarantee a specific run is traced (e.g. debugging a flaky DAG) or excluded (a noisy run) regardless of the configured sampling ratio. Only an explicit boolean is honored — strings, numbers, and other values are ignored and fall through to the sampler, so a malformed conf value can neither silently change sampling nor fail run creation.
Depends on #68592 (
Forward run-identity attributes to the trace sampler), on which this is stacked — it touches the samenew_dagrun_trace_carriersignature and carrier call sites. Targetingmain; once #68592 merges, this PR's diff reduces to the override change alone. It can merge after #68592.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines