Skip to content

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.

1 participant