rust-statsd icon indicating copy to clipboard operation
rust-statsd copied to clipboard

Metric tags

Open levkk opened this issue 3 years ago • 3 comments

Hey there,

Thank you for writing this, awesome project!

Curious, should there be support for tagging metrics? I could imagine something like this:

client.incr("some.metric", vec!["service:api"])

or maybe even better:

let client = Client::new("127.0.0.1:8125", "project", vec!["service:api"]).unwrap()

and this would add the tag service with value api to all metrics.

Thanks!

Edit: I think I was confused; tags seem to be a Datadog extension of StatsD, and it's not part of the StatsD spec.

levkk avatar Feb 14 '22 18:02 levkk

I think I was confused; tags seem to be a Datadog extension of StatsD, and it's not part of the StatsD spec.

Yes, tags are a datadog extension. I think other statsd like servers support tags in a similar way though. I don't have much time to do the research, but if tags are implemented consistently by a few other statsd collectors/servers then I don't see a reason to not implement them here.

markstory avatar Feb 15 '22 05:02 markstory

@levkk This forked lib has constant tagging feature. https://github.com/minato128/rust-dogstatsd

minato128 avatar Feb 15 '22 14:02 minato128

That's amazing, thank you for showing me that @minato128 .

@markstory Thank you! I think at this point it's clearly a Datadog extension of the protocol. That being said, Datadog is pretty popular so might be worth an optional setting or something similar.

All the best!

levkk avatar Feb 15 '22 16:02 levkk