airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Update statsd-mappings.yml

Open stuart23 opened this issue 1 year ago • 5 comments
trafficstars

For tasks that belong to task groups, the emitted metric format is airflow.dag.<dag_id>.<taskgroup_id>.<task_id>.duration and therefore it is not being picked up by the existing airflow_task_duration mapping. This adds an extra mapping to capture those use metrics and parse them.


^ Add meaningful description above Read the Pull Request Guidelines for more information. In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed. In case of a new dependency, check compliance with the ASF 3rd Party License Policy. In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

stuart23 avatar Feb 16 '24 14:02 stuart23

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 Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst) Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits 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 Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment 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 for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits. Apache Airflow is a community-driven project and together we are making it better 🚀. In case of doubts contact the developers at: Mailing List: [email protected] Slack: https://s.apache.org/airflow-slack

boring-cyborg[bot] avatar Feb 16 '24 14:02 boring-cyborg[bot]

https://github.com/apache/airflow/blob/35c1a1a024e652c001930bf42416e06d3c20cf95/chart/files/statsd-mappings.yml#L18-L23

Taragolis avatar Feb 16 '24 15:02 Taragolis

https://github.com/apache/airflow/blob/35c1a1a024e652c001930bf42416e06d3c20cf95/chart/files/statsd-mappings.yml#L18-L23

This is fully backwards compatible, it will ship more metrics than already exist and won't change any existing metrics

stuart23 avatar Feb 16 '24 16:02 stuart23

This is fully backwards compatible, it will ship more metrics than already exist and won't change any existing metrics

The chart just remaps, it doesn't exclude metrics that aren't covered. Task durations for tasks in task groups already are exposed. This would move them.

e.g.

airflow_dag_task_group_example_my_taskgroup_sometask_duration{quantile="0.5"} 0.17767495400000002
airflow_dag_task_group_example_my_taskgroup_sometask_duration{quantile="0.9"} 0.17767495400000002
airflow_dag_task_group_example_my_taskgroup_sometask_duration{quantile="0.99"} 0.17767495400000002
airflow_dag_task_group_example_my_taskgroup_sometask_duration_sum 0.17767495400000002
airflow_dag_task_group_example_my_taskgroup_sometask_duration_count 1

Would become:

airflow_task_duration{dag_id="task_group_example",task_id="sometask",taskgroup_id="my_taskgroup",quantile="0.5"} 0.085300168
airflow_task_duration{dag_id="task_group_example",task_id="sometask",taskgroup_id="my_taskgroup",quantile="0.9"} 0.085300168
airflow_task_duration{dag_id="task_group_example",task_id="sometask",taskgroup_id="my_taskgroup",quantile="0.99"} 0.085300168
airflow_task_duration_sum{dag_id="task_group_example",task_id="sometask",taskgroup_id="my_taskgroup"} 0.085300168
airflow_task_duration_count{dag_id="task_group_example",task_id="sometask",taskgroup_id="my_taskgroup"} 1

jedcunningham avatar Feb 16 '24 21:02 jedcunningham

OK I guess I was just looking at our implementation that drops all non-matching metrics. Seems like there isn't going to be a good solution to unpack taskgroup tasks. I really hope we move to OTLP as soon as possible...

stuart23 avatar Feb 21 '24 00:02 stuart23