You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by da...@apache.org on 2016/09/09 17:38:05 UTC

incubator-airflow git commit: [AIRFLOW-494] Add per-operator success/failure metrics

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 3a1be4aac -> daa326cb4


[AIRFLOW-494] Add per-operator success/failure metrics

Adds metrics for success/failure rates of each operator, that way
when we e.g. do a new release we will have some
signal if there is a regression in an operator. It
will also be useful if e.g. a user wants to
upgrade their infrastructure and make sure that
all of the operators still work as expected.

Testing Done:
- Local staging and make sure that several
operators successes/failures were accurately
reflected

Closes #1785 from aoen/ddavydov/add_per_operator_s
uccess_fail_metrics


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/daa326cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/daa326cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/daa326cb

Branch: refs/heads/master
Commit: daa326cb4dc5e367182f344a957b979952731c73
Parents: 3a1be4a
Author: Dan Davydov <da...@airbnb.com>
Authored: Fri Sep 9 10:37:28 2016 -0700
Committer: Dan Davydov <da...@airbnb.com>
Committed: Fri Sep 9 10:37:32 2016 -0700

----------------------------------------------------------------------
 airflow/models.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/daa326cb/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index 64727d6..15bbc30 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -1268,6 +1268,8 @@ class TaskInstance(Base):
                     self.xcom_push(key=XCOM_RETURN_KEY, value=result)
 
                 task_copy.post_execute(context=context)
+                Stats.incr('operator_successes_{}'.format(
+                    self.task.__class__.__name__), 1, 1)
             self.state = State.SUCCESS
         except AirflowSkipException:
             self.state = State.SKIPPED
@@ -1307,6 +1309,7 @@ class TaskInstance(Base):
         session = settings.Session()
         self.end_date = datetime.now()
         self.set_duration()
+        Stats.incr('operator_failures_{}'.format(task.__class__.__name__), 1, 1)
         if not test_mode:
             session.add(Log(State.FAILED, self))