liveBook · Manning

PromQL

As explained in Machine Learning Platform Engineering

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

PromQL is Prometheus’s query language for retrieving, filtering, aggregating, and transforming time-series metrics. Grafana uses PromQL queries to turn scraped application metrics into operational charts. section 3.5

A production monitoring workflow uses PromQL between scraped metrics and operational decisions:

  • Expose application metrics through an endpoint such as /metrics, allowing Prometheus to scrape and store them. section 3.5
  • Query counters with label filters and time ranges, then aggregate results by a label such as response_code. section 3.5
  • Use PromQL expressions as alert conditions that Prometheus evaluates before Alertmanager routes triggered alerts. section 11.1.4

Aggregate requests over ten minutes

sum by (response_code) (increase(starlette_requests_total{app_name="starlette", method="GET", path="/"}[10m])) groups the increase in a request counter by HTTP response code, producing a time-series view suitable for Grafana.

Detect unavailable services

up{job="yatai/bento-deployment", yatai_ai_bento_deployment_component_type=~"api-server|runner"} == 0 detects targets whose scrape status is down. absent(up{...}) == 1 detects when the metric itself disappears, covering a deployment that was deleted or terminated. Alert rules can hold either condition for five minutes and assign critical severity. section 11.1.4

How Machine Learning Platform Engineering covers it

How deep it goes
Defines metric selection, label filtering, aggregation, range increases, absence checks, and alert expressions without descending into language internals.
Examples
Demonstrates request-count aggregation, FastAPI metrics exposure, service-down detection, missing-metric detection, and email alert routing.
What it assumes
Assumes metrics are exposed for Prometheus scraping and introduces the query workflow through application monitoring examples.
What you can do after
Apply it via Prometheus and Grafana to inspect request metrics, validate scraping, and configure service-availability alerts.
How it connects
Connects PromQL with Prometheus, Grafana, Alertmanager, time-series databases, metrics endpoints, and Helm-managed Kubernetes deployments.

Also explained in

Compare how 4 books explain PromQL →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Platform Engineering. The section links point to the parts of the book it draws on.