# Traffic Metrics

Kuma facilitates consistent traffic metrics across all dataplanes in your mesh.

A user can enable traffic metrics by editing a Mesh resource and providing the desired Mesh-wide configuration. If necessary, metrics configuration can be customized for each Dataplane individually, e.g. to override the default metrics port that might be already in use on that particular machine.

Out-of-the-box, Kuma provides full integration with Prometheus:

  • if enabled, every dataplane will expose its metrics in Prometheus format
  • furthemore, Kuma will make sure that Prometheus can automatically find every dataplane in the mesh

To collect metrics from Kuma, you need to first expose metrics from Dataplanes and then configure Prometheus to collect them.

# Expose metrics from Dataplanes

To expose Prometheus metrics from every dataplane in the mesh, configure a Mesh resource as follows:

    Both snippets from above instruct Kuma to configure every dataplane in the mesh default to expose an HTTP endpoint with Prometheus metrics on port 5670 and URI path /metrics.

    # Override Prometheus settings per Dataplane

      # Configure Prometheus

      Although dataplane metrics are now exposed, Prometheus doesn't know anything about it just yet.

      To help Prometheus to automatically discover dataplanes, Kuma provides a tool - kuma-prometheus-sd. kuma-prometheus-sd is meant to run alongside Prometheus instance. It knows location of Kuma Control Plane is and can fetch an up-to-date list of dataplanes from it. It then transforms that information into a format that Prometheus can understand, and saves it into a file on disk. Prometheus watches for changes to that file and updates its scraping configuration accordingly.

        Now, if you check Targets page on Prometheus UI, you should see a list of dataplanes from your mesh, e.g.

        A screenshot of Targets page on Prometheus UI

        # Secure Dataplane metrics

        Kuma lets you expose Dataplane metrics in a secure way by leveraging mTLS. Prometheus needs to be a part of the Mesh for this feature to work, which is the default deployment model when kumactl install metrics is used on Kubernetes.

          # Expose metrics from applications

          In addition to exposing metrics from Dataplane, you may want to expose metrics from application next to Kuma DP.

            Remember that in order to consume paths protected by mTLS, you need Traffic Permission that lets Prometheus consume applications.

            # Grafana Dashboards

            Kuma ships with 4 default dashboards that are available to import from Grafana Labs repository (opens new window).

            # Kuma Dataplane

            This dashboards lets you investigate the status of a single dataplane in the mesh.

            Kuma Dataplane dashboard Kuma Dataplane dashboard Kuma Dataplane dashboard Kuma Dataplane dashboard

            # Kuma Mesh

            This dashboard lets you investigate the aggregated statistics of a single mesh.

            Kuma Mesh dashboard

            # Kuma Service to Service

            This dashboard lets you investigate aggregated statistics from dataplanes of given source service to dataplanes of given destination service.

            Kuma Service to Service dashboard Kuma Service to Service HTTP

            # Kuma CP

            This dashboard lets you investigate statistics of the control plane.

            Kuma CP dashboard Kuma CP dashboard Kuma CP dashboard

            # Kuma Service

            This dashboard lets you investigate aggregated statistics for each service.

            Kuma Service dashboard
            Last Updated: 1/18/2022, 12:31:35 PM