The documentation you are viewing is for Dapr v1.7 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Metrics

Observing Dapr metrics in Kubernetes

Dapr exposes a Prometheus metrics endpoint that you can scrape to:

  • Gain a greater understanding of how Dapr is behaving.
  • Set up alerts for specific conditions.

Configuration

The metrics endpoint is enabled by default. You can disable it by passing the command line argument --enable-metrics=false to Dapr system processes.

The default metrics port is 9090. You can override this by passing the command line argument --metrics-port to Daprd.

You can also disable the metrics exporter for a specific application by setting the dapr.io/enable-metrics: "false" annotation to your application deployment. With the metrics exporter disabled, daprd will not open the metrics listening port.

The follow example shows metrics are explicitly enabled with the port specified as “9090”.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nodeapp
  labels:
    app: node
spec:
  replicas: 1
  selector:
    matchLabels:
      app: node
  template:
    metadata:
      labels:
        app: node
      annotations:
        dapr.io/enabled: "true"
        dapr.io/app-id: "nodeapp"
        dapr.io/app-port: "3000"
        dapr.io/enable-metrics: "true"
        dapr.io/metrics-port: "9090"
    spec:
      containers:
      - name: node
        image: dapriosamples/hello-k8s-node:latest
        ports:
        - containerPort: 3000
        imagePullPolicy: Always

To disable the metrics collection in the Dapr side cars running in a specific namespace:

  • Use the metrics spec configuration.
  • Set enabled: false to disable the metrics in the Dapr runtime.
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
  name: tracing
  namespace: default
spec:
  tracing:
    samplingRate: "1"
  metrics:
    enabled: false

Metrics

By default, each Dapr system process emits Go runtime/process metrics and have their own metrics:

References