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 plugin seems to export metric from the input plugin #2327

Closed
Seb-Solon opened this issue Jan 27, 2017 · 4 comments
Closed

Comments

@Seb-Solon
Copy link

Bug report

Relevant telegraf.conf:

One inuput enabled

[[inputs.exec]]
  commands = ["/tmp/test", "A B C"]
  name_suffix = "_mycollector"
  data_format = "nagios"

One output enabled

 [[outputs.prometheus_client]]
   listen = ":9126"
   expiration_interval = "10s"

System info:

Telegraf v1.2.0 (git: release-1.2 b2c1d98)

Steps to reproduce:

  1. Use the provided config
  2. Launch telegraph
  3. curl http://127.0.0.1:9126/metrics
  4. See a bunch of metric extra (go_, http_, process_*)

Expected behavior:

To not have those metrics. Maybe there is parameter to not export them, I did not find any.

Actual behavior:

The /metrics contains metric that, I think, comes from the input.prometheus : https://github.com/influxdata/telegraf/blob/master/plugins/inputs/prometheus/README.md
See the go_goroutines for example

Additional info:

telegraf -test looks good however

017/01/26 22:36:27 I! Using config file: /etc/telegraf/telegraf.conf
* Plugin: inputs.exec, Collection 1
> nagios_state_mycollector,host=seb-debian state=2i 1485488187000000000
> art_mycollector,unit=ms,host=seb-debian min=0,max=5,value=0,warning=1,critical=2 1485488187000000000

Regards,

@sparrc
Copy link
Contributor

sparrc commented Jan 27, 2017

those are not from the prometheus input, they are automatically exported from the prometheus client library.

I'm going to close this because it's not an issue. I don't think there is a way to turn those exported metrics off, but if there is then I'd be happy to consider a PR.

@sparrc sparrc closed this as completed Jan 27, 2017
@Seb-Solon
Copy link
Author

Thanks for the help. I have digged into the code, and it looks like the client register a collector with a bunch of metrics pre-defined. From my understand, this collector is not meant to be remove so I am not sure it is a good a idea to hack into the telegraf plugin to make a parameter out of it.

Registration is here : https://github.com/prometheus/client_golang/blob/master/prometheus/registry.go#L53
GoCollector here : https://github.com/prometheus/client_golang/blob/master/prometheus/go_collector.go#L20

The idea would be to access the Registry.collectorsByID var and remove the collector but the "MustRegister" call in init() makes me think this collector is required for the client to work.

Any opinion maybe? I am not familiar with Prometheus internals...

@sparrc
Copy link
Contributor

sparrc commented Jan 29, 2017

Probably best to open an issue in the prometheus client library asking for a publicly-exposed switch to turn those metrics off

@jdoupe
Copy link
Contributor

jdoupe commented Oct 13, 2017

This is addressed by #3337. The go_* and process_* metrics come from the main part of client library (as pointed out above). The http_* metrics come from the deprecated portion of the http listener built into the client library.

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

No branches or pull requests

3 participants