DEV Community

Siri Varma Vegiraju
Siri Varma Vegiraju

Posted on

Dapr and Grafana for Metrics

Prerequisites

  • Prometheus must be set up and scraping Dapr metrics before using Grafana (Dapr Docs).

Setup on Kubernetes

1. Install Grafana

  • Add the Helm repo:
  helm repo add grafana https://grafana.github.io/helm-charts
  helm repo update
Enter fullscreen mode Exit fullscreen mode
  • Install Grafana in the dapr-monitoring namespace:
  helm install grafana grafana/grafana -n dapr-monitoring
Enter fullscreen mode Exit fullscreen mode
  • Optional: For development or Minikube, disable persistent volumes:
  --set persistence.enabled=false
Enter fullscreen mode Exit fullscreen mode
  • Retrieve the Grafana admin password via Kubernetes secret and base64 decoding: remove trailing % from output string (Dapr Docs)
  • Confirm Grafana and Prometheus pods are running via kubectl get pods -n dapr-monitoring (Dapr Docs).

2. Configure Prometheus Data Source in Grafana

  • Port-forward the Grafana service to localhost:8080, then navigate to http://localhost:8080:
  kubectl port-forward svc/grafana 8080:80 -n dapr-monitoring
Enter fullscreen mode Exit fullscreen mode
  • Log in with user admin and the decoded password
  • Under Configuration → Data Sources, add Prometheus
  • Set the HTTP URL to the Prometheus server endpoint, e.g.: http://dapr-prom-prometheus-server.dapr-monitoring based on service name and namespace (Dapr Docs)
  • Enable as default and disable TLS verification (Skip TLS Verify On) for connection saving to succeed
  • Save & Test to ensure the data source is correctly connected (Dapr Docs)

3. Import Dashboards

  • From Grafana home screen, click "+ → Import"
  • Upload the .json dashboard file(s) corresponding to your Dapr version
  • Available dashboard templates include:
    • System Service: shows control-plane components like operator, injector, sentry, placement
    • Sidecars: shows health, resource use, throughput/latency (HTTP, gRPC), mTLS, Actor metrics
    • Actors: shows actor invocation metrics, timers, reminders, concurrency usage (Dapr Docs)
  • After importing, locate and open the dashboard(s) to begin visualizing metrics

Observability Insights

  • Dapr sidecars and control-plane services expose Prometheus-formatted metrics, which Prometheus scrapes on default ports (9090 for sidecar, 9091 for control-plane) (DEV Community, Dapr Docs)
  • Sidecar metrics include latency for service invocation, state/store calls, pub-sub, memory usage, error rates
  • Control-plane metrics include CPU usage, actor placements, injection failures, etc. (DEV Community, Dapr Docs)

Summary & Tips

  • Install Prometheus and Grafana (via Helm)
  • Connect Grafana to Prometheus as a data source
  • Import pre-built dashboards for system services, sidecars, and actor workloads
  • Use Grafana to visualize key metrics: latency, throughput, resource usage, failures, actor behavior
  • Hover over the "i" icons inside Grafana charts for descriptions of what each metric means (Dapr Docs)

Top comments (0)