Last updated:
Manage Views as Code
Views 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 view changes.
Agent0 can generate infrastructure-as-code configurations for views and raise them as pull requests to your repository. After creating a view with Agent0, request the corresponding Terraform configuration or Kubernetes manifest to keep your observability in code. See Asset Creation for details.
Dash0 Operator for Kubernetes
Define views as Dash0View custom resources that sync to Dash0, enabling workflows and native Kubernetes management.
Example
apiVersion: operator.dash0.com/v1alpha1
kind: Dash0View
metadata:
name: error-logs
namespace: monitoring
spec:
type: logs
display:
name: Error Logs
description: All error-level logs from production services
groupBy:
- service.name
- k8s.pod.name
filter:
- key: severity
operator: equals
value: ERROR
- key: k8s.namespace.name
operator: equals
value: productionThe Dash0 Operator for Kubernetes watches for Dash0View resources in namespaces with a Dash0 monitoring resource deployed. When it detects changes:
- New view resources are created as views in Dash0
- Modified resources update the corresponding views
- Deleted resources remove the corresponding views
Apply and Manage
# Apply the view
kubectl apply -f view.yaml
# List all views
kubectl get dash0views -n monitoring
# View details
kubectl describe dash0view error-logs -n monitoring
# Update the view
kubectl edit dash0view error-logs -n monitoring
# Delete the view
kubectl delete dash0view error-logs -n monitoringFor more information, refer to the Dash0 Operator for Kubernetes documentation.
Dash0 Terraform Provider
Manage views 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_view" "error_logs" {
dataset = "production"
view_yaml = <<-EOT
kind: Dash0View
metadata:
name: error-logs
spec:
type: logs
display:
name: Error Logs
description: All error-level logs from production services
groupBy:
- service.name
filter:
- key: severity
operator: equals
value: ERROR
- key: k8s.namespace.name
operator: equals
value: production
EOT
}For more information, see the dash0_view resource documentation.
Dash0 CLI
Script view operations with the Dash0 CLI for automated deployments and batch operations.
Create from File
# Create a view from a YAML file
dash0 views create --dataset production -f error-logs.yamlList Views
# List all views in a dataset
dash0 views list --dataset productionGet View Details
# Get a single view as YAML
dash0 views get --dataset production <id> -o yaml
# Get view details in JSON format
dash0 views get --dataset production <id> -o jsonUpdate View
# Update an existing view
dash0 views update --dataset production <id> -f error-logs-updated.yamlDelete View
# Delete a view
dash0 views delete --dataset production <id>For more information, see the Dash0 CLI command reference.
Further Reading
- Export Views — Learn how to export views as YAML for version control and deployment.
- About Views — Understand how to create, share, and manage reusable telemetry views.
- Manage Dashboards as Code — Define and manage dashboards using infrastructure as code.
- Manage Check Rules as Code — Define and manage check rules using infrastructure as code.
- Manage Spam Filters as Code — Define and manage spam filters using infrastructure as code.