Telegraf: Prometheus output replaces "/" to "_"

Created on 18 Jun 2017  路  3Comments  路  Source: influxdata/telegraf

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

bug regression

Most helpful comment

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.

All 3 comments

got the same behavior.
my metrics has been doubled
image

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fahimeh2010 picture fahimeh2010  路  3Comments

efficks picture efficks  路  3Comments

m4ce picture m4ce  路  3Comments

grafanaUser123 picture grafanaUser123  路  3Comments

timhallinflux picture timhallinflux  路  3Comments