Enabling Metrics Endpoints

Learn how to use a self-hosted router in Kubernetes with metrics endpoints


note
The Apollo Router Core source code and all its distributions are made available under the Elastic License v2.0 (ELv2) license.

The router supports metrics endpoints for Prometheus and OpenTelemetry protocol (OTLP). The default deployment doesn't enable metrics endpoints because the router chart disables both Prometheus (explicitly) and OTLP (by omission).

This guide shows how to deploy a router with metric endpoints in Kubernetes.

Deploy with metrics endpoints

To enable metrics endpoints in your deployed router through a YAML configuration file:

  1. Create a YAML file, my_values.yaml, to contain additional values that override default values.

  2. Edit my_values.yaml to enable metrics endpoints:

    YAML
    my_values.yaml
    1router:
    2  configuration:
    3    telemetry:
    4      metrics:
    5        prometheus:
    6          enabled: true
    7          listen: 0.0.0.0:9090
    8          path: "/metrics"
    9        otlp:
    10          temporality: cumulative # default; if using DataDog, use temporality: delta
    11          endpoint: <otlp-endpoint-addr>
    note
    Although this example enables both Prometheus and OTLP, in practice it's common to enable only one endpoint.
    • router.configuration.telemetry.metrics.prometheus was already configured but disabled (enabled: false) by default. This configuration sets enabled: true.

    • router.configuration.telemetry.metrics.otlp is enabled by inclusion.

    • router.configuration.telemetry.temporality by default is temporality: cumulative and is a good choice for most metrics consumers. For DataDog, use temporality: delta.

  3. Deploy the router with the additional YAML configuration file. For example, starting with the helm install command from the basic deployment step, append --values my_values.yaml:

    Bash
    1helm install --namespace <router-namespace> --set managedFederation.apiKey="<graph-api-key>" --set managedFederation.graphRef="<graph-ref>"  oci://ghcr.io/apollographql/helm-charts/router --version <router-version> --values router/values.yaml --values my_values.yaml
Feedback

Edit on GitHub

Ask Community