Open ferruzzi opened 5 months ago
Yes. Good idea. Let's do it.
Not sure it really qualifies as a bug, but it didn't really feel like a "feature request" either. Feel free to adjust my tagging.
I've added "good first issue" because this ins one of those "easy to implement but time consuming" ones IMHO.
If anyone wants to take it on and needs some guidance, hit me up on Slack
please assign me
I think the easiest answer would be to convert the existing metrics tags dicts to ordereddicts, then in the statsd_logger module you can join them and know they'll always be the same order.
Hi I would be willing to work on this.
@ferruzzi Hi. I came across this article while troubleshooting an issue. It looks like it's okay to combine metric names using dict instead of using ordereddict, what do you think?
hmmmmmmm. yeah, I think maybe you are right. As of 3.8, dicts are guaranteed to retain the order they were inserted and we require 3.8+ for Airflow so.... yeah, that should work and make things easier. Sorry about that.
What happened?
When OTel support was added, it enabled adding tags to metrics. Metrics such as
ti.start.<dag_id>.<task_id>
becameti.start
with the tags fordag_id
andtask_id
. Statsd does not support tagging, so all metrics had to be emitted twice; once with tagging and once assembled as a single long name. Over time, we've forgotten this and some newer metrics have been added which only emit one way or the other.What you think should happen instead?
I propose that airflow.metrics.statd_logger should be modified to assemble the name and tags into a long name, then any and all double-emitted metrics can be consolidated and future metrics can be easier and more consistently implemented.
How to reproduce
Example of some "double-emitted" metrics:![image](https://github.com/apache/airflow/assets/1920178/f769b546-0cde-4bd1-a072-1753708544d6)
in this case, statsd.incr() accepts the tags but does nothing with them. If it did a
("_").join(name, tags)
before emitting, then we could drop the redundant metric and simplify future additions.Are you willing to submit PR?
Code of Conduct