promql: option to preserve comments in parser
#15.871 aperta il 28 gen 2025
Metriche repository
- Star
- (64.042 stelle)
- Metriche merge PR
- (Merge medio 11g 5h) (118 PR mergiate in 30 g)
Descrizione
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.