liveBook · Manning

Prometheus

As explained in Machine Learning Platform Engineering

Prometheus is an open-source monitoring system that collects, stores, and queries time-series metrics.

Prometheus provides production visibility by collecting application metrics, indexing them as time series, querying them, and supporting alert evaluation. Applications expose a metrics endpoint, and Prometheus workers pull and store the results. Grafana visualizes the data, while Alertmanager routes triggered alerts to operational channels. section 3.5 section 11.1.4

A practical Prometheus deployment connects these pieces:

  • Expose /metrics or a similar endpoint from each monitored application, using language-specific instrumentation packages. section 3.5
  • Configure scraping so Prometheus discovers targets and pulls their metrics into its time-series database. section 3.5
  • Use the Prometheus UI to verify scraping and query values; use Grafana for durable dashboards and charts. section 3.5
  • Define PromQL alert expressions such as up == 0 or absent(up) == 1, add a duration and severity, then route notifications through Alertmanager. section 11.1.4

Instrumenting a FastAPI service

Add PrometheusMiddleware and expose handle_metrics at /metrics. Prometheus can then scrape the service, while request counters can be queried and visualized in Grafana. A query such as sum by (response_code) (increase(starlette_requests_total[10m])) summarizes recent requests by response code.

How Machine Learning Platform Engineering covers it

How deep it goes
Explains components, endpoint instrumentation, scraping, queries, dashboards, alert rules, and routing, with Kubernetes installation examples.
Examples
Uses FastAPI middleware, /metrics, request counters, PromQL response-code queries, Helm installation, and BentoML uptime alerts.
What it assumes
Assumes an application that can expose metrics and basic familiarity with deployed services, while demonstrating endpoint setup and alert configuration.
What you can do after
Operate/configure metric scraping, visualization, PromQL checks, uptime rules, and Alertmanager email routing.
How it connects
Connects metrics endpoints with Grafana, Alertmanager, PromQL, Kubernetes, Helm, BentoML, and HTTP services.

Also explained in

Compare how 8 books explain Prometheus →

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.