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 2: Invalid characters in recording rule names are silently allowed (and break things) #3290

Closed
EdSchouten opened this Issue Oct 13, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@EdSchouten
Copy link
Contributor

EdSchouten commented Oct 13, 2017

#So here I am, migrating a recording rule from Prometheus 1 to an instance running 2.0.0-rc0:

banana{color="yellow"} = strawberry{flavor="sweet"}

Prometheus 2 uses YAML. Let's try this?

- record: banana{color="yellow"}
  expr: strawberry{flavor="sweet"}

Interesting: Prometheus starts properly and the rule gets displayed on the rules page. Yet, I can't seem to get any results when using simple queries like banana. Well, as it turns out, the recording rule above introduces an actual metric with name banana{color="yellow"}; not banana. You end up with metrics along this shape: banana{color="yellow"}{flavor="sweet"}. The only way you can access them is if you use queries like {__name__=~"banana.*"}.

Reading some more documentation, it looks like I need to do this instead:

- record: banana
  expr: strawberry{flavor="sweet"}
  labels:
    color: yellow

Question: would it make sense to add some kind of safety belt to the recording rules parser to reject names that don't match [a-zA-Z_:][a-zA-Z0-9_:]*?

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 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 23, 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.