Repository navigation
Add dag_id and task_id tags to resumable_job metrics - #75721
Merged
vatsrahul1001 merged 1 commit intoOct 27, 2026
Merged
vatsrahul1001 merged 1 commit into
vatsrahul1001 merged 1 commit into
Conversation
ashb
approved these changes
Oct 27, 2026
vatsrahul1001
deleted the
add-more-ti-stats-to-resumablemixin-counters
branch
October 27, 2026 08:30
Contributor
Backport successfully created: v3-4-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
vatsrahul1001
pushed a commit
that referenced
this pull request
Oct 27, 2026
) (#75732) (cherry picked from commit 5243901) Co-authored-by: Amogh Desai <[email protected]>
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was generative AI tooling used to co-author this PR?
What
The five
resumable_job.*counters ship with a singleoperatortag. That answers "how often did durable execution avoid redoing work, for which operator", but not "for which Dag". Per-Dag is the question people ask when they want to know whether the feature is earning its keep on a specific pipeline, and today it cannot be answered from these metrics at all.Current behaviour
Every
resumable_job.*counter carriesoperator, plusteam_nameon multi-team deployments. Nothing identifies the Dag or task that produced the count, so all executions of every Dag using a given operator collapse into one series.Proposed change
Take the whole of
RuntimeTaskInstance.stats_tagsinstead of pulling one key out of it. That property already assembles the label set every other task metric uses, so the counters now carrydag_id,task_idandrun_typealongsideoperator, withteam_namecontinuing to appear where it applies.The metric descriptions in
metrics_template.yamlare updated to match.Changes of Note
stats_tagsalso includes author-chosen Dag tags when[metrics] dag_tags_in_metricsis enabled. These counters now inherit that, same asti.startandti.finish.The alternative was filtering to a fixed key list (
dag_id,task_id,run_type,team_name), which bounds cardinality by construction. I kept the consistent behaviour instead, because the config is off by default and a deployment that turns it on has opted into that blast radius everywhere else already. Happy to switch if reviewers would rather these five counters be special-cased.User implications / backcompat
No breaking change. The labels only materialise on backends that carry tags: OTel and dogstatsd natively, StatsD only with
[metrics] statsd_influxdb_enabled. That is the same constraint the existingoperatortag already has, not a new one, so plain StatsD deployments see no difference.Series cardinality on these five counters increases for anyone already receiving the tags, bounded by
dag_idxtask_idxoperator.Testing
Using this dag:
Case 1: Running it normally without interruption
Metrics have the added tags now:
Before this change the same line read
{operator="MockBatchOperator"}.Case 2: Running with
simulate_final_statusasSUCCEEDEDCrashed the worker when the task waits for it
Now the metrics:
airflow_resumable_job_already_succeeded_total{dag_id="example_resumable_job",instance="36ec9a2f-9faf-475e-93b8-6590f4fc4a73",job="test",operator="MockBatchOperator",otel_scope_name="airflow.sdk._shared.observability.metrics.otel_logger",otel_scope_schema_url="",otel_scope_version="",run_type="manual",task_id="run_batch_job"} 1 airflow_resumable_job_fresh_submit_total{dag_id="example_resumable_job",instance="36b43c68-344c-4222-ad4a-3c93128716d2",job="test",operator="MockBatchOperator",otel_scope_name="airflow.sdk._shared.observability.metrics.otel_logger",otel_scope_schema_url="",otel_scope_version="",run_type="manual",task_id="run_batch_job"} 1 airflow_resumable_job_reconnect_attempt_total{dag_id="example_resumable_job",instance="36ec9a2f-9faf-475e-93b8-6590f4fc4a73",job="test",operator="MockBatchOperator",otel_scope_name="airflow.sdk._shared.observability.metrics.otel_logger",otel_scope_schema_url="",otel_scope_version="",run_type="manual",task_id="run_batch_job"} 1{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.