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

Certain tag values break telegraf #120

Open
lbeschastny opened this issue Sep 19, 2019 · 3 comments
Open

Certain tag values break telegraf #120

lbeschastny opened this issue Sep 19, 2019 · 3 comments

Comments

@lbeschastny
Copy link
Contributor

I've found several cases when hot-shots sends malformed packets to telegraf.

tags ending with '\\' break telegraf for an unknown reason

Reproduction example:

const {StatsD} = require('hot-shots');
const client = new StatsD({telegraf: true});

client.increment('test', 1, {foo: 'bar\\'});

Telegraf output:

2019-09-19T11:34:50Z E! [outputs.influxdb]: when writing to [http://influxdb:8086]: received error unable to parse 'test,env=dev,env_type=staging,foo=bar\,host=bafcd9da9c22,metric_type=counter value=1i 1568892885000000000': invalid tag format; discarding points

Though it may be a telegraf issue, I think it still worth mentioning.

, in tag value is handled incorrectly

const {StatsD} = require('hot-shots');
const client = new StatsD({telegraf: true});

client.increment('test', 1, {foo: 'bar,baz'});

Resulting InfluxDB data:

> select * from test
name: test
time                env env_type foo host         metric_type value
----                --- -------- --- ----         ----------- -----
1568893035000000000 dev staging  bar bafcd9da9c22 counter     1

Instead of bar,baz only bar is saved.

This looks like a hot-shots issue which should be addressed in sanitizeTags helper.

@bdeitte
Copy link
Collaborator

bdeitte commented Sep 22, 2019

Thanks for the heads up! We accept PRs for any issues, so if you or someone working with you would like to fix the ",", certainly would pull that in if it was made telegraf specific.

@lbeschastny
Copy link
Contributor Author

lbeschastny commented Apr 21, 2020

Just opened #165 PR to fix , issue.

I'm not sure what we should do with trailing \ issue. Replacing it with _ doesn't look like a good idea since it works fine in any other place.

@bdeitte
Copy link
Collaborator

bdeitte commented Apr 29, 2020

You could still update sanitizeTags to explicitly look for '_' right at the end the line in sanitizeTags, that would work. But fixing the comma issue, bringing that one in now, thanks.

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

No branches or pull requests

2 participants