capabilities.work

Chart a Range Query and Pull Its Exemplars

A 3-step recipe with Prometheus. We can help you get access.

Recipe · 3 steps

Chart a Range Query and Pull Its Exemplars

Evaluate a PromQL expression over a time range and fetch its exemplars.

  1. Evaluate the expression once at the end of the window. A 400 or 422 here means the expression is malformed and the range query would fail the same way, only after far more work on the server.
  2. Evaluate the expression at every step across the range, producing the matrix of time series a chart renders.
  3. Retrieve exemplars over the same window. Exemplars carry the trace or log IDs attached to individual observations, which is what turns a latency spike on the chart into a specific trace to open.
What you'll need to have ready
  • query: The PromQL expression to chart (e.g. histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))).
  • start: Start of the range as a Unix timestamp or RFC3339 string.
  • end: End of the range as a Unix timestamp or RFC3339 string.
  • step: Resolution step width as a duration string (e.g. 15s, 1m, 1h).
For your developer

Arazzo workflow prometheus:range-query-with-exemplars, 3 operations: queryInstant → queryRange → queryExemplars. Specs on APIs.io.