{"repo":"djluck/PromQL.Parser","free":true,"listed":false,"github":"https://github.com/djluck/PromQL.Parser","clone":"git clone https://github.com/djluck/PromQL.Parser.git","description":"An parser for promql (Prometheus Query Language), written in C#","language":"C#","stars":28,"topics":["prometheus","promql","parsing"],"license":"MIT","category":"analytics","readme_excerpt":"PromQL.Parser A parser for the Prometheus Query Language (PromQL), written in C# and using the Superpower parsing library. Installation Requires .NET core 3.1+ Install from Nuget: User guide Parsing and validating PromQL Parser.ParseExpression will parse a provided expression into an Abstract Syntax Tree representation: Returns: Invalid expressions will throw an exception, e.g: Throws: Type checking The syntax of expressions is not only validated but the resulting types of expressions can be validated and returned with CheckType , e.g: Returns: Expressions that violate the PromQL type system will throw an exception, e.g: Throws: Modifying PromQL expressions The Abstract Syntax Tree is represented using record types. This means making modified copies of the AST is trivial: newExpr equals: Deep cloning of Expr is also supported via Expr.DeepClone() . Additionally all Expr AST types are mutable and can also be updated in place using a visitor such as DepthFirstExpressionVisitor . Emitting PromQL expressions An Abstract Syntax Tree can be converted back to its PromQL string representation, e.g: Produces: Creating PromQL expressions You can directly manipulate the AST classes to build up PromQL expressions. However, there is currently very little in the way of checks that prevent you from either creating syntactically or semantically invalid expressions- use with care. Parsing extensions to PromQL This parser is reasonably extensible and can be modified to recognize extensions to ","default_branch":null,"files":null,"tree":[],"storefront":"/r/djluck","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/djluck/PromQL.Parser/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}