You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/21 12:58:00 UTC

[GitHub] [airflow] bilbof commented on pull request #23080: Initialize finished counter at zero

bilbof commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1105174827

   Incrementing the timer by zero tells the receiver that the metric exists (sets it at zero) which is useful in cases where you want to capture the rate change from 0 to 1. Initializing metrics at zero is best practice for Prometheus metrics (which is how we're consuming the Statsd metrics from Airflow jobs).
   
   I've tested that should work with the Statsd Prometheus exporter locally:
   
   ```
   # first shell
   docker run -p 9102:9102 -p 9125:9125  -it prom/statsd-exporter
   # second shell
   echo "foo:0|c" | nc localhost 9125
   curl localhost:9102/metrics | grep foo
   
   # Result:
   # TYPE foo counter
   > foo 0
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org