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

Disallow invalid label names on targets #777

Closed
benley opened this Issue Jun 6, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@benley
Copy link

benley commented Jun 6, 2015

It looks like Prometheus will let you apply invalid labels to targets that come from file_sd targets at the very least; probably other types as well.

e.g.

[{
  "targets": ["1.2.3.4:9100"],
  "labels": {
    "some_valid_label": "asdfasdfasdf",
    "oops:this-label-is-invalid": "asdfasdfasdf"
  }
}]

The "oops:this-label-is-invalid" label will show up on the status page under base labels, but there doesn't seem to be any way to query for it. The client_golang library restricts labels to [A-Za-z0-9_], but I don't see the same happening inside prometheus.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Jun 6, 2015

Thanks for reporting this.

Validation of label names goes via the client_golang library. The UnmarshalYAML method of the LabelName type checks the regex during unmarshaling. The respective UnmarshalJSON method that does the same was missing, thus you were able to provide wrong labelnames via JSON target groups.

As file SD is the only input of JSON target groups, this does not affect other areas.

So basically it's a bug in client_golang.
See #778, #132

@fabxc fabxc closed this Jun 8, 2015

simonpasquier pushed a commit to simonpasquier/prometheus that referenced this issue Oct 12, 2017

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.