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

Type loss and metric rename in prometheus input → prometheus output #2950

Closed
zagy opened this issue Jun 22, 2017 · 5 comments · Fixed by #3351
Closed

Type loss and metric rename in prometheus input → prometheus output #2950

zagy opened this issue Jun 22, 2017 · 5 comments · Fixed by #3351
Labels
area/prometheus bug unexpected problem or unintended behavior
Milestone

Comments

@zagy
Copy link

zagy commented Jun 22, 2017

Bug report

Loading the data with telegraf Prometheus input and exporting it with the prometheus output (e.g. haproxy-exporter --[prometheus protocol]--telegraf---[prometheus protocol]---…) yields

  • Metric is being renamed to *_<type> (e.g. haproxy_up becomes haproxy_up_gauge)
  • Type becomes untyped

Relevant telegraf.conf:

[inputs.prometheus]
urls = ["http://localhost:9127/metrics"]

[outputs.prometheus_client]
listen = "172.22.49.216:9126"

System info:

Tested in

  • 1.2.1
  • 1.3.0

Steps to reproduce:

  1. Setup https://github.com/prometheus/haproxy_exporter
  2. Point telegraf to haproxy_export (prometheus input)
  3. Setup telegraf output prometheus_client
  4. See that metrics are renamed after they come out of telegraf.

Expected behavior:

  • No rename of metric
  • Keep type

Actual behavior:

  • Metric is being renamed to *_<type> (e.g. haproxy_up becomes haproxy_up_gauge)
  • Type becomes untyped

haproxy exporter gives:

# HELP haproxy_up Was the last scrape of haproxy successful.
# TYPE haproxy_up gauge
haproxy_up 1

Telegraf exports:

# HELP haproxy_up_gauge Telegraf collected metric
# TYPE haproxy_up_gauge untyped
haproxy_up_gauge{host="hostname", url="http://localhost:9127/metrics"} 1
@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Jun 22, 2017
@spowser
Copy link

spowser commented Sep 27, 2017

Can confirm this issue. Any metrics that traverse through telegraf are losing their metric types. We also have Prometheus as the input and output.

@dylanzr
Copy link

dylanzr commented Sep 28, 2017

I can confirm this is present in 1.4.1. I think the offending line is found here

			// the prometheus input.
			var mname string
			if fn == "value" {
				mname = sanitize(point.Name())
			} else {
				mname = sanitize(fmt.Sprintf("%s_%s", point.Name(), fn))
                        }

@dylanzr
Copy link

dylanzr commented Sep 28, 2017

After thinking about this a little further, I think this would have to be addressed on the input and not the output. Trying to address this on the output would be difficult, as histogram types would have to construct new histogram labels and use the field names as the label value.

For any other single value metric, the field name should get used as the type.

@spowser
Copy link

spowser commented Oct 12, 2017

Will this be added to the 1.5 milestone?

@jdoupe
Copy link
Contributor

jdoupe commented Oct 13, 2017

This is mostly addressed by #3337. Types are still lost, but metric names are no longer mangled unnecessarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/prometheus bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants