prometheus/prometheus

promql: option to preserve comments in parser

Ouverte

#15 871 ouverte le 28 janv. 2025

 (3 commentaires) (0 réaction) (0 personne assignée)Go (10 408 forks)batch import
component/promqlhelp wantedkind/featurenot-as-easy-as-it-lookspriority/P3

Métriques du dépôt

Stars
 (64 042 étoiles)
Métriques de merge PR
 (Merge moyen 11j 5h) (118 PRs mergées en 30 j)

Description

Proposal

I have a requirement to analyse and modify promql expressions to enforce some business-specific rules. This is being achieved by parsing to the AST, analysing the tree through traversal, and optionally applying modifications to the AST before rendering it back to a string.

Comments are currently stripped in this process by a hard-coded skip in the parser.

We would like this to be an option somewhere so that we can preserve these comments through the parse->AST->string process, as these comments can contain useful debugging/tracing information provided by the original query issuer.

Guide contributeur