liveBook · Manning

PromQL

As explained in Learn Docker in a Month of Lunches, Second Edition

PromQL is Prometheus's query language for selecting, filtering, aggregating, and calculating time-series data.

When several containers serve one app, each can report its own metrics. PromQL is Prometheus’s query language for turning those time series into useful answers: select a metric, filter by labels, and aggregate values across containers. section 9.3

Count requests across containers

Run `sum(access_log_total) without(hostname, instance)` in the Prometheus UI. The sum combines request counts, while `without` removes the labels that distinguish individual containers. Add a graph to see how the total changes over time as you send requests. section 9.3

sum(image_gallery_requests_total{code="500"}) without(instance)

This dashboard query first selects requests with response code 500, then sums them without separating results by instance. It provides a focused view of HTTP errors across the app. section 9.4

Use the Prometheus UI to check scrape targets and work out queries, then put those queries into Grafana panels. Filtering and aggregation are enough for useful dashboards; functions for rates, changes over time, and subqueries can wait. section 9.3 section 9.4

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Works through label filtering and aggregation, while deferring rates, changes over time, and subqueries.
Examples
Uses summed request counts across containers and a query filtering HTTP 500 responses.
What it assumes
Assumes applications expose metrics for Prometheus to scrape, but starts query work with simple labels and sums.
What you can do after
Apply it via the Prometheus UI and Grafana to graph combined metrics and display HTTP errors.
How it connects
Connects time-series metrics, labels, Prometheus scraping, and Grafana dashboards.

Also explained in

Compare how 4 books explain PromQL →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.