Skip to content

Commit

Permalink
Metrics Tagging (apache#36528)
Browse files Browse the repository at this point in the history
* Add tagging for existing metrics

* documentation updation
  • Loading branch information
dirrao authored and abhishekbhakat committed Mar 5, 2024
1 parent 132c111 commit 12c7d1f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions airflow/models/dagrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,8 @@ def recalculate(self) -> _UnfinishedStates:

start_dttm = timezone.utcnow()
self.last_scheduling_decision = start_dttm
with Stats.timer(
f"dagrun.dependency-check.{self.dag_id}",
tags=self.stats_tags,
with Stats.timer(f"dagrun.dependency-check.{self.dag_id}"), Stats.timer(
"dagrun.dependency-check", tags=self.stats_tags
):
dag = self.get_dag()
info = self.task_instance_scheduling_decisions(session)
Expand Down
4 changes: 3 additions & 1 deletion airflow/models/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2459,7 +2459,9 @@ def signal_handler(signum, frame):
if not self.next_method:
self.clear_xcom_data()

with Stats.timer(f"dag.{self.task.dag_id}.{self.task.task_id}.duration", tags=self.stats_tags):
with Stats.timer(f"dag.{self.task.dag_id}.{self.task.task_id}.duration"), Stats.timer(
"task.duration", tags=self.stats_tags
):
# Set the validated/merged params on the task object.
self.task.params = context["params"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ Timers
Name Description
================================================================ ========================================================================
``dagrun.dependency-check.<dag_id>`` Milliseconds taken to check DAG dependencies
``dagrun.dependency-check`` Milliseconds taken to check DAG dependencies. Metric with dag_id tagging.
``dag.<dag_id>.<task_id>.duration`` Seconds taken to run a task
``task.duration`` Seconds taken to run a task. Metric with dag_id and task-id tagging.
``dag.<dag_id>.<task_id>.scheduled_duration`` Seconds a task spends in the Scheduled state, before being Queued
``dag.<dag_id>.<task_id>.queued_duration`` Seconds a task spends in the Queued state, before being Running
``dag_processing.last_duration.<dag_file>`` Seconds taken to load the given DAG file
Expand Down

0 comments on commit 12c7d1f

Please sign in to comment.