AutoMerge is generally available

Last updated:

Manage Dashboards as Code

Define and manage dashboards using the Dash0 Operator for Kubernetes, Dash0 Terraform provider, and Dash0 CLI for version control, workflows, and automated deployment.

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.

Tip

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

Save this resource as service-overview.yaml. Install the Perses Operator CRDs and configure Dash0 monitoring in the monitoring namespace as described in Manage Dash0 Resources.

yaml
apiVersion: perses.dev/v1alpha2
kind: PersesDashboard
metadata:
  name: service-overview
  namespace: monitoring
spec:
  config:
    duration: 1h
    display:
      name: Service Overview
    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 example requires an ingested http_requests_total counter. Replace the query with a metric available in your dataset.

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

bash
# Apply the dashboard
kubectl apply -f service-overview.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 monitoring

For 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

Configure DASH0_API_URL and DASH0_AUTH_TOKEN as described in Terraform Provider Configuration. Use your regional API endpoint and a token authorized to manage dashboards.

The API format used by Terraform keeps the dashboard configuration directly under spec with apiVersion: perses.dev/v1alpha1. The Kubernetes v1alpha2 resource above wraps that configuration in spec.config.

hcl
terraform {
  required_providers {
    dash0 = {
      source  = "dash0hq/dash0"
      version = "~> 1.0"
    }
  }
}

provider "dash0" {}

resource "dash0_dashboard" "service_overview" {
  dataset        = "production"
  dashboard_yaml = <<-EOT
    apiVersion: perses.dev/v1alpha1
    kind: PersesDashboard
    metadata:
      name: service-overview
    spec:
      duration: 1h
      display:
        name: Service Overview
      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

Use the native API format shown in the Terraform example, not the Kubernetes resource with spec.config. Save the YAML from the dashboard_yaml value as service-overview-api.yaml, without the HCL heredoc markers.

bash
# Create a dashboard from a YAML or JSON file
dash0 dashboards create -f service-overview-api.yaml

List Dashboards

bash
# List all dashboards
dash0 dashboards list --all

Get Dashboard Details

bash
# Get a single dashboard as YAML
dash0 dashboards get <id> -o yaml

# Get dashboard details in JSON format
dash0 dashboards get <id> -o json

Update Dashboard

bash
# Update an existing dashboard
dash0 dashboards update <id> -f service-overview-api.yaml

Delete Dashboard

bash
# Delete a dashboard
dash0 dashboards delete <id>

Batch Operations

bash
# 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 --all -o yaml > dashboards-backup.yaml

For 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.

Edit as JSON dialog

Within the Edit as JSON dialog you can see the dashboard source and modify it directly. Click Apply to update the local preview, then save the dashboard to persist the changes.

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