Stage 6 · Operate
Dashboards with Grafana
Datasources and Folders
Configuring Prometheus, Loki, Tempo, folders, permissions, and provisioning YAML in Grafana.
Datasource Types
Grafana connects to multiple backend data sources simultaneously. Each dashboard can use one or more datasources. The most common are Prometheus for metrics, Loki for logs, Tempo for traces, and Elasticsearch for full-text search.
| Datasource | Data Type | Query Language |
|---|---|---|
| Prometheus | Metrics | PromQL |
| Loki | Logs | LogQL |
| Tempo | Traces | TraceQL |
| Elasticsearch | Logs/Metrics | Lucene |
Prometheus Datasource
The Prometheus datasource is the most commonly used. Configure the URL, access method, and scraping interval. Grafana uses the datasource settings to query Prometheus and render panels.
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
jsonData:
timeInterval: "15s"
httpMethod: POST
editable: falseMulti-Datasource Setup
Production Grafana instances typically have multiple datasources. You might have separate Prometheus instances for metrics and long-term storage, a Loki instance for logs, and a Tempo instance for traces. Each gets its own datasource configuration.
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus:9090
isDefault: true
- name: Prometheus-LongTerm
type: prometheus
url: http://thanos-query:9090
- name: Loki
type: loki
url: http://loki:3100
- name: Tempo
type: tempo
url: http://tempo:3200
jsonData:
tracesToLogsV2:
datasourceUid: LokiInstead of hardcoding datasources in panels, use a datasource variable. This lets you switch between Prometheus instances or environments without editing every panel.
Folders and Permissions
Folders organize dashboards and control access. Assign folder permissions to teams so only authorized users can view or edit dashboards. Folders also appear in the Grafana sidebar for navigation.
apiVersion: 1
providers:
- name: "Infrastructure"
orgId: 1
folder: "Infrastructure"
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/infrastructureDatasource Provisioning
Provision datasources using YAML files in /etc/grafana/provisioning/datasources/. Grafana loads these on startup and keeps them synchronized. This ensures consistent datasource configuration across environments.
Never rely on manual datasource creation in production. Provision datasources with YAML files so they are version-controlled and reproducible across environments.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.