The GitHub Actions job "Tests" on airflow.git has succeeded.
Run started by GitHub user bilbof (triggered by ashb).

Head commit for run:
a272afefffcc0a5b319161a3e02f2c02570af81e / Bill Franklin <[email protected]>
Initialize finished counter at zero

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 any 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:

```
sum by (dag_id, task_id) (rate(airflow_ti_finish{state='failed'}[1h])) >
0
```

This tells us the failure rate of tasks over time.

What I've tried to do instead to ensure the metric captures the change
from zero to one:

```
(sum by (dag_id, task_id) (rate(airflow_ti_finish{state='failed'}[1h])) > 0) or 
sum by (dag_id, task_id) (airflow_ti_finish{state='failed'} != 0 unless 
(airflow_ti_finish{state='failed'} offset 1m))
```

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/

Report URL: https://github.com/apache/airflow/actions/runs/2204714179

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to