Last updated: 29 November 2026
The difference between Grafana and Prometheus comes down to their jobs. Prometheus collects, stores and queries metrics, and evaluates alert rules against them. Grafana queries data held elsewhere and turns it into dashboards, graphs, exploration views and alerts.
They are usually partners rather than rivals. A common setup has Prometheus gathering numbers from your servers and applications, and Grafana asking Prometheus for those numbers and displaying them.
Grafana and Prometheus at a glance
| Area | Prometheus | Grafana |
|---|---|---|
| Primary role | Monitoring system and time series database | Visualization and analytics platform |
| Collects metrics | Yes, mainly by scraping targets over HTTP | Not its job; it queries data sources |
| Stores telemetry | Yes, in a local on-disk database, with remote storage options | Relies on the connected backends |
| Data types | Numeric time series | Metrics, logs, traces and more, depending on the data source |
| Query language | PromQL | Uses each data source’s language, such as PromQL for Prometheus |
| User interface | Basic expression browser for ad hoc queries and debugging | Rich dashboards and exploration |
| Alerting | Rules in Prometheus; notifications through Alertmanager | Grafana Alerting, with rules across multiple data sources |
| Default local port | 9090 | 3000 |
| Open source license | Apache 2.0 | AGPL-3.0-only by default, with some exceptions |
How they work together
Your application or an exporter exposes current metric values. Prometheus fetches and stores them. When someone opens a dashboard, Grafana sends queries to Prometheus and draws the results.

This separation has a practical consequence. If Grafana is down, Prometheus can keep scraping and evaluating its own rules. If Prometheus is down, Grafana can still run, but it cannot get fresh answers from that source, and a single Prometheus server will have a gap for the time it was not scraping.
What Prometheus does
Prometheus is an open source monitoring and alerting toolkit, originally built at SoundCloud and now a Cloud Native Computing Foundation project.
Collection by pulling
Prometheus normally scrapes targets: at a set interval, it requests a metrics endpoint over HTTP. It finds targets through static configuration or service discovery.
Software you write can expose metrics using client libraries. For systems you cannot modify, exporters translate their statistics into a format Prometheus understands. Short-lived jobs that may finish before a scrape can push results to the Pushgateway, which Prometheus then scrapes.
Storage and the data model
Each time series is identified by a metric name plus key/value labels. A request counter might carry labels for the HTTP method and status code, so you can filter or group by either.
Samples go into a built-in time series database. If you set neither a time nor a size limit, retention defaults to 15 days. Local storage is not clustered or replicated. For longer retention or greater durability, Prometheus can send samples to a compatible remote system using remote write.
Querying with PromQL
PromQL selects, calculates and aggregates time series. This illustrative query shows the per-second request rate for each handler of the Prometheus server, averaged over five minutes. It has not been tested here.
sum by (handler) (rate(prometheus_http_requests_total[5m]))
Where Prometheus is a poor fit
Prometheus is designed for numeric time series and reliability monitoring. Its documentation advises against relying on it where you need complete accuracy, such as per-request billing. It is also not a store for log text or full traces.
What Grafana does
Grafana is open source software for querying, visualizing, alerting on and exploring data where it already lives. Prometheus is one supported data source among many.
Dashboards across sources
A dashboard is a collection of panels, typically each backed by a query. One screen can place Prometheus metrics beside information from a log store or a SQL database. This helps during an incident, when you want to compare signals over the same time range.
Grafana keeps its own application data, such as users and dashboard definitions, in a database. That is different from being the store for your monitoring metrics.
The wider Grafana family
Grafana Labs offers separate backends: Mimir for long-term Prometheus metrics, Loki for logs, Tempo for traces and Pyroscope for profiles. These are distinct from Grafana itself. Grafana is also available through the managed Grafana Cloud service and as a commercial Grafana Enterprise edition.
Alerting: the main area of overlap
Both products can tell you when something is wrong, which causes much of the confusion.
Prometheus alerting and Alertmanager
The Prometheus server evaluates alert rules written in PromQL. It sends resulting alerts to Alertmanager, a separate component that groups, silences, inhibits and routes them to channels such as email, chat or on-call systems.
The following untested rule fires when a target has been unreachable for five minutes. Save it in a rules file and list that file under rule_files in your Prometheus configuration. Delivering notifications also requires a configured Alertmanager.
groups:
- name: availability
rules:
- alert: InstanceDown
expr: up == 0
for: 5m
labels:
severity: page
annotations:
summary: "Target {{ $labels.instance }} is down"
Grafana Alerting
Grafana Alerting is built on the Prometheus alerting model. It periodically runs a rule’s queries against data sources and checks a condition. Contact points define destinations, and notification policies route alerts using labels. It also supports grouping, silences and mute timings.
Which should own your alerts?
As a rule of thumb, keep metric alerts in Prometheus if you want them version-controlled beside its configuration and independent of Grafana’s availability. Choose Grafana Alerting if rules must query several kinds of data source, or your team prefers managing them in a web interface. Avoid defining the same alert in both places, which invites duplicate notifications and drifting thresholds.
Do you need both?
- Prometheus alone can work if you need collection and alerting, and occasional graphs in its built-in interface are enough.
- Grafana alone makes sense if your data already sits in a supported database or hosted monitoring service.
- Both together suit teams that need to collect application or infrastructure metrics and share readable dashboards.
- Something in addition is needed for logs and traces, because Prometheus focuses on metrics and Grafana needs a backend to query.
Consider a hypothetical online shop. Its checkout service exposes request counts and latency. Prometheus scrapes and stores them. Grafana shows traffic, errors and response time on one dashboard. An alert rule notifies the on-call engineer when errors stay too high.
Hands-on exercise: connect Grafana to Prometheus
This local exercise assumes Docker is installed, ports 9090 and 3000 are free, and you are using a Unix-style shell. The commands have not been tested here, and the setup is not production-ready.
1. Create the configuration
Save this as prometheus.yml. It tells Prometheus to scrape itself.
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["localhost:9090"]
2. Start both containers
docker network create monitoring
docker run -d --name prometheus --network monitoring \
-p 127.0.0.1:9090:9090 \
-v "$PWD/prometheus.yml:/etc/prometheus/prometheus.yml" \
prom/prometheus
docker run -d --name grafana --network monitoring \
-p 127.0.0.1:3000:3000 \
grafana/grafana
3. Check collection
In your browser, open localhost:9090/query and run up. A value of 1 means the latest scrape of that target succeeded.
4. Add the data source
Open localhost:3000 and sign in with admin as both username and password, then set a new password if prompted. Go to Connections, choose Add new connection, search for Prometheus, select it and add a new data source.
In the Prometheus server URL field, use the HTTP scheme with prometheus as the host name and 9090 as the port. Then save and test.
5. Build a panel
Create a dashboard, add a panel, select your Prometheus data source and enter the request rate query shown earlier. Refresh the Prometheus page a few times and watch the graph after later scrapes.
6. Clean up
docker rm -f prometheus grafana
docker network rm monitoring
This removes the containers and the network. For data you want to keep, mount persistent storage for Prometheus at /prometheus and for Grafana at /var/lib/grafana.
Common mistakes and troubleshooting
- Using localhost between containers. Inside the Grafana container,
localhostmeans Grafana’s own container. Use the Prometheus container name on a shared network. - Empty panels. Run the same query in Prometheus. Check the time range, label filters and the value of
up. - Graphing raw counters. Counters accumulate and can reset. Use
rate()orincrease()when you care about change. - Unbounded labels. Labels such as user IDs or request IDs create huge numbers of series and raise memory and storage use.
- Expecting long history by default. Set retention deliberately, or use remote storage.
- Treating dashboards as alerting. A graph nobody is watching will not wake anyone. Define alerts for conditions that need action.
Best practices
- Keep configuration, alert rules and provisioned Grafana data sources in version control.
- Use recording rules to precompute expensive queries that dashboards run often.
- Restrict network access to both services and enable authentication where appropriate.
- Monitor the monitoring stack, ideally with a check that does not depend on it.
- Check supported versions before upgrading. As of late November 2026, Prometheus 3.13 is the supported long-term support release line, with support ending on 31 July 2027.
Frequently asked questions
Is Grafana a replacement for Prometheus?
No. Grafana does not take over Prometheus’s job of scraping and storing metrics. You could replace Prometheus with another backend, but Grafana would still need somewhere to get data.
Can Prometheus work without Grafana?
Yes. It collects, stores, queries and evaluates alert rules independently. Its built-in interface is simpler, so many teams add Grafana for dashboards.
Can Grafana work without Prometheus?
Yes. It can connect to other supported data sources.
Which should I learn first?
For infrastructure monitoring, start with Prometheus concepts: targets, labels, metric types and PromQL. Dashboard building is much easier once you understand the data behind each panel.
What is the short answer?
Prometheus gathers and keeps the measurements. Grafana helps people see and investigate them, along with data from other places. Both can alert, so decide which one owns each rule.