Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eseite47 opened this issue Aug 11, 2022 · 2 comments
Open

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

eseite47 opened this issue Aug 11, 2022 · 2 comments

Comments

@eseite47
Copy link

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
Copy link
Collaborator

bdeitte commented Aug 13, 2022

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: #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
Copy link

ehaynes99 commented Jan 11, 2023

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:

hot-shots/lib/helpers.js

Lines 15 to 24 in fe8555a

function formatTags(tags, telegraf) {
if (Array.isArray(tags)) {
return tags;
} else {
return Object.keys(tags).map(key => {
return `${sanitizeTags(key, telegraf)}:${sanitizeTags(tags[key], telegraf)}`;
});
}
}

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']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants