This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e5964ed1c1 Metrics Tagging (#36528)
e5964ed1c1 is described below
commit e5964ed1c16c0e8a1f600a3471790f29e5c9c2c4
Author: Gopal Dirisala <[email protected]>
AuthorDate: Fri Jan 5 00:16:54 2024 +0530
Metrics Tagging (#36528)
* Add tagging for existing metrics
* documentation updation
---
airflow/models/dagrun.py | 5 ++---
airflow/models/taskinstance.py | 4 +++-
.../administration-and-deployment/logging-monitoring/metrics.rst | 2 ++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 5b522ff627..791e1351cf 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -679,9 +679,8 @@ class DagRun(Base, LoggingMixin):
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)
diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
index 15761ea2e4..942250eabf 100644
--- a/airflow/models/taskinstance.py
+++ b/airflow/models/taskinstance.py
@@ -2459,7 +2459,9 @@ class TaskInstance(Base, LoggingMixin):
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"]
diff --git
a/docs/apache-airflow/administration-and-deployment/logging-monitoring/metrics.rst
b/docs/apache-airflow/administration-and-deployment/logging-monitoring/metrics.rst
index a973f4e69e..aff3ec3e9a 100644
---
a/docs/apache-airflow/administration-and-deployment/logging-monitoring/metrics.rst
+++
b/docs/apache-airflow/administration-and-deployment/logging-monitoring/metrics.rst
@@ -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