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

Error when metric is presented in two different prom files #485

Closed
hryamzik opened this issue Mar 1, 2017 · 6 comments
Closed

Error when metric is presented in two different prom files #485

hryamzik opened this issue Mar 1, 2017 · 6 comments

Comments

@hryamzik
Copy link

hryamzik commented Mar 1, 2017

* gathered metric family node_service_state_last_run_exit_code has help "Metric read from /var/lib/node_exporter/node_service_node_exporter_last_exit_code2.prom" but should have "Metric read from /var/lib/node_exporter/node_service_node_exporter_last_exit_code.prom"

To reproduce just clone any prom and change labels in a new file.

@borsdenold
Copy link

I found solution. This error rise in registy.ro. If tries to found HELP comment for metric, and if does not find, use file name. But for equal metric in different files help text will be different. So, you can add equal HELP comment line for every metric.
For example:

first.prom

# HELP mymetric mymetric_help_text mymetric{source="source",target="target"} 1 1490257498360

second.prom

# HELP mymetric mymetric_help_text mymetric{source="source",target="target"} 112323 1490257498360

@hryamzik
Copy link
Author

Thanks @borsden, good point!

@szocske42
Copy link

Hi,

I ran into this, and thought I'd clarify the current state of node_exporter when the same "helpless" metric (same name, different labels, no "# HELP") is present in multiple input files:

  • You get a benign-looking error message about the different (generated) HELPs.
  • The metric is parsed only from one file, no matter the different labels.
  • The workaround is to add an explicit # HELP to the metrics in all files (same in all files).

Adding # HELP gets rid of the error message and allows the metrics to be parsed too.
This is with the binary download node_exporter-0.14.0.linux-amd64.

@SuperQ
Copy link
Member

SuperQ commented Feb 22, 2018

having the same metric in multiple files is officially not supported.

@SuperQ SuperQ closed this as completed Feb 22, 2018
@finkr
Copy link

finkr commented Aug 30, 2018

For the record, the same error can occur for wmi-exporter.

@calzoneman
Copy link

having the same metric in multiple files is officially not supported.

@SuperQ could you elaborate on why this is? Is it a technical constraint (difficult to implement correctly) or is there some other reason? I ran into this today and was caught by surprise. There are a couple of ways I can think of to work around it but none of them feels particularly elegant (and writing a new exporter would be complete overkill for what I'm trying to do with the textfiles collector).

If there's a good reason to keep it unsupported, would you at least accept a pull request to update https://github.com/prometheus/node_exporter/blob/master/README.md#textfile-collector to define this behavior since the documentation currently does not indicate this?

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

6 participants