Enabling Metrics Endpoints
Learn how to use a self-hosted router in Kubernetes with metrics endpoints
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:
Create a YAML file,
my_values.yaml
, to contain additional values that override default values.Edit
my_values.yaml
to enable metrics endpoints:YAMLmy_values.yaml1router: 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>
noteAlthough 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 setsenabled: true
.router.configuration.telemetry.metrics.otlp
is enabled by inclusion.router.configuration.telemetry.temporality
by default istemporality: cumulative
and is a good choice for most metrics consumers. For DataDog, usetemporality: delta
.
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
:Bash1helm 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