promql-query-authoring
PromQL Query Authoring
Purpose
PromQL is deceptively easy to write something syntactically valid that
means something different from what you intended: forgetting by()
collapses a per-service dashboard into one flat line, rate() over too
short a window returns gaps instead of a rate, and vector matching
between metrics with different label sets fails silently (empty result)
rather than erroring. This skill covers writing PromQL that means what
you think it means for the query patterns that come up constantly —
request rate, error ratio, latency percentiles, saturation — and the
specific mechanics (counter rate(), aggregation by/without, vector
matching) that most PromQL mistakes trace back to. It assumes Prometheus
is already scraping the target and alerting/dashboards exist to attach
queries to — see
prometheus-and-grafana-monitoring-stack
for scrape configuration, recording/alerting rule wiring, and
Alertmanager routing, which this skill does not repeat.