Apache-2.0, Worker-compatible semantic query trees for Grafana-facing PromQL, LogQL, and TraceQL. The package preserves original source, exact JavaScript string-index spans, Grafana variables, literals, parser diagnostics, grammar node identity, and stable feature occurrences without depending on a backend.
import {
extractFeatures,
parsePromQLOrThrow,
printCanonical
} from "@axiomhq/grafana-query-ast";
const ast = parsePromQLOrThrow(
"sum by (service_name) (rate(http_requests_total[$__rate_interval]))"
);
console.log(extractFeatures(ast));
console.log(printCanonical(ast));The package never resolves Grafana variables and contains no Axiom, APL, MPL, Cloudflare, or protocol-response policy.
Documentation: