bilbof opened a new pull request, #23080:
URL: https://github.com/apache/airflow/pull/23080

   Sets initial count of task finished state to zero. This enables acquiring 
the rate from zero to one (particularly useful if you want to alert on task 
failures).
   
   We're using the Prometheus statsd-exporter. Since counters are usually used 
with a PromQL function like `rate`, it's important
   that counters are initialized at zero, otherwise when a task finishes the 
rate function will not have a previous value to compare the state count to.
   
   For example, what we'd like to do, which tells us the failure rate of tasks 
over time:
   
   ```
   sum by (dag_id, task_id) (rate(airflow_ti_finish{state='failed'}[1h])) > 0
   ```
   
   Two useful posts on this subject:
   https://www.robustperception.io/why-predeclare-metrics
   
https://www.section.io/blog/beware-prometheus-counters-that-do-not-begin-at-zero/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to