Docs
Launch GraphOS Studio

Prometheus exporter

Configure the Prometheus metrics exporter


Enable and configure the Prometheus exporter for metrics in the .

For general metrics configuration, refer to Router Metrics Configuration.

Prometheus configuration

To export metrics to Prometheus, enable the Prometheus endpoint and set its address and path in router.yaml:

router.yaml
telemetry:
exporters:
metrics:
prometheus:
enabled: true
listen: 127.0.0.1:9090
path: /metrics

Once enabled, you will be able to access the Prometheus endpoint at http://localhost:9090/metrics.

You can configure your APM agent to scrape the metrics from the endpoint. See the documentation for your APM agent for more details.

enabled

Set to true to enable the Prometheus exporter. Defaults to false.

listen

The address and port to listen on for Prometheus metrics. Defaults to 127.0.0.1.

path

The path to expose the Prometheus metrics. Defaults to /metrics.

Prometheus configuration reference

AttributeDefaultDescription
enabledfalseEnable the Prometheus exporter.
listen127.0.0.1:9090The address to serve Prometheus metric on.
path/metricsThe path to serve Prometheus metrics on.

Using Prometheus with containers

The Prometheus endpoint listens to 127.0.0.1 by default, which won't allow connections issued from a network.

While this is a safe default, other containers won't be able to access the Prometheus endpoint, which will disable metric scraping.

You can enable other containers to access it by setting the endpoint to listen to 0.0.0.0:

router.yaml
telemetry:
exporters:
metrics:
prometheus:
# By setting this endpoint you enable other containers and pods to access the Prometheus endpoint
enabled: true
listen: 0.0.0.0:9090
path: /metrics

You can validate your setting locally:

  1. Run a against the .

  2. Navigate to http://localhost:9090/metrics, and check that the endpoint returns metrics similar to the following:

    # HELP apollo_router_http_request_duration_seconds Total number of HTTP requests made.
    # TYPE apollo_router_http_request_duration_seconds histogram
    apollo_router_http_request_duration_seconds_bucket{le="0.5"} 1
    apollo_router_http_request_duration_seconds_bucket{le="0.9"} 1
    ---SNIP---

NOTE

If you haven't run a query against the router yet, you'll see a blank page because no metrics have been generated.

Previous
OTLP
Next
Configuration
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company