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

Prometheus output replaces "/" to "_" #2937

Closed
Bregor opened this issue Jun 18, 2017 · 3 comments · Fixed by #2939
Closed

Prometheus output replaces "/" to "_" #2937

Bregor opened this issue Jun 18, 2017 · 3 comments · Fixed by #2939
Labels
bug unexpected problem or unintended behavior regression something that used to work, but is now broken
Milestone

Comments

@Bregor
Copy link

Bregor commented Jun 18, 2017

Bug report

Starting from release 1.3.2 there is function sanitize in package prometheus_client which replaces anything but ^a-zA-Z0-9_ to _.
/ is not included in invalidNameCharRE, so all filesystem mounts looks like _var_lib_postgresql which is confusing.

Relevant telegraf.conf:

[inputs.diskio]
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs"]

[outputs.prometheus_client]
listen = ":9126"

System info:

$ telegraf --version
Telegraf v1.3.2 (git: release-1.3 0f419e9a0d294ab4d68bb7d1c6b28e60d362239b)
$ uname -r
4.8.0-54-generic

Steps to reproduce:

  1. Upgrade telegraf to 1.3.2
  2. Voila!

Expected behavior:

To return / as /

Actual behavior:

All slashes replaced with underscores
grafana - host stats 2017-06-18 11-55-26

@freeseacher
Copy link
Contributor

got the same behavior.
my metrics has been doubled
image

@Bregor
Copy link
Author

Bregor commented Jun 18, 2017

By digging deeper I realised, sanitization rules for labels are used to sanitize metric names.
Following expressions are identical:

And also sanitization methods:

In Prometheus these rules are only for labels, but Telegraf uses them for metric names sanitization, which is terrible wrong.

@danielnelson danielnelson added bug unexpected problem or unintended behavior regression something that used to work, but is now broken labels Jun 19, 2017
@danielnelson danielnelson added this to the 1.3.3 milestone Jun 19, 2017
@danielnelson
Copy link
Contributor

Looking over the changes and the previous version, it looks that the difference is that we are now applying the sanitize function label values. Metric names were sanitized in the previous Telegraf release.

Here are the allowed values for metrics names and labels. Technically we should allow : in the metric name as well, but this would be a breaking change so I won't do it just yet.

I'll link to a pull request soon removing the sanitization of label values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior regression something that used to work, but is now broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants