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/19 12:38:05 UTC
[GitHub] [airflow] bilbof opened a new pull request, #23080: Initialize finished counter at zero
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] bilbof commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
bilbof commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1105414589
Thanks @ashb, I rebased to the latest main.
--
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
[GitHub] [airflow] ashb merged pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
ashb merged PR #23080:
URL: https://github.com/apache/airflow/pull/23080
--
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
[GitHub] [airflow] ashb commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1105325963
Oh, somehow I thought this was changing the existing metric we emitted. Looking at it again I see it's not. Clearly not.
--
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
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1106447664
Awesome work, congrats on your first merged pull request!
--
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
[GitHub] [airflow] bilbof commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [airflow] bilbof commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
bilbof commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1106361677
@ashb just a gentle nudge about this one - tests are passing now π
--
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
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1102593320
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:
- Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
- In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, itβs a heavy docker but it ships with a working Airflow and a lot of integrations.
- Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
- Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
- Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
Apache Airflow is a community-driven project and together we are making it better π.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
--
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
[GitHub] [airflow] github-actions[bot] commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1105388705
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.
--
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
[GitHub] [airflow] jedcunningham commented on pull request #23080: Initialize finished counter at zero
Posted by GitBox <gi...@apache.org>.
jedcunningham commented on PR #23080:
URL: https://github.com/apache/airflow/pull/23080#issuecomment-1109075978
Thanks @bilbof, congrats on your first commit π
--
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