prometheus/promql/parser
Filip Petkovski 97c7fffbb8
parser: Allow parsing arbitrary functions
In Thanos we would like to start experimenting with custom functions that are
currently not part of the PromQL spec. We would do this by adding an implementation
for those functions in the Thanos engine: https://github.com/thanos-community/promql-engine and allow
users to decide which engine they want to use on a per-query basis.

Since we use the PromQL parser from Prometheus, injecting functions in the global `Functions` variable
would mean they also become available for the Prometheus engine. To avoid this side-effect, this commit
exposes a Parser interface in which the supported functions can be injected as an option. If not functions
are injected, the parser implementation will default to the functions defined in the global Functions variable.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
2023-03-22 10:14:55 +01:00
..
ast.go Update go to 1.19, set min version to 1.18 (#11279) 2022-09-07 11:30:48 +02:00
functions.go parser: Allow parsing arbitrary functions 2023-03-22 10:14:55 +01:00
generated_parser.y parser: Allow parsing arbitrary functions 2023-03-22 10:14:55 +01:00
generated_parser.y.go parser: Allow parsing arbitrary functions 2023-03-22 10:14:55 +01:00
lex.go Adds support for prettifying PromQL expression (#10544) 2022-07-07 18:13:36 +05:30
lex_test.go Run gofumpt on all files (#10392) 2022-03-03 17:21:05 +01:00
parse.go parser: Allow parsing arbitrary functions 2023-03-22 10:14:55 +01:00
parse_test.go parser: Allow parsing arbitrary functions 2023-03-22 10:14:55 +01:00
prettier.go Adds support for prettifying PromQL expression (#10544) 2022-07-07 18:13:36 +05:30
prettier_rules.md Adds support for prettifying PromQL expression (#10544) 2022-07-07 18:13:36 +05:30
prettier_test.go Prettifier: Add spaces with non-callable keywords (#11005) 2022-07-15 00:09:56 +02:00
printer.go Prettifier: Add spaces with non-callable keywords (#11005) 2022-07-15 00:09:56 +02:00
printer_test.go Prettifier: Add spaces with non-callable keywords (#11005) 2022-07-15 00:09:56 +02:00
value.go promql: use explicit type declare instead of string. (#7716) 2020-08-02 09:57:38 +01:00