---
title: "Use Prometheus for metrics · Agent Wranglers"
url: https://agentwranglers.se/playbook/stack/operations-tools/prometheus
updated: 2026-10-21
licence: "All rights reserved"
---

# Use Prometheus for metrics

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- Level: Recommended
- Chapter: [Operations tools](https://agentwranglers.se/playbook/stack/operations-tools)
- Rule: 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: 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. The npm client `prom-client` has about 5.7 million weekly downloads, but its last release was in June 2024. In JavaScript, export metrics through OpenTelemetry instead. Its text format and PromQL are known to every AI tool. Which metrics to record is in [Measure rate, errors and duration](https://agentwranglers.se/playbook/operations/metrics-and-traces/red-metrics). Write the alert rules as [Alert on symptoms](https://agentwranglers.se/playbook/operations/alerts-and-on-call/alert-on-symptoms) says. Choose something else when you keep metrics for more than a year across many servers, and add long-term storage such as Grafana Mimir.
- 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.

## 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

```yaml
# prometheus.yml
scrape_configs:
  - job_name: orders-api
    scrape_interval: 15s
    static_configs:
      - targets: ['orders.internal.example.com:9464']
```

### Python example

```python
from prometheus_client import Counter, start_http_server

ORDERS = Counter("orders_total", "Orders placed", ["status"])

start_http_server(9464)
ORDERS.labels(status="paid").inc()
```

## Sources

- [Prometheus release cycle](https://prometheus.io/docs/introduction/release-cycle/)
- [Prometheus overview](https://prometheus.io/docs/introduction/overview/)

## Related rules

- [Measure rate, errors and duration](https://agentwranglers.se/playbook/operations/metrics-and-traces/red-metrics) in Operations
- [Alert on symptoms](https://agentwranglers.se/playbook/operations/alerts-and-on-call/alert-on-symptoms) in Operations

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/stack/operations-tools/prometheus">Agent Wranglers software choices playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Use OpenTelemetry to instrument your code](https://agentwranglers.se/playbook/stack/operations-tools/opentelemetry)
- Next: [Use Grafana for dashboards](https://agentwranglers.se/playbook/stack/operations-tools/grafana)
- [Operations tools](https://agentwranglers.se/playbook/stack/operations-tools)
