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

Extend Prometheus grammar to cover more of the exposition format #39

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wandernauta
Copy link
Contributor

This extends the Prometheus grammar so that it can correctly parse the example from the documentation, and adds a number of test cases.

The grammar now...

  • Allows spaces ("tokens can be separated by any number of blanks and/or tabs").
  • Allows empty lines ("Empty lines are ignored").
  • Allows special floating point values inf (infinity) and nan.
  • Allows supplying a timestamp field, which is ignored.
  • Allows trailing comma in sets of labels.
  • Uses metric name and label name regexes from the documentation, so e.g. 123test is no longer allowed.
  • Should no longer be confused by backslash escapes. (The escapes themselves are not unescaped.)

Some names in the PEG grammar are aligned with the EBNF grammar in the docs.

Finally, entirely empty (no lines at all) responses are now allowed, to be compatible with upstream Prometheus behavior.

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

Successfully merging this pull request may close these issues.

None yet

1 participant