Dev tools
Prometheus vs Grafana: How They Work Together
Prometheus vs Grafana: Prometheus collects and stores metrics and fires alerts, Grafana turns them into dashboards. How they differ and work as a pair.
Prometheus vs Grafana isn't really a contest: Prometheus collects and stores metrics and decides when to alert, and Grafana visualises data from Prometheus and many other sources. Prometheus is a monitoring system with a built-in time series database. Grafana is a dashboard and visualisation tool that stores almost no data of its own. Most teams run them together. Prometheus is the data source, and Grafana is the screen people look at.
The confusion is understandable, because they overlap at the edges. Prometheus has a basic graph view, Grafana has its own alerting, and Grafana Labs now sells a whole stack that can replace parts of Prometheus. This guide explains what each does, the Prometheus and Grafana difference in a table, how they work together with a minimal configuration, what each costs, and when to use alternatives.
Prometheus vs Grafana at a Glance
| Prometheus | Grafana | |
|---|---|---|
| What it is | Metrics collection, storage, query and alerting system | Visualisation, dashboard and alerting front end |
| Stores data? | Yes, in its own time series database | No (it queries other systems) |
| Collects data? | Yes, it pulls (scrapes) metrics from targets | No; it reads from data sources |
| Data types | Metrics only | Metrics, logs, traces, profiles and SQL data, via data sources |
| Query language | PromQL | Uses each source's language (PromQL, LogQL, SQL and others) |
| Alerting | Alert rules plus a separate Alertmanager | Grafana Alerting, across any data source |
| Dashboards | Basic expression browser and graphs | Rich, shareable dashboards and panels |
| Licence | Apache 2.0 | AGPLv3 (open source); paid Enterprise and Cloud editions |
| Governance | Cloud Native Computing Foundation (graduated project) | Grafana Labs |
| Default port | 9090 | 3000 |
The one-line summary: Prometheus is the engine and the database; Grafana is the dashboard.
What Is Prometheus?
Prometheus is an open-source monitoring and alerting system that collects numeric measurements (metrics) over time, stores them and lets you query them. It started at SoundCloud in 2012 and joined the Cloud Native Computing Foundation, where it became the second graduated project after Kubernetes.
Its main parts:
- Scraping. Prometheus pulls metrics over HTTP from a
/metricsendpoint on each target at a fixed interval. Applications expose metrics with client libraries, and exporters do it for systems you don't control, such as node_exporter for Linux hosts or exporters for databases. The global scrape interval defaults to one minute, and many teams set 15 or 30 seconds. - Time series database. Each metric plus its set of labels (for example
http_requests_total{method="GET", status="500"}) is a time series stored on local disk. Retention defaults to 15 days unless you set--storage.tsdb.retention.timeor a size limit. - PromQL. A query language for selecting and aggregating series, computing rates and percentiles, and joining metrics.
- Alerting rules. Prometheus evaluates rules on a schedule and sends firing alerts to Alertmanager, a separate component that groups, silences and routes them to email, Slack, PagerDuty and other receivers.
- Service discovery. Prometheus can find targets automatically in Kubernetes, cloud providers and other systems, which suits environments where containers come and go.
Prometheus 3 brought a new web UI and UTF-8 metric names, and current versions include an OTLP receiver. With the --web.enable-otlp-receiver flag, Prometheus can accept OpenTelemetry metrics that are pushed to it instead of scraped.
One design choice matters a lot. Prometheus's local storage is not clustered or replicated. The documentation describes it as limited to a single node's scalability and durability. For long-term storage, high availability or a global view across many clusters, teams add a system such as Thanos, Grafana Mimir, Cortex or VictoriaMetrics through remote write. Our explainer on the time series database covers how this kind of storage works.
What Is Grafana?
Grafana is an open-source tool for building dashboards and alerts on top of data stored elsewhere. You connect data sources, write queries in each source's language and arrange the results as panels: time series graphs, gauges, tables, heatmaps, logs and traces.
Grafana's core data sources include Prometheus, Graphite, InfluxDB and the major cloud monitoring services for metrics. They also include Loki and Elasticsearch for logs, Tempo, Jaeger and Zipkin for traces, Pyroscope for profiles, and MySQL, PostgreSQL and SQL Server for SQL data. Plugins add many more. That breadth is Grafana's main strength. One dashboard can show Prometheus metrics, matching log lines and a trace for the same request.
Other features:
- Variables and templating: one dashboard can switch between environments, clusters or services from a drop-down.
- Grafana Alerting: alert rules on any data source, with contact points and notification policies.
- Sharing and access control: folders, teams, permissions and public or embedded dashboards.
- Provisioning: data sources and dashboards defined as files, so they can live in Git.
Grafana Labs also builds a broader open-source stack often called LGTM: Loki for logs, Grafana for visualisation, Tempo for traces and Mimir for scalable Prometheus-compatible metrics. It also makes Alloy, a telemetry collector that can scrape Prometheus metrics and handle OpenTelemetry data. Alloy replaced the older Grafana Agent, which reached end of life on November 1, 2025.
The Prometheus and Grafana Difference
The most important Prometheus and Grafana difference is where the data lives. Prometheus owns the data: it collects, stores and evaluates it. Grafana borrows data: every panel is a live query to a source such as Prometheus.
That leads to a split of responsibilities:
| Job | Usually done by | Why |
|---|---|---|
| Discover and scrape targets | Prometheus (or Alloy, OpenTelemetry Collector) | Built for pull-based collection |
| Store recent metrics | Prometheus | Its local database is fast for recent data |
| Store long-term or global metrics | Mimir, Thanos, VictoriaMetrics, cloud services | Prometheus local storage is single-node |
| Compute aggregations | PromQL in Prometheus | Recording rules pre-compute heavy queries |
| Alert on metrics | Prometheus rules and Alertmanager, or Grafana Alerting | Both work; pick one main path |
| Show dashboards | Grafana | Prometheus's own UI is for ad hoc queries |
| Combine metrics, logs and traces | Grafana | Many data sources in one view |
How Prometheus and Grafana Work Together
Here is how Prometheus and Grafana work together in a typical setup:
- Your applications and exporters expose metrics on HTTP endpoints.
- Prometheus scrapes those endpoints every 15 to 60 seconds and stores the samples.
- Prometheus evaluates recording rules (saved queries) and alert rules. Firing alerts go to Alertmanager, which notifies people.
- Grafana has Prometheus configured as a data source. When someone opens a dashboard, each panel sends a PromQL query to Prometheus and draws the result.
A minimal Prometheus configuration that scrapes itself and a Linux host:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["node-exporter:9100"]A Grafana data source file, placed in Grafana's provisioning/datasources folder, connects Grafana to it:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: trueTwo PromQL queries you might put on a dashboard. The first is the per-second rate of HTTP requests over five minutes, grouped by status code. The second is the 95th percentile request duration from a histogram.
sum by (status) (rate(http_requests_total[5m]))
histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket[5m])))In Kubernetes, most teams install the pair together through the community kube-prometheus-stack Helm chart. It deploys Prometheus, Alertmanager, Grafana, exporters and a set of ready-made dashboards and alerts. For how containers and orchestration fit in, see Docker vs Kubernetes.
What Is Prometheus and Grafana Used For?
What is Prometheus and Grafana used for in practice? The pair covers most metric-based monitoring:
- Infrastructure monitoring: CPU, memory, disk and network for servers, virtual machines and containers.
- Kubernetes monitoring: pod restarts, resource requests vs usage, node pressure and cluster capacity.
- Application metrics: request rates, error rates and latency per endpoint (the RED method), queue depths and job durations.
- Service level objectives: tracking availability and latency against targets, and alerting on how fast the error budget is being used up. Our guide to site reliability engineering explains the practice.
- Business dashboards: sign-ups, orders and payments, as long as they can be counted as metrics.
- Home labs and IoT: temperature sensors, home servers and network gear through exporters.
What they don't cover on their own: Prometheus doesn't store logs or traces, and Grafana doesn't store anything. For logs and traces you add Loki and Tempo, or another back end, and view them in Grafana.
Alerting: Prometheus or Grafana?
Both can alert, which raises a real choice.
Prometheus rules with Alertmanager keep alerting next to the data. Rules live in files in version control, run inside Prometheus and keep working even if Grafana is down. Alertmanager is strong at grouping and deduplicating alerts and silencing them during maintenance.
Grafana Alerting can alert on any data source, including logs, SQL and cloud metrics, and has a UI that is friendlier for teams who don't want to edit YAML. It depends on Grafana being up and able to reach its data sources.
A common pattern is to put critical infrastructure and SLO alerts in Prometheus and Alertmanager, and to use Grafana Alerting for data that doesn't live in Prometheus. Whichever you choose, avoid defining the same alert in both, or people will be paged twice.
Is Prometheus and Grafana Free?
Yes, both are free and open source to run yourself. Prometheus uses the Apache 2.0 licence and Grafana uses AGPLv3. AGPL lets you use and modify Grafana freely, including at work; its extra obligations apply mainly if you modify Grafana and offer it to others over a network.
The real costs are elsewhere:
- Compute and storage for Prometheus, which grow with the number of active time series. High-cardinality labels such as user IDs can multiply this quickly.
- Long-term storage if you keep months or years of data.
- People time to run upgrades, scale storage and keep dashboards and alerts useful.
Paid options exist if you'd rather not run it yourself. Grafana Labs offers Grafana Cloud (with a free tier) and Grafana Enterprise. The major cloud providers offer managed Prometheus and managed Grafana services. Check current pricing pages, since limits and prices change.
Alternatives and Related Tools
| Tool | What it replaces or adds | Notes |
|---|---|---|
| Grafana Mimir, Thanos, Cortex | Long-term, scalable Prometheus storage | Keep PromQL; add durability and global queries |
| VictoriaMetrics | Prometheus-compatible storage and scraping | Known for efficient storage |
| Kibana | Grafana, for Elasticsearch data | Strongest for logs and search in the Elastic stack |
| OpenTelemetry Collector, Grafana Alloy | Collection layer | Collect metrics, logs and traces and send them to any back end |
| Datadog, New Relic, Dynatrace | Both, as a hosted platform | Less to run, usage-based pricing |
| Zabbix, Nagios | Traditional host and network monitoring | Agent and check based, less cloud native |
If you are comparing Grafana vs Kibana, the short version is that Kibana is tied to Elasticsearch and excels at log search. Grafana is source-neutral and excels at metrics dashboards that combine many sources.
Prometheus vs Grafana: Which Should You Use?
- You need metrics collection and alerting: start with Prometheus (or a Prometheus-compatible collector).
- You need dashboards people will actually look at: add Grafana. Prometheus's built-in UI is for exploring queries, not for team dashboards.
- You have data in many systems: Grafana is the common layer, whether or not Prometheus is one of the sources.
- You run many clusters or need a year of data: keep Prometheus or Alloy for collection, and add Mimir, Thanos or VictoriaMetrics for storage.
- You don't want to run any of it: use a managed Prometheus and Grafana service, or a hosted observability platform.
For most teams the answer to Prometheus vs Grafana is "both": Prometheus to collect and alert, Grafana to see.
Common Mistakes
- Expecting Prometheus to keep data forever. The default retention is 15 days. Plan retention and long-term storage up front.
- High-cardinality labels. Putting user IDs, request IDs or full URLs in labels creates millions of series and can exhaust memory.
- Dashboards built on raw heavy queries. Large dashboards that run expensive PromQL on every refresh slow Prometheus down. Use recording rules for queries you run often.
- Alerting on everything. Page on symptoms users feel (errors, latency, saturation), and send the rest to tickets or dashboards.
- Running one Prometheus with no backup. A single node is a single point of failure for your alerts. Run two identical Prometheus servers for important alerting, or use a managed service.
FAQ
Can Grafana work without Prometheus?
Yes. Grafana works with dozens of data sources, including cloud monitoring services, SQL databases, Elasticsearch, InfluxDB and Loki. Prometheus is just the most common pairing.
Can Prometheus work without Grafana?
Yes. Prometheus has its own web UI for running queries and graphing results, and it alerts through Alertmanager without Grafana. Most teams still add Grafana for better dashboards.
Is Prometheus a database?
Partly. Prometheus includes a time series database, but it is a complete monitoring system that also collects metrics, evaluates rules and sends alerts. Its local storage is designed for recent data on one node.
What ports do Prometheus and Grafana use?
By default Prometheus listens on port 9090, Grafana on port 3000, Alertmanager on 9093 and node_exporter on 9100. All can be changed in configuration.
Does Prometheus support OpenTelemetry?
Yes. Recent versions can receive OpenTelemetry metrics over OTLP when started with the --web.enable-otlp-receiver flag, in addition to scraping. Collectors such as the OpenTelemetry Collector and Grafana Alloy can also send OpenTelemetry metrics to Prometheus.