Skip to content

Metrics

The metrics block exposes Prometheus-formatted counters over plain HTTP. The same counters that the gRPC StatsService reports are surfaced at /metrics (and the runtime-debug pprof endpoints at /debug/pprof/).

Options

FieldTypeDefaultAllowed valuesDescription
tagstring(required for routing)<inbound tag>Routing tag for the metrics inbound. Required if you want to route the metrics endpoint with a rule (typically you do).
listenstring127.0.0.1:0<host:port>HTTP address the metrics endpoint listens on. Empty registers an in-process inbound only.

Source: infra/conf/metrics.go:8-11 · pinned at v26.6.1 (94ffd50)

Example

json
{
  "stats": {},
  "metrics": {
    "tag": "metrics",
    "listen": "127.0.0.1:9099"
  },
  "policy": {
    "system": {
      "statsInboundUplink": true,
      "statsInboundDownlink": true,
      "statsOutboundUplink": true,
      "statsOutboundDownlink": true
    }
  },
  "routing": {
    "rules": [
      { "type": "field", "inboundTag": ["metrics"], "outboundTag": "metrics" }
    ]
  }
}

Notes

  • metrics reuses the same counter store as stats; you still need stats: {} plus the relevant counter toggles in policy.
  • The endpoint serves both the Prometheus text format on /metrics and Go's net/http/pprof handlers on /debug/pprof/. Keep the listen address localhost-only.

Source: infra/conf/metrics.go:8-11 · v26.6.1 (94ffd50)

Core Tutorial by Argsment