Query assistants are the most mature AI feature in observability — Honeycomb shipped its Query Assistant in May 2023, and Grafana, Datadog, and Elastic all followed within 18 months. Describing what you want in English and getting PromQL/LogQL back genuinely lowers the barrier to interrogating your own systems.
Tier: Foundation · Hands-on time: ~35 minutes
The failure mode is equally mature: a syntactically valid query that measures something subtly different from what you asked — wrong rate window, missing label filter, averaged percentiles — and returns a confident-looking graph. This playbook is the generate-then-interrogate loop that makes NL-to-query safe enough to base decisions on.
rate vs increase, joins on group_left, LogQL aggregations.Skip the assistant for queries you write weekly — and never paste an AI query straight into an alert rule or SLO definition without the full check sequence below (for alerts, see pb-25).
docker compose with Prometheus + node-exporter + Loki + Grafana, or any Grafana Cloud free-tier stack), or your org's existing observability tenant./api/v1/label/__name__/values, Grafana Explore autocomplete) — the model must work against real names, not guessed ones.Give the model your real vocabulary. Paste the relevant metric names, their types (counter/gauge/histogram), and label keys:
Metrics available:
- http_server_request_duration_seconds (histogram; labels: service, route,
status_code, le)
- kafka_consumergroup_lag (gauge; labels: group, topic, partition)
Write a PromQL query for: p95 request latency for service "checkout",
5-minute window, excluding health-check routes. Explain each function
choice in one line, and state what the query does NOT include.
Without this, models hallucinate plausible metric names (http_request_latency_p95) that silently return empty results or, worse, match a different metric that exists.
Read the query before running it. Check the four classic silent errors: (a) rate() window shorter than scrape interval × 4; (b) histogram_quantile applied without sum by (le) or averaged across instances; (c) label filters using = where you meant =~, or missing entirely (querying ALL services); (d) counters used without rate/increase. The model's own one-line explanations make these fast to spot — a wrong explanation flags a wrong query.
Run the sanity triplet. Before trusting output, run three cheap checks:
wc -l on a known window).Interrogate the semantics. Ask the assistant: What question does this query actually answer, precisely? List 3 ways its answer could differ from "<my original English question>". This surfaces the gap between asked and measured — averaging across pods vs. per-pod p95 is the canonical example — while the query is still in front of you.
Save the validated pair. Store English question + final query + the sanity-check evidence in your team's query library (a repo file or Grafana snapshot). The library compounds: it becomes few-shot context for future generations and the review baseline for pb-24 dashboards and pb-25 alerts.
A query that runs is not a query that answers your question. Valid syntax is the model's job; valid semantics is yours, and the sanity triplet is how you check it in under five minutes.
avg(histogram_quantile(...)) over instances is statistically meaningless but renders a beautiful line. The known-answer check against a single instance catches it.tenant="acme-corp"). Under client MSAs, use the client's in-tenant assistant (their Grafana/Datadog seat) or a local model via Ollama — PromQL generation is comfortably within 8B-class capability when metric metadata is supplied.Grafana Cloud's free tier plus a docker-compose Prometheus/Loki gives you the whole lab at zero cost — practice on synthetic load before an incident makes you do it live.