brightcove / hot-shots

Node.js client for statsd, DogStatsD, and Telegraf
MIT License
527 stars 135 forks source link

Why are colons treated as reserved characters in tags? #232

Open eseite47 opened 2 years ago

eseite47 commented 2 years ago

Hi,

I am trying to send a tag in my metrics that would look something like this get_/v1/data/:id. However, in datadog, I can see that in datadog, the colon was replaced by an underscore, resulting in get_/v1/data/_id. Colons are listed as allowed characters in tags by datadog: https://docs.datadoghq.com/getting_started/tagging/

From the code, I can see from the tests in globalTags.js that this is the expected behavior. Why is that?

Thanks

bdeitte commented 2 years ago

This is done here: https://github.com/brightcove/hot-shots/blob/master/lib/helpers.js#L7

At the time, it appears this was seen as the right set of reserved characters: https://github.com/brightcove/hot-shots/issues/55

Open to a PR to have this fixed to whatever is the most current standard, although we'll have to think about backwards compatibility.

ehaynes99 commented 1 year ago

In the examples linked on that page, they show that env:staging:east would turn into key=env and value=staging:east. Thus, they should probably still be prohibited in keys here: https://github.com/brightcove/hot-shots/blob/fe8555a15bb8fdc3f94438d255a5c743ee2e2d08/lib/helpers.js#L15-L24

I.e. if you pass an object like { 'env:staging': 'east' }, it's not going to work out how you expect on the other end...

As a workaround, I don't see it doing any such sanitization if passed as an array... I could be overlooking it happen elsewhere, but shouldn't this work?

['env:staging:east']