Last updated:
Manage Dashboards as Code
Dashboards are Dash0 assets that can be versioned and managed as infrastructure as code. This approach enables version control, automated deployment pipelines, consistent configuration across environments, and code review for dashboard changes.
Dash0 dashboards use the Perses dashboard format, which provides a Kubernetes-native approach to dashboard configuration.
Agent0 can generate infrastructure-as-code configurations for dashboards and raise them as pull requests to your repository. After creating a dashboard with Agent0, request the corresponding Terraform configuration or Kubernetes manifest to keep your observability in code. See Asset Creation for details.
Dash0 Operator for KubernetesRelease historyThis feature was introduced by Configuration as code for dashboards and check rules on October 18, 2024.
Define dashboards as Perses PersesDashboard custom resources that sync to Dash0, enabling workflows and native Kubernetes management.
Example
apiVersion: perses.dev/v1alpha1
kind: PersesDashboard
metadata:
name: service-overview
namespace: monitoring
spec:
display:
name: Service Overview
datasources:
default:
name: default
plugin:
kind: PrometheusDataSource
layouts:
- kind: Grid
spec:
items:
- x: 0
"y": 0
width: 12
height: 6
content:
$ref: "#/spec/panels/request_rate"
panels:
request_rate:
kind: Panel
spec:
display:
name: Request Rate
plugin:
kind: TimeSeriesChart
spec:
queries:
- kind: TimeSeriesQuery
spec:
plugin:
kind: PrometheusTimeSeriesQuery
spec:
query: rate(http_requests_total[5m])The Dash0 Operator for Kubernetes watches for Perses dashboard resources in namespaces with a Dash0 monitoring resource deployed. When it detects changes:
- New dashboard resources are created as dashboards in Dash0
- Modified resources update the corresponding dashboards
- Deleted resources remove the corresponding dashboards
Apply and Manage
# Apply the dashboard
kubectl apply -f dashboard.yaml
# List all dashboards
kubectl get persesdashboards -n monitoring
# View details
kubectl describe persesdashboard service-overview -n monitoring
# Update the dashboard
kubectl edit persesdashboard service-overview -n monitoring
# Delete the dashboard
kubectl delete persesdashboard service-overview -n monitoringFor more information, refer to the Dash0 Operator for Kubernetes documentation.
Dash0 Terraform ProviderRelease historyThis feature was introduced by Dash0 Terraform Provider on May 5, 2025.
Manage dashboards in your Terraform infrastructure alongside other cloud resources for unified infrastructure management.
Example Usage
terraform {
required_providers {
dash0 = {
source = "dash0hq/dash0"
version = "~> 1.0"
}
}
}
provider "dash0" {
url = "https://api.dash0.com"
auth_token = "auth_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
resource "dash0_dashboard" "service_overview" {
dataset = "production"
dashboard_yaml = <<-EOT
apiVersion: perses.dev/v1alpha1
kind: PersesDashboard
metadata:
name: service-overview
namespace: monitoring
spec:
display:
name: Service Overview
datasources:
default:
name: default
plugin:
kind: PrometheusDataSource
layouts:
- kind: Grid
spec:
items:
- x: 0
"y": 0
width: 12
height: 6
content:
$ref: "#/spec/panels/request_rate"
panels:
request_rate:
kind: Panel
spec:
display:
name: Request Rate
plugin:
kind: TimeSeriesChart
spec:
queries:
- kind: TimeSeriesQuery
spec:
plugin:
kind: PrometheusTimeSeriesQuery
spec:
query: rate(http_requests_total[5m])
EOT
}For more information, see the dash0_dashboard resource documentation.
Dash0 CLI
Script dashboard operations with the Dash0 CLI for automated deployments and batch operations.
Create from File
# Create a dashboard from a YAML or JSON file
dash0 dashboards create -f service-overview.yamlList Dashboards
# List all dashboards
dash0 dashboards listGet Dashboard Details
# Get a single dashboard as YAML
dash0 dashboards get <id> -o yaml
# Get dashboard details in JSON format
dash0 dashboards get <id> -o jsonUpdate Dashboard
# Update an existing dashboard
dash0 dashboards update <id> -f service-overview-updated.yamlDelete Dashboard
# Delete a dashboard
dash0 dashboards delete <id>Batch Operations
# Create multiple dashboards from a directory
for file in dashboards/*.yaml; do
dash0 dashboards create -f "$file"
done
# Export all dashboards for backup
dash0 dashboards list -o yaml > dashboards-backup.yamlFor more information, see the Dash0 CLI command reference.
Direct JSON Editing
Dash0's "Edit as JSON" feature provides direct access to dashboard configurations in JSON format through the web UI. This capability allows for quick edits and experimentation without committing to code.
The JSON editor can be accessed by clicking Edit as JSON in the top-right corner of the dashboard viewer.
Within the Edit as JSON dialog you can see the dashboard source and modify it directly. Changes are applied immediately when you save.
The JSON editor is convenient for:
- Copying dashboards across organizations and datasets.
- Executing batch modifications across the whole dashboard (e.g., adapting PromQL queries when an attribute key changes).
- Quick prototyping and experimentation with dashboard configurations.
Further Reading
- Manage Views as Code — Manage saved queries as infrastructure as code.
- Manage Check Rules as Code — Define and manage check rules using infrastructure as code.
- Manage Notification Channels as Code — Manage notification channels using infrastructure as code.
