How Prometheus Monitoring Works: Scrape Config, PromQL and Alert Rules

Prometheus collects metrics from servers, applications and containers by scraping them. It is the de facto standard for monitoring cloud-native environments and integrates natively with Kubernetes. This page shows four things that were tested rather than described: the scrape file, three PromQL queries, an alert rule and the version criteria.
Every block shows real output: everything ran in a lab with Prometheus 3.13.2, the LTS line, on August 28, 2026. On that date the project repository had 65,867 stars. Major release 3 shipped in November 2024 and the current line is already 3.14.
What Is Prometheus?
Prometheus is an open source monitoring and alerting system created at SoundCloud in 2012 and donated to the CNCF (Cloud Native Computing Foundation) in 2016. It collects metrics through pull (scraping), stores them in a time series database (TSDB) and exposes a query language called PromQL for analysis and alerting.
Unlike push-based tools (such as StatsD and InfluxDB with Telegraf), Prometheus actively fetches metrics from the endpoints that applications and exporters expose. This simplifies service discovery and keeps control of collection on the server.
Prometheus integrates natively with the observability ecosystem: metrics (Prometheus), logs (Loki) and traces (OpenTelemetry or Jaeger) form the complete triad when combined with Grafana.
Prometheus Architecture
Prometheus architecture is deliberately simple and made of modular components.
Prometheus Server
The core of the system. It scrapes targets, stores metrics in the local TSDB and serves the HTTP API for PromQL queries. In high availability setups, multiple Prometheus servers run in parallel with the same configuration. There is no native replication: Thanos or Cortex cover that as a distributed long-term storage layer.
Exporters
Exporters are agents that expose metrics from systems with no native Prometheus support. Each exporter answers a different question about the environment, so coverage drives the choice.
| Exporter | What it collects | When to use it |
|---|---|---|
node_exporter |
CPU, memory, disk, network and host load | On every server in the fleet: it is the infrastructure baseline |
blackbox_exporter |
HTTP, HTTPS, TCP, ICMP and DNS probes from the outside | When the question is whether the service answers outside callers, beyond whether the process is alive |
mysqld_exporterpostgres_exporter |
Active connections, locks, replication lag, cache hit ratio and slow queries | Databases where saturation hits the connection pool before the CPU |
cAdvisor |
CPU, memory and I/O per container | Hosts running Docker or Kubernetes, where host metrics cannot show who consumed what |
| Client library | Queue depth, per-route latency, error rate and business metrics | When the metric that matters does not exist outside the application code |
In this page's lab, node_exporter alone published 776 series from a single host. Across a fleet of 100 servers that comes to roughly 77,000 series for infrastructure only, before any application metric. That is why TSDB capacity planning starts with the host exporter and the instrumented code comes second.
For your own applications, client libraries are available in Go, Java, Python and other languages.
Pushgateway
A component that lets batch or short-lived jobs push metrics before they exit. The Pushgateway acts as an intermediary: jobs push their metrics and Prometheus scrapes the Pushgateway as usual.
Alertmanager
The Alertmanager receives alerts fired by Prometheus and handles routing, deduplication, grouping and silencing. It sends notifications to Slack, PagerDuty, OpsGenie, email and other configurable channels. Separating alert generation (Prometheus) from notification (Alertmanager) puts the decision of who gets woken up in one place. You can manage alert fatigue without touching a single rule.
Prometheus 3: What Changed and Which Version to Run in Production
The Prometheus 3 line brought changes that matter for production environments. Two of them are often misunderstood when planning the upgrade.
Native histograms represent the distribution without fixed buckets. This reduces the number of series per histogram and improves percentile accuracy. They are not automatic, though. The official specification marks the feature as stable only from v3.8.0. Even there, collection stays off until the scrape config includes scrape_native_histograms: true.
Upgrading to the 3 line without touching that field therefore changes nothing. The server keeps storing the classic histogram, with the same buckets and the same series count as before.
OpenTelemetry compatibility got deeper. Prometheus 3.x accepts metrics in OTLP format through the OTLP receiver, which consolidates it as a metrics backend for OpenTelemetry pipelines.
To decide which version to run, read the project's support policy. A new minor release ships every six weeks and stops receiving fixes when the next one arrives. LTS versions, on the other hand, receive bug and security fixes for one year.
Version 3.5 ended support on July 31, 2026 and 3.13, released on July 1, 2026, is supported until July 31, 2027. Anyone running 3.5 in production today is outside the fix window.
PromQL: The Prometheus Query Language
PromQL (Prometheus Query Language) is the language used to query and aggregate collected metrics. It works on time series and supports math functions, aggregations and label selection.
The Three Questions to Answer First
Three questions cover most day-to-day diagnosis. Is the target up? How much work is it receiving? How is latency distributed? Below are the queries that answer each one, run against the lab, with the output the server returned.
The third question is the one that changes decisions. The median for the orders service was 47 ms while p99 was 718 ms, fifteen times higher. A latency average would hide this behavior completely. That is why latency alert thresholds should be defined on percentiles and never on averages.
Labels and Selectors
Labels are the dimension that gives the data model its granularity. Each metric can have multiple labels (job, instance, environment, region) that enable fine-grained filtering and aggregation. The cost shows up in the multiplication: every distinct value of every label creates a new series. A label holding a user ID or the full request URL leads to a cardinality explosion within a few hours.
Prometheus Configuration and Scrape Config
Prometheus is configured through a YAML file (prometheus.yml). The file below is the one running in this page's lab. It has three jobs, one for each kind of target, with the service label set in the scrape config.
Setting the label in static_configs has a practical reason. The same binary can start up as pedidos or as checkout with no recompiling. The person operating collection decides the service name and the code author never has to touch it.
On Kubernetes, Prometheus uses native service discovery to find pods and services automatically through annotations. The kube-prometheus-stack (a community-maintained Helm chart) is the recommended way to install it on K8s. It installs Prometheus, Alertmanager, Grafana and a set of dashboards and alerts preconfigured for Kubernetes.
Prometheus Alerting Rules
Alerts are defined in separate rule files loaded by the Prometheus server. The rule below is the one running in the lab. It compares each service's 5xx error rate against a 1% error budget.
The for: 5m parameter is what separates an alert from noise. In the August 28, 2026 test the condition became true at 05:11:53 UTC. The alert only switched to firing at 05:16:53, exactly five minutes later. In between it sits in pending: it shows up in the console but notifies nobody.
The screen below shows the rule already firing, with the rate measured at the moment of the trigger.

The curve that produced this alert appears in Prometheus's own graph. The checkout service went from 0.4% to 12.5% errors while the orders service stayed below 0.5% throughout the episode.

Fired alerts go to Alertmanager, which decides routing and suppression according to the configured rules. This structure is the foundation for reducing alert fatigue in large-scale operations.
Prometheus and the SRE Four Golden Signals
Prometheus is the reference tool for implementing the SRE four golden signals (latency, traffic, errors and saturation) in cloud-native environments. Each signal maps to a set of metrics and PromQL queries that can be standardized in Grafana dashboards and used as the basis for defining SLOs and calculating error budgets.
For teams that adopt SRE, Prometheus is the measuring instrument that turns SLOs into concrete, actionable data.
Long-Term Storage: Thanos and Cortex
Prometheus stores data locally (15 days by default, configurable). For long retention and high availability, the most widely adopted projects are Thanos and Cortex/Mimir.
Thanos adds an object storage layer (S3, GCS, Azure Blob) on top of an existing Prometheus, with compaction and deduplication. Grafana Mimir (the successor to Cortex) is a fully horizontally scalable solution for environments that need high ingestion and multi-tenancy. Both are recommended for production environments that need more than 30 days of history.
Already running Prometheus? Take it further.
KeepMonitor works with the metrics you already collect, and our team can operate the whole stack for you.
Conclusion
Prometheus is the central pillar of cloud-native monitoring in 2026. Its pull architecture, label model, PromQL and native integration with Kubernetes and OpenTelemetry make it the natural choice for teams that adopt SRE, DevOps and observability as operating practices.
With the 3 line consolidated, native histograms stable since 3.8 and OTLP support, the ecosystem has reached a level that needs no custom workarounds. If you want to implement a monitoring strategy based on Prometheus with Grafana, calibrated alerts and long-term storage, talk to our experts.
Frequently Asked Questions
What is Prometheus and what is it used for?
What is the difference between Prometheus and Grafana?
What is PromQL?
rate()), percentiles (histogram_quantile()), aggregations (sum by()) and comparisons between metrics. It is used in Grafana dashboards and in alert definitions.