File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
task-sdk/src/airflow/sdk/execution_time Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1215,6 +1215,16 @@ def _handle_current_task_failed(
12151215) -> tuple [RetryTask , TaskInstanceState ] | tuple [TaskState , TaskInstanceState ]:
12161216 end_date = datetime .now (tz = timezone .utc )
12171217 ti .end_date = end_date
1218+
1219+ # Record operator and task instance failed metrics
1220+ operator = ti .task .__class__ .__name__
1221+ stats_tags = {"dag_id" : ti .dag_id , "task_id" : ti .task_id }
1222+
1223+ Stats .incr (f"operator_failures_{ operator } " , tags = stats_tags )
1224+ # Same metric with tagging
1225+ Stats .incr ("operator_failures" , tags = {** stats_tags , "operator" : operator })
1226+ Stats .incr ("ti_failures" , tags = stats_tags )
1227+
12181228 if ti ._ti_context_from_server and ti ._ti_context_from_server .should_retry :
12191229 return RetryTask (end_date = end_date ), TaskInstanceState .UP_FOR_RETRY
12201230 return (
You can’t perform that action at this time.
0 commit comments