Repository navigation
Fix Dag metrics dropped when a tag contains invalid characters - #72364
Conversation
Signed-off-by: PoAn Yang <payang@apache.org>
b323c89 to
976f090
Compare
|
nice! |
|
Hi maintainer, this PR was merged without a milestone set.
|
|
Not backported - it is in 3.4.0 upcoming functionality |
|
@potiuk I think this change is generally badly designed and implemented at the wrong layer.
This is also lossy. A tag such as env:pro d becomes env=pro_d, and non-ASCII characters are replaced as well. Once that happens, the original value cannot be recovered by the OpenTelemetry exporter. The StatsD problem is real, but the normalization should happen in the StatsD/InfluxDB-specific path, not in the shared DAG tag representation used by every other metrics backend. |
|
I applied a fix for this in #72458. The change now keeps build_dag_metric_tags() for StatsD/Datadog, while OpenTelemetry metrics use the generic expand_dag_tags() path so the original DAG tag values are preserved. This keeps the StatsD fix from leaking into OpenTelemetry metric attributes. |
|
@realtimetodie Thanks for the suggestion. I agree this should not do normalization for all backends. We can do it in |
…e#72364) Signed-off-by: PoAn Yang <payang@apache.org>
|
I don't have permission to do it, either. Let's wait for other committers. |
…e#72364) Signed-off-by: PoAn Yang <payang@apache.org>
Why
airflow/shared/observability/src/airflow_shared/observability/metrics/validators.py
Line 47 in a32662c
airflow/shared/observability/src/airflow_shared/observability/metrics/validators.py
Lines 115 to 131 in a32662c
[metrics] dag_tags_in_metricsturns Dag tags into metric tags.DagTag.namevalidates length only, so any character reaches the StatsD wire.statsd_influxdb_enabled,prepare_stat_with_tagsappends those tags to the stat name beforevalidate_statsees it. The validator then rejects the whole metric, not just the invalid tag.How
build_dag_metric_tags()withnormalize_name_for_stats.Verification
uv run --project shared/observability pytest shared/observability/tests/observability/metrics/test_stats.py -xvsIn container:
On main branch, the scheduler will show following error, but this doesn't happen in this branch.
curl -s http://statsd-exporter:9102/metrics | grep airflow_dagrunWas generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.