dstandish commented on code in PR #68591: URL: https://github.com/apache/airflow/pull/68591#discussion_r3422682794
########## shared/observability/src/airflow_shared/observability/traces/__init__.py: ########## @@ -61,15 +62,51 @@ def generate_trace_id(self): def new_dagrun_trace_carrier(task_span_detail_level=None) -> dict[str, str]: - """Generate a fresh W3C traceparent carrier without creating a recordable span.""" + """ + Generate a fresh W3C traceparent carrier without creating a recordable span. + + The SAMPLED flag is set from an honest *root* sampling decision made by the + configured tracer provider's sampler (driven by ``OTEL_TRACES_SAMPLER`` / + ``OTEL_TRACES_SAMPLER_ARG``), rather than being hardcoded. This makes the + carrier the single head-sampling decision point for a DAG run: every + downstream span (dag_run, task_run, worker) rides on this flag. + + Backcompat: when ``OTEL_TRACES_SAMPLER`` is unset the SDK defaults to + ``parentbased_always_on`` whose root decision is ALWAYS_ON, so the flag is + SAMPLED and behavior is identical to the previous hardcoded value. Review Comment: ```suggestion ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
