Skip to content

Incorrect try number producing invalid span id for OTEL airflow #41501

@howardyoo

Description

@howardyoo

Apache Airflow version

2.10.0rc1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When OTEL Airflow is enabled, there are series of IDs for trace and span being generated.
Part of the ID generation process involves using 'try number' of the task instance to produce a unique ID representation of it. Try number has been somewhat unstable in Airflow, where many of its deficiencies were fixed in here: #39336. Now, as try number issues are resolved, it is necessary to fix the OTEL airflow to not:

  • increment or decrement try_number of task instance when generating span id
  • increment or decrement try_number when instrumenting information related to task instance

Currently, the task instance contains span_id that may not be correct depending on the try_number.

What you think should happen instead?

  • spans containing span_id should reflect the correct try_number of the task instance
  • information about try number is correctly displayed when emitting span

How to reproduce

Run an example DAG file, and monitor the span id being generated. Observe that span id generated from the span link does not match that of task instance span due to the fact that task instance will have the try_number decremented conditionally.

Operating System

All OS

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions