Metrics

Enable Prometheus metrics on any listener. Each listener gets its own isolated registry and scrape endpoint, so different listeners can collect different dimensions.

Configuration

{
  "metrics": {
    "path": "/metrics",
    "collect": {
      "route": true,
      "destination": true,
      "endpoint": false,
      "middleware": true,
      "listener": true
    },
    "histograms": {
      "durationBuckets": [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10],
      "sizeBuckets": [100, 1000, 10000, 100000, 1000000]
    }
  }
}

All fields

FieldTypeDefaultDescription
pathstring/metricsHTTP path for the Prometheus scrape endpoint
collectobjectall on except endpointWhich metric dimensions to collect
collect.routebooltrueRoute-level metrics (7 metrics)
collect.destinationbooltrueDestination-level metrics (4 metrics)
collect.endpointboolfalsePer-pod metrics (4 metrics) — high cardinality
collect.middlewarebooltrueMiddleware-level metrics (3 metrics)
collect.listenerbooltrueListener-level metrics (3 metrics)
histograms.durationBucketsfloat[]Prometheus defaultsCustom boundaries for _duration_seconds histograms
histograms.sizeBucketsfloat[]Prometheus defaultsCustom boundaries for byte-counting histograms

Examples

All dimensions (except per-pod)

{
  "name": "production",
  "port": 8443,
  "metrics": {
    "path": "/metrics",
    "collect": {
      "route": true,
      "destination": true,
      "endpoint": false,
      "middleware": true,
      "listener": true
    }
  }
}

This is the recommended configuration. 21 metrics with manageable cardinality.

Including per-pod metrics

{
  "name": "debug",
  "port": 9090,
  "metrics": {
    "path": "/metrics",
    "collect": {
      "route": true,
      "destination": true,
      "endpoint": true,
      "middleware": true,
      "listener": true
    }
  }
}

All 22 metrics. Enable endpoint only when you need to debug individual pods — it generates one time series per pod × status code combination.

Minimal (route metrics only)

{
  "name": "minimal",
  "port": 8080,
  "metrics": {
    "path": "/metrics",
    "collect": {
      "route": true,
      "destination": false,
      "endpoint": false,
      "middleware": false,
      "listener": false
    }
  }
}

Custom histogram buckets for low-latency APIs

{
  "name": "fast-api",
  "port": 8080,
  "metrics": {
    "path": "/metrics",
    "histograms": {
      "durationBuckets": [0.001, 0.002, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1]
    }
  }
}

Custom metrics path

{
  "metrics": {
    "path": "/-/prometheus/metrics"
  }
}

Two listeners, different metrics

[
  {
    "name": "public",
    "port": 443,
    "metrics": {
      "path": "/metrics",
      "collect": {"route": true, "destination": true, "middleware": true, "listener": true}
    }
  },
  {
    "name": "internal",
    "port": 8080,
    "metrics": {
      "path": "/metrics",
      "collect": {"route": true, "destination": true, "endpoint": true, "middleware": true, "listener": true}
    }
  }
]

No metrics

Omit the metrics field entirely. No Prometheus endpoint is served on this listener.


Available metrics

Route metrics

Enabled by default (collect.route: true).

MetricTypeLabels
vrata_route_requests_totalcounterroute, group, method, status_code, status_class
vrata_route_duration_secondshistogramroute, group, method
vrata_route_request_bytes_totalcounterroute, group
vrata_route_response_bytes_totalcounterroute, group
vrata_route_inflight_requestsgaugeroute, group
vrata_route_retries_totalcounterroute, group, attempt
vrata_mirror_requests_totalcounterroute, destination
# Error rate per route
sum(rate(vrata_route_requests_total{status_class="5xx"}[5m])) by (route)
/ sum(rate(vrata_route_requests_total[5m])) by (route)

# P99 latency
histogram_quantile(0.99, sum(rate(vrata_route_duration_seconds_bucket[5m])) by (route, le))

# Retry storm detection
sum(rate(vrata_route_retries_total[5m])) by (route)

Destination metrics

Enabled by default (collect.destination: true).

MetricTypeLabels
vrata_destination_requests_totalcounterdestination, status_code, status_class
vrata_destination_duration_secondshistogramdestination
vrata_destination_inflight_requestsgaugedestination
vrata_destination_circuit_breaker_stategaugedestination

Circuit breaker state: 0 = closed, 1 = open, 2 = half-open.

# Canary error rate comparison
sum(rate(vrata_destination_requests_total{status_class="5xx", destination="canary"}[5m]))
/ sum(rate(vrata_destination_requests_total{destination="canary"}[5m]))

# Circuit breaker firing
vrata_destination_circuit_breaker_state == 1

Endpoint metrics

Off by default (collect.endpoint: false) — high cardinality. Enable when you need per-pod visibility.

MetricTypeLabels
vrata_endpoint_requests_totalcounterdestination, endpoint, status_code, status_class
vrata_endpoint_duration_secondshistogramdestination, endpoint
vrata_endpoint_healthygaugedestination, endpoint
vrata_endpoint_consecutive_5xxgaugedestination, endpoint

With 100 destinations × 10 pods × 5 status codes = 5000 time series just for vrata_endpoint_requests_total.

# Find the slow pod
histogram_quantile(0.99, rate(vrata_endpoint_duration_seconds_bucket{destination="api"}[5m])) by (endpoint)

# Unhealthy endpoints
vrata_endpoint_healthy == 0

Middleware metrics

Enabled by default (collect.middleware: true).

MetricTypeLabels
vrata_middleware_duration_secondshistogrammiddleware, type
vrata_middleware_rejections_totalcountermiddleware, type, status_code
vrata_middleware_passed_totalcountermiddleware, type
# JWT validation overhead
histogram_quantile(0.99, rate(vrata_middleware_duration_seconds_bucket{type="jwt"}[5m]))

# Rate limit effectiveness
rate(vrata_middleware_rejections_total{type="rateLimit", status_code="429"}[5m])

# Auth denial rate
sum(rate(vrata_middleware_rejections_total{type="jwt"}[5m]))
/ (sum(rate(vrata_middleware_rejections_total{type="jwt"}[5m])) + sum(rate(vrata_middleware_passed_total{type="jwt"}[5m])))

Listener connection metrics

Enabled by default (collect.listener: true).

MetricTypeLabels
vrata_listener_connections_totalcounterlistener, address
vrata_listener_active_connectionsgaugelistener, address
vrata_listener_tls_handshake_errors_totalcounterlistener, address
# Connection rate
rate(vrata_listener_connections_total[5m])

# Certificate problems
rate(vrata_listener_tls_handshake_errors_total[5m])

# Connection saturation
vrata_listener_active_connections