Prometheus is an open-source monitoring system and time series database that collects numeric metrics by periodically scraping HTTP endpoints, stores them locally and lets operators query and alert on them with its own language, PromQL. In cloud observability, it is the de facto standard for metrics in Kubernetes and cloud-native platforms, and it is a graduated project of the Cloud Native Computing Foundation.
Prometheus focuses on metrics, not logs or traces. It answers questions such as how many requests failed in the last five minutes or how close a disk is to full, and it is usually paired with Grafana for dashboards and with separate tools for log and trace data.
How Prometheus collects and stores metrics
Prometheus uses a pull model: the server contacts each target at a fixed scrape interval, typically 15 to 60 seconds, and reads a plain-text page usually exposed at the /metrics path. Applications expose this page through client libraries, while existing software such as databases or operating systems is covered by small adapters called exporters.
Targets are found through service discovery integrations for Kubernetes, cloud provider APIs, Consul, DNS or static files, so new pods and instances are monitored automatically. Each scraped value becomes a sample in a time series identified by a metric name and a set of labels, for example http_requests_total{method="GET",status="500"}.
Samples are written to a local time series database (TSDB) that keeps recent data in memory, protects it with a write-ahead log and compacts it into two-hour blocks on disk. Compression is efficient, often one to two bytes per sample, but storage is designed for a single node with limited retention, commonly 15 days to a few weeks.
The main building blocks of a Prometheus deployment are summarized below.
| Component | Role | Notes |
|---|---|---|
| Prometheus server | Scrapes targets, stores data, evaluates rules | Single binary, stateful |
| Exporters | Translate third-party metrics into Prometheus format | Node, database and blackbox exporters are common |
| Client libraries | Instrument application code | Available for Go, Java, Python and others |
| Alertmanager | Groups, deduplicates and routes alerts | Sends to email, chat or paging tools |
| Pushgateway | Holds metrics from short-lived batch jobs | Not a general replacement for scraping |
Metric types and the PromQL query language
Prometheus defines four core metric types, and choosing the right one determines which questions can be answered later. Counters and histograms are the most useful for service health, because they allow rates and latency percentiles to be computed at query time.
| Type | Behavior | Typical use |
|---|---|---|
| Counter | Only increases, resets on restart | Requests served, errors, bytes sent |
| Gauge | Goes up and down | Memory in use, queue length, temperature |
| Histogram | Counts observations in configurable buckets | Request latency, response size |
| Summary | Computes quantiles in the client | Latency where aggregation is not needed |
PromQL is a functional query language that operates on vectors of time series. A query such as rate(http_requests_total[5m]) turns a raw counter into a per-second rate, while histogram_quantile(0.99, ...) estimates the 99th percentile latency from histogram buckets. Aggregation operators like sum by (service) let operators move from per-instance data to service-level views.
Recording rules precompute expensive queries at regular intervals and store the results as new series, which keeps dashboards fast. Alerting rules are PromQL expressions with a duration condition; when an expression stays true for the specified period, Prometheus sends the alert to Alertmanager.
Prometheus compared with other observability tools
Prometheus occupies a specific niche within observability: reliable, self-hosted metrics with a strong query language. The comparison below shows how it relates to neighboring tools that are often deployed alongside it.
| Tool | Primary focus | Relationship to Prometheus |
|---|---|---|
| Grafana | Visualization and dashboards | Queries Prometheus as a data source |
| OpenTelemetry | Vendor-neutral instrumentation and transport | Can export metrics to Prometheus or receive them |
| Thanos and Cortex | Long-term, horizontally scaled storage | Extend Prometheus beyond one node |
| Commercial APM platforms | Hosted metrics, traces and logs | Often ingest Prometheus-format metrics |
| Log systems | Event records with full context | Complement metrics; not replaced by them |
The Prometheus exposition format has become a widely supported interchange standard, formalized as OpenMetrics. As a result, many applications and managed cloud services expose Prometheus-compatible endpoints even when the organization stores the data elsewhere.
Running Prometheus at scale
A single Prometheus server can handle millions of active series on adequate hardware, but each instance is independent and stores only its own data. High availability is usually achieved by running two identical servers that scrape the same targets, with Alertmanager deduplicating their alerts.
Larger organizations use federation, where a global server scrapes aggregated series from lower-level servers, or remote write, which streams samples to a scalable backend such as Thanos, Cortex, Mimir or a managed cloud service. These designs add global querying and long-term retention that the core server deliberately does not provide.
The following decision table summarizes common deployment choices.
| Situation | Recommended pattern | Reason |
|---|---|---|
| One small cluster, short retention | Single server with local storage | Simplest to operate |
| Alerting must survive node failure | Two replicas plus Alertmanager cluster | Removes the single point of failure |
| Many clusters, one global view | Remote write to a central backend | Unified queries across regions |
| Retention of a year or more | Object storage via Thanos or similar | Local disks are costly and fragile |
Limitations and common mistakes
The most serious operational risk is high metric cardinality. Every unique combination of label values creates a new series, so labels holding user IDs, request IDs or full URLs can multiply memory use and crash the server under its own index.
- Unbounded label values such as email addresses or session tokens.
- Using rate on gauges or averaging percentiles, which yields mathematically wrong results.
- Alerting on causes instead of symptoms, which contributes to alert fatigue.
- Expecting exact accounting: Prometheus favors availability and approximate data over billing-grade precision.
- Relying on Pushgateway for services, which hides target failures and leaves stale values behind.
Prometheus is also not a log or tracing store. It is best used to measure golden signals and service level indicators, then guide engineers toward logs and traces for detailed diagnosis.
Put simply
Prometheus is like a nurse making regular rounds. Every few seconds it visits each machine and application. It reads vital signs, such as how busy each one is. Then it writes them in a chart.
The chart keeps numbers over time. Engineers can spot trends in it. They also get an alarm when something drifts out of a healthy range, often before customers notice.
In practice
A software company runs about 40 microservices on Kubernetes. Each service exposes a /metrics page through a client library, and two Prometheus replicas discover the pods automatically and scrape them every 30 seconds. Grafana dashboards show request rate, error ratio and 99th percentile latency for each service.
One evening an alerting rule fires because the checkout service error ratio has stayed above 2 percent for 10 minutes, consuming its monthly error budget quickly. The on-call engineer sees in PromQL that errors come only from pods on one node, drains that node and watches the error ratio fall back to normal. Recovery takes about 20 minutes, and the team later adds a recording rule for per-node error ratios.