Observability

Write PromQL without remembering PromQL.

PromQL is not difficult, it is just impossible to remember the exact shape of a rate over a histogram at the moment you need it.

Download for macOS
v0.1.33 · .dmg · Apple Silicon & Intel
Signed & notarized by Apple · opens without a Gatekeeper warning
sha256 698955a0187bc039f4c74f5d05a9f10fbb27376a45788a0a241d1326b73873c7
Download for Windows instead
$curl -fsSL https://lucidtrain.com/install.sh | sh

The specific problem

Most PromQL is one of about six patterns: a rate over a counter, a quantile from a histogram, an aggregation with a label selector, a comparison against a threshold. Everyone knows what they want and almost nobody remembers whether rate goes inside or outside the sum, which is the kind of thing you look up every single time.

It knows your metric names

A general model writes plausible PromQL against metrics that do not exist. With the repository open the agent can see the instrumentation and use the metric and label names you actually emit, which is the difference between a query you run and a query you correct first.

Then look at the code

Once a query shows something interesting, the same session can open the code that emits the metric. Whether an increase means more traffic or a slower path is not answerable from the metric alone, and answering it usually means reading the instrumentation.

Patterns worth having generated

What you wantThe shape
Request raterate over a counter, summed by label
Error ratiorate of errors divided by rate of total
p99 latencyhistogram_quantile over a rate of buckets
Saturationcurrent value against a limit
Change over timeincrease over a window
Alert conditiona comparison with a for duration
Error budget burnratio over a window against an SLO target

Ask for it

shell
# p99 latency by endpoint for the api service over 24 hours,
# and the error ratio next to it.
FAQ

Questions

Does it know my metric names?

It can read them from your instrumentation code, and from Prometheus itself when connected. That is what stops it inventing plausible names.

Does it write LogQL too?

Yes. The Loki path matters more in practice, since LogQL's parser expressions are harder to remember than PromQL's aggregations.

Can it write alert rules?

It drafts them, including the for duration, which is the part most often left out and most often the reason an alert is noisy.

Related