View docs for

Accessing Metrics

Overview

Working Group Two exposes metrics that can help operators getting some operational insight. This data is exposed using the OpenMetrics text format.

This text format is the same as exposed by Prometheus. In addition to being supported by Prometheus, many other systems has OpenMetrics integrations such as Datadog and New Relic.

The HTTP endpoint we provide will give you the current state of all of your metrics. We do not provide a query API.

Please reach out to clarify what metrics you would need access to.

Credentials

This API is only supported by operator tokens. Operator tokens are now deprecated, and should only be used for this API.

This API requires the metrics.read scope.

Base path: https://api.wgtwo.com/metrics/v1

Get metrics, curl

curl -s -u ${CLIENT_ID}:${CLIENT_SECRET} https://api.wgtwo.com/metrics/v1

Get metrics, Prometheus

The below Prometheus config will scrape the metric endpoint from Working Group Two every 30 seconds, fetching all available time series. Note that the configuration will contain secrets.

See: prometheus.io › Configuration

global:
  scrape_interval:     30s
  evaluation_interval: 30s

scrape_configs:
  - job_name: wgtwo

    metrics_path: /metrics/v1

    scheme: https
    basic_auth:
      username: "CLIENT_ID"
      password: "CLIENT_SECRET"

    static_configs:
      - targets:
          - "api.wgtwo.com:443"
prometheus.yml

Example: Run with Docker

See: prometheus.io › Using Docker

If you run the below commands, you should have Prometheus running successfully.

# Store sample configuration to prometheus.yml, including actual credentials

docker run -p 9090:9090 -v prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

Grafana

See: grafana.com › Using Prometheus in Grafana

As our metric API does not expose a query API, it cannot be used by Grafana directly. However, Grafana has built-in support for Prometheus.