-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Allow customization of allowed chars in graphite output #12832
Comments
Hi, Thanks for the feature request. I received another request through our support channels for this same thing :) so I was looking at it recently. I think adding a new option for the non-tag enabled path is the right path. My hesitation thus far has been around trying to understand why we are sanitizing characters in the first place and if there was a published spec about valid characters. The only thing I have seen was around Graphite tag name and values, not the metric path. Today the non-tag path, uses the strict sanitation function, which will:
Character could still get sanitized by the first few replace/removes even with a custom setting, although I think that might be ok. Is that your understanding as well? If so, I think a new What do you think? |
@powersj reading deeper into the graphite issue I finally found the definition in the code suggesting that all printable characters, i.e.
are allowed for the metric name while the following characters need to be escaped
|
Yeah I think there should be a distinction between
Regarding (2), based on sending metrics to graphite in our place, I was able to send data using At the moment the full metric string is passed througth So for me it'd make sense if there's an option to customize the sanitizing/escaping, but have a sane default value. |
The graphite serializer is very strict as to what characters are allowed to pass through. This allows the user to override the regex used and specify their own. fixes: influxdata#12832
@maxbeutel in 20-30mins there will be artifacts, which you can use to test the new behavior in #12835. I think @srebhan and I would still need to talk through if this is the best way internally to make the change, but the PR exposes the new Thanks! |
Thanks for the quick response! Unfortunately (or, lucky for me) I'm travelling for a while now so I can only test it out after that. |
@powersj do we really need to be able to customize the regexp? How about having a |
@srebhan that is a route I thought about as well. A couple thoughts:
What do you think? |
@powersj @srebhan can we consider to reopen this? The current implementation doesn't actually work using the following toml config:
Because in https://github.com/influxdata/telegraf/blob/master/plugins/outputs/graphite/graphite.go#L168 the config option for the regex isn't passed (the third argument, the empty string, should be the sanitize regex option.)
The fix would be to introduce the config option in GraphiteStrictRegex string and then pass it instead of the empty string. |
Missed adding this correctly to the graphite output, only the parser in a previous PR. fixes: influxdata#12832
Missed adding this correctly to the graphite output, only the parser in a previous PR. fixes: influxdata#12832
Ah right, I added it to the parser not the output. Can you try out the artifacts in PR #12908 in 20-30mins? Thanks! |
Looks good now, I tested it by adding Edit: Will this be part of the |
We will include this and the other PR in v1.26.1 on or around March 3 |
I guess you mean April 3? : ) Thank you again for implementing this option, helps us a lot. |
lol - yes, where did this month go?! |
Use Case
|my_prefix|
(yep, that's right, it needs pipes.)Expected behavior
Specify a list of (additional?) safe chars that don't get stripped when using Graphite output, such that a metric like
Can be sent to the graphite socket (and
|
pipe chars don't get escaped)Actual behavior
Currently pipes
|
get replaced with_
in the graphite output due to the regexin
plugins/serializers/graphite/graphite.go
.That is, a metric in the form of
will be rewritten to
Additional info
I'm OK to raise a Pull Request if there's a chance to get this merged.
Ideas:
strictAllowedChars
used to escape the metricsThe text was updated successfully, but these errors were encountered: