Visualize metrics, logs, and traces in a single dashboard with Grafana. Learn through practical examples: connecting data sources, building panels, variables, Unified Alerting, and provisioning (dashboards as code).
Advanced
Updated Oct 1, 2026
~4 min read
8 sections
7 code examples
Learning Paths that include this guide
This guide is one step in the paths below. Study it together with the steps before and after.
Visualize metrics, logs, and traces in a single dashboard with Grafana. Learn through practical examples: connecting data sources, building panels, variables, Unified Alerting, and provisioning (dashboards as code). Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.
Key perspective
Infrastructure / operations
Rather than memorizing install commands, understand the order in which traffic, runtime, observability, and incident response connect.
To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning Grafana.
Learning flow
Rendering diagramβ¦
Architecture view
Rendering diagramβ¦
What is Grafana?
When you first open Grafana, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.
Grafana is a pure visualization layer that stores no data. Its only job is to send queries in real time to dozens of kinds of data sources β Prometheus (metrics), Loki (logs), Tempo (traces), MySQL, and more β and show the results in one dashboard, so start from the premise that responsibility for storing and collecting data always lies with the backend data sources.
Component
Role
Dashboard
A visualization screen with several Panels laid out in a grid. Defined as JSON, so it can be version-controlled
Panel
A single unit of visualization: a graph, table, gauge, and so on
Data Source
A connection to an external system Grafana runs queries against (Prometheus, Loki, MySQL, and so on)
Alert Rule
Threshold monitoring and alerting based on query results (Unified Alerting)
Organization / Team
Isolates dashboards, data sources, and permissions by group
Installation (Docker Compose)
Here you look at Installation (Docker Compose) alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Grafana runs standalone as well, but mounting the provisioning volume alongside restores the data sources and dashboards automatically even when the container is recreated. It is safer to force the initial login password to be changed.
docker-compose.ymlYAML
services: grafana: image: grafana/grafana-oss:11.0.0 ports: ["3000:3000"] environment: - GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_PASSWORD=admin - GF_USERS_ALLOW_SIGN_UP=false volumes: - grafana-data:/var/lib/grafana - ./provisioning:/etc/grafana/provisioning # automatic registration of data sources and dashboardsvolumes: grafana-data:
BASH
docker compose up -d# Open http://localhost:3000 (initially admin/admin; a password change is required on first login)
Connecting data sources
Here you look at Connecting data sources alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
You can register one directly in the UI through Connections β Data sources β Add data source, but declaring it in YAML with provisioning lets you deploy the same configuration repeatedly across environments and track the change history in Git.
Here you look at Dashboards & panels alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
A dashboard is a grid layout of several Panels. The choice of panel type decides how well the meaning of the data comes across, so it is best to settle first whether to show a trend or highlight the current value, and then pick the type.
Time-axis graph β trends such as CPU and request counts
Stat
Highlights a single value (current number of connected users and so on)
Gauge / Bar gauge
The current value against a threshold (disk usage and so on)
Table
Logs and aggregation results in tabular form
Heatmap
Visualizes the density of values, such as a response time distribution
Variables & templates
Here you look at Variables & templates alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
With variables, a single dashboard can be reused across many servers, services, and namespaces by switching with a dropdown. Considering that before variables the same dashboard had to be duplicated once per server, this is a core feature that cuts maintenance cost considerably.
Dashboard Settings β VariablesTEXT
Name: instance
Type: Query
Data source: Prometheus
Query: label_values(up, instance)
Multi-value: true
Include All option: true
# Using the variable in a panel query
sum(rate(http_requests_total{instance=~"$instance"}[5m]))
# The variable can be used in the dashboard title too
title: "Request overview β $instance"
Unified Alerting
Here you look at Unified Alerting alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Unified Alerting in Grafana 9+ manages alert rules and delivery channels in Grafana itself, separately from the Prometheus AlertManager. Keeping contact points (delivery channels) and notification policies (label-based routing) separate lets you manage changes to alert content and changes to recipients independently of each other.
Alert rule (Alerting β Alert rules β New)YAML
Query: sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))Condition: WHEN last() OF query IS ABOVE 0.05Evaluate every: 1m For: 5m # Firing once it persists for 5 minutes# Contact point β SlackType: SlackWebhook URL: https://hooks.slack.com/services/xxx/yyy/zzz# Notification policy β routing by label matchingMatching labels: severity=criticalContact point: slack-oncallGroup by: alertname, cluster
Plugins & user/organization management
Here you look at Plugins & user/organization management alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
An Organization is the top-level unit in which dashboards and data sources are fully isolated, and a Team is the unit inside an organization for granting folder and dashboard permissions by group. The more services you have, the more designing folder permissions by team up front reduces permission issues later.
Installing pluginsBASH
# Install a plugin (e.g. Pie Chart)grafana-cli plugins install grafana-piechart-panel# In a Docker environment, install through an environment variableGF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-clock-panel
Permission scope
Description
Organization
The top-level isolation unit that dashboards and data sources belong to
Team
A group of users within an organization. Folder/dashboard permissions are granted per team
Role (Viewer/Editor/Admin)
The base permission level per user
Folder permissions
Fine-grained view/edit permissions per team/user, by folder
Grafana: frequently asked questions
Does Grafana store data itself?
No. Grafana is a visualization tool that queries data sources such as Prometheus, log stores, and databases and draws the results. What Grafana stores is dashboard definitions, users, and alert settings.
Which metrics should go on a dashboard first?
Start with metrics that show what users experience. For a service that is request rate, error rate, and response time; for resources it is utilization and saturation. Rather than putting everything on one screen, separate an overview of the whole service from detail views for narrowing down a cause.
Can I manage dashboards as code?
Yes. Dashboards can be exported as JSON, and provisioning loads dashboards and data sources from files automatically. Versioning them in a repository keeps a change history and lets you restore the same dashboards immediately in a new environment.
Next steps
This section covers Next steps from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
π
Advanced Grafana roadmap
β’ Grafana Loki: log collection and search β the same label model as Prometheus β’ Grafana Tempo: distributed tracing, Jaeger/Zipkin compatible β’ Grafana Cloud: a managed SaaS combining Prometheus + Loki + Tempo + Grafana β’ Terraform Provider: manage dashboards/data sources/alert rules as IaC