The GitHub Actions job "Tests (AMD)" on airflow.git/main has succeeded.
Run started by GitHub user potiuk (triggered by potiuk).

Head commit for run:
be44ad1ac6c3b368187b73542ae06e1339ffa8fc / Daniel Standish 
<[email protected]>
Make head sampling possible in airflow (#68591)

* Honor OTEL_TRACES_SAMPLER for DAG-run head sampling

The dag_run.context_carrier hardcoded TraceFlags.SAMPLED, which became the
parent for every downstream span (dag_run, task_run, worker). That poisoned
parent-based sampling: the configured OTEL_TRACES_SAMPLER controlled nothing,
since the always-sampled remote parent forced ParentBased samplers to keep
emitting task/worker spans regardless of the env var.

Make the carrier carry an honest sampling decision:

- new_dagrun_trace_carrier() now consults the configured tracer provider's
  sampler with a ROOT decision (parent_context=None) against the freshly
  generated trace_id, setting SAMPLED only when the decision is
  RECORD_AND_SAMPLE. When the provider has no sampler (proxy/no-op provider,
  i.e. otel off) it falls back to not-sampled, which is observably identical
  to today (nothing exports). dag_id/run_type are forwarded as attributes so a
  custom sampler can differentiate by run kind. The detail-level tracestate is
  merged onto whatever the sampler returns so it still round-trips.

- _emit_dagrun_span honors the flag (required: it forces a root span via
  context.Context(), so the sampler would otherwise never see the flag). An
  invalid/empty carrier (legacy DagRun) still emits a root span as before.

- _emit_task_span honors the dag_run carrier's flag for consistency/safety.

- Threaded dag_id/run_type into both DagRun-based carrier call sites.

The worker span path (_make_task_span) needs no change: with an unsampled
remote parent carrier, start_as_current_span yields a non-recording span via
the default ParentBased sampler (verified).

Backcompat: unset OTEL_TRACES_SAMPLER defaults to parentbased_always_on whose
root decision is ALWAYS_ON, so everything is still traced — no behavior change
for anyone who hasn't opted in.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Clarify why the _emit_task_span head-sampling guard is kept

The previous comment framed the guard as redundant (ParentBased would
drop the child anyway) without saying when it isn't. Spell out that it
keeps emission consistent under non-parent-based samplers and
short-circuits before building the span.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Parametrize head-sampling span tests and clarify docstrings

Combine the sampled/unsampled carrier span tests into single parametrized
tests in both the DagRun and execution-API suites, and clarify the
head-sampling docstrings.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Drop dag_id/run_type sampler attributes from carrier creation

Keep this PR focused on honoring the configured OTel sampler. Forwarding
run-identity attributes to the sampler (for custom per-run-kind sampling),
via a shared helper reused at span-emit time, is deferred to a followup PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Simplify the head-sampling guard comments

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Update 
shared/observability/src/airflow_shared/observability/traces/__init__.py

* Fix shared-listeners span tests for honest carrier sampling

TestListenerSpan built its parent context from new_dagrun_trace_carrier,
which now consults the global tracer provider's sampler. In tests that
provider is a no-op ProxyTracerProvider (no sampler), so the carrier came
out unsampled and ParentBased dropped the listener spans. Point the
carrier's provider lookup at the real sampling test provider.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Move dag-run span TODO comment indentation to its own PR

The comment-only indentation change is unrelated to head sampling; it now
lives in a standalone PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/27788283227

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to