Recommended Open source
Use Prometheus for metrics
Store and query numeric metrics with Prometheus, and alert on them with its rules and Alertmanager.
Cost
Open source. Apache-2.0 licence, free to run on your own servers. Managed hosting from several vendors is paid.
How to do it
Prometheus reached 1.0 in July 2016 and is under Apache-2.0. Version 3.13 is a long-term support release, supported until 31 July 2027, and 3.13.4 came out on 2 October 2026. Its image prom/prometheus has about 2 billion pulls on Docker Hub. The client prometheus-client has about 37 million weekly PyPI downloads, and prom-client about 5.7 million on npm. Its text format and PromQL are known to every AI tool. Which metrics to record is in Measure rate, errors and duration. Choose something else when you keep metrics for more than a year across many servers, and add long-term storage such as Grafana Mimir.
Examples
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
YAML example
# prometheus.yml
scrape_configs:
- job_name: orders-api
scrape_interval: 15s
static_configs:
- targets: ['orders.internal.example.com:9464']
Python example
from prometheus_client import Counter, start_http_server
ORDERS = Counter("orders_total", "Orders placed", ["status"])
start_http_server(9464)
ORDERS.labels(status="paid").inc()
How to check
Every service has a /metrics endpoint or pushes OTLP metrics. The Prometheus targets page shows 0 targets down, and promtool check rules passes in the build.
Sources
Related rules
- Measure rate, errors and duration in Operations
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/operations-tools/prometheus. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.