Skip to content

Allow forcing trace head-sampling per DAG run via conf - #68860

Merged
dstandish merged 1 commit into
apache:mainfrom
astronomer:trace-sampled-conf-override
Jun 24, 2026
Merged

dstandish merged 1 commit into
apache:mainfrom
astronomer:trace-sampled-conf-override

Conversation

@dstandish

@dstandish dstandish commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Adds a reserved run conf key, airflow/trace_sampled, that overrides the head-sampling decision for an individual DAG run:

  • true — always trace this run
  • false — never trace it
  • absent — leave the decision to the configured sampler (OTEL_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.

Was built on top of #68592


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

@dstandish
dstandish marked this pull request as draft June 22, 2026 20:18
@dstandish
dstandish force-pushed the trace-sampled-conf-override branch from 7ab6331 to 087b161 Compare June 23, 2026 19:19
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.
@dstandish
dstandish force-pushed the trace-sampled-conf-override branch from 087b161 to 55d3904 Compare June 23, 2026 20:27

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dstandish
dstandish marked this pull request as ready for review June 24, 2026 16:29
@dstandish
dstandish merged commit a6115b1 into apache:main Jun 24, 2026
148 checks passed
@dstandish
dstandish deleted the trace-sampled-conf-override branch June 24, 2026 20:06
karenbraganz pushed a commit to karenbraganz/airflow that referenced this pull request Jun 30, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants