What is Grafana and How Does it Relate to Prometheus?
Learn what Grafana is, how it visualizes data from Prometheus and other sources, and how dashboards work — with a DevOps interview answer.
Expected Interview Answer
Grafana is an open-source visualization and dashboarding platform that queries data sources like Prometheus, Loki, or Elasticsearch and renders their results as graphs, tables, and alerts, without storing the underlying time-series data itself.
Grafana connects to one or more configured data sources through plugins, sends queries in that source’s native language — PromQL for Prometheus, LogQL for Loki, Lucene or SQL for others — and renders the response as panels arranged on a dashboard. This separation of concerns matters: Prometheus is responsible for collecting and storing metrics, while Grafana is purely a read-time visualization and alerting layer that can pull from multiple backends at once on the same dashboard. Dashboards are defined as JSON, which makes them version-controllable and shareable across teams via provisioning or a dashboard marketplace. Grafana also supports its own alerting engine that can evaluate queries across any connected data source and route notifications, complementing or replacing Prometheus’s own Alertmanager depending on the setup.
- Unifies visualization across multiple data sources on one dashboard
- Keeps the storage engine (Prometheus) decoupled from the presentation layer
- Dashboards as JSON enable version control and reuse across teams
- Built-in alerting can span multiple backends beyond just metrics
AI Mentor Explanation
Grafana is like the giant stadium scoreboard that pulls live numbers from several separate systems — the ball-tracking radar, the scorer’s manual entry, and the weather station — and displays them all together as one unified view for the crowd. The scoreboard itself does not track the ball or record runs; it just queries each source system and renders the result as a readable panel. A stadium can reconfigure the scoreboard layout for a different match without touching how the radar or scorer’s system actually works underneath. If the radar system goes down, the scoreboard simply shows a gap for that panel while the rest keeps updating.
Step-by-Step Explanation
Step 1
Add a data source
Configure Grafana to connect to Prometheus, Loki, Elasticsearch, or another supported backend.
Step 2
Build a query
A panel sends a query in the data source’s native language, e.g. PromQL for Prometheus.
Step 3
Design the panel
Choose a visualization type — time series, table, gauge — and arrange panels into a dashboard.
Step 4
Version and alert
Export the dashboard as JSON for version control; optionally configure Grafana-native alert rules on any panel.
What Interviewer Expects
- Clear distinction between Grafana (visualization) and Prometheus (storage/collection)
- Understanding that Grafana can query multiple data sources on one dashboard
- Awareness that dashboards are portable JSON, enabling version control
- Knowledge that Grafana has its own alerting engine separate from Alertmanager
Common Mistakes
- Saying Grafana stores metrics itself
- Assuming Grafana only works with Prometheus
- Confusing Grafana alerting with Prometheus Alertmanager as identical tools
- Forgetting dashboards can be version-controlled as JSON
Best Answer (HR Friendly)
“Grafana is the tool we use to turn raw monitoring data into readable dashboards and graphs. It does not collect or store the data itself — it connects to systems like Prometheus and pulls in whatever numbers we ask for, so one dashboard can show metrics, logs, and other data side by side in a way that is easy for the whole team to understand at a glance.”
Code Example
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
jsonData:
timeInterval: 15sFollow-up Questions
- How does Grafana alerting differ from Prometheus Alertmanager?
- How would you provision dashboards as code for a new environment?
- What data sources besides Prometheus does Grafana commonly connect to?
- How do Grafana variables make a dashboard reusable across services?
MCQ Practice
1. What is Grafana’s primary role in a monitoring stack?
Grafana is a visualization layer that queries data sources like Prometheus at read time; it does not store metrics itself.
2. Can a single Grafana dashboard combine data from multiple different backends?
Grafana dashboards can mix panels pulling from different data sources, such as Prometheus metrics alongside Loki logs.
3. Why is exporting Grafana dashboards as JSON useful?
JSON dashboard definitions can be checked into source control and provisioned consistently across environments.
Flash Cards
What is Grafana? — An open-source visualization/dashboarding platform that queries external data sources.
Does Grafana store metrics? — No — it queries data sources like Prometheus at read time and renders the results.
How are Grafana dashboards portable? — They are defined as JSON, so they can be version-controlled and provisioned.
Can Grafana alert on non-Prometheus data? — Yes, its own alerting engine can evaluate queries across any connected data source.