Repository navigation
[Observability] Include DAG tags as attributes on spans - #72458
realtimetodie wants to merge 9 commits into
Conversation
This change adds a new option to include DAG tags as attributes on spans. DAG tags as attributes on metrics already exist and were originally introduced in apache#68568.
xBis7
left a comment
There was a problem hiding this comment.
@realtimetodie It mostly looks good but I think we don't need to use a config flag unless there is a reason to.
|
@xBis7 Ah sorry, I think this is a misunderstanding. There is already a dag_tags_in_metrics configuration option, which is disabled by default. See my comments above. |
There was a problem hiding this comment.
|
Yes, you are right. My initial description was ambiguous. I was too focused on my telemetry backend, which can find the root span based on attributes from child spans. The cleaner OpenTelemetry design is to attach the DAG tags only to the root dag_run span. The following are the only two attributes present everywhere:
In my opinion, duplicating the DAG tags as attributes onto every task_run, worker and trigger span is unnecessary. However, it is technically possible.
|
|
@xBis7 I updated the code to include the DAG tags only to the DAG run span (the root span). |
xBis7
left a comment
There was a problem hiding this comment.
Thanks for updating the PR. The current approach for adding the tags just on the root span looks better.
|
@xBis7
see #72458 (comment) As I mentinoned before, in an upcoming pull request, I would like to change how DAG tags are represented in OpenTelemetry. Expanding every single tag into attributes is needed for StatsD-style metrics, but OpenTelemetry supports string-array attributes. This means all DAG tags in spans and metrics could be exported under a single attribute instead for OpenTelemetry, for example: |
|
I left a comment in #72364 (comment) |
|
Following #72364, I applied a fix that keeps the StatsD-specific normalization only for StatsD/Datadog metrics. For OpenTelemetry metrics, DAG tags now use This avoids applying StatsD character restrictions to OpenTelemetry metric attributes. |
xBis7
left a comment
There was a problem hiding this comment.
I went over the code again and I've left a small cosmetic comment. Apart from that it looks good to me.
|
Thank you. As soon as this is merged, I will submit the announced follow-up PR. |


This change adds a new option to include DAG tags as attributes on spans. DAG tags as attributes on metrics already exist and were originally introduced in #68568.
New configuration option:
Summary
dag_tags_in_spansto add DAG tags to task spans (defaultFalse)