docs/en/api/09-metrics.md
OpenViking exposes a /metrics endpoint for Prometheus, Grafana Agent, and other monitoring systems that scrape Prometheus exposition text.
Unlike /api/v1/observer/* and /api/v1/stats/*, /metrics is intended for:
Export Prometheus metrics for the current process.
This endpoint is typically scraped by Prometheus on a schedule, but it is also useful for local debugging and manual inspection.
Authentication
/metrics is not wired to get_request_context or other auth dependencies./metrics is effectively a public scrape endpoint.HTTP API
GET /metrics
curl -X GET http://localhost:1933/metrics
If your deployment requires gateway- or proxy-level authentication, attach the required headers there, for example:
curl -X GET http://localhost:1933/metrics \
-H "Authorization: Bearer your-key"
Response Format
On success, the endpoint returns text/plain; version=0.0.4; charset=utf-8 with Prometheus exposition text, for example:
# HELP openviking_http_requests_total Total number of HTTP requests
# TYPE openviking_http_requests_total counter
openviking_http_requests_total{method="GET",route="/api/v1/system/status",status="200"} 12
# HELP openviking_http_inflight_requests Number of inflight HTTP requests
# TYPE openviking_http_inflight_requests gauge
openviking_http_inflight_requests{route="/api/v1/system/status"} 0
When the metrics system is disabled, the endpoint returns:
404Prometheus metrics are disabled.
Example: Prometheus Scrape Config
scrape_configs:
- job_name: openviking
metrics_path: /metrics
static_configs:
- targets: ["localhost:1933"]
If your deployment protects /metrics at the gateway layer, configure the scrape job with the required auth settings through your proxy, service discovery, or Prometheus auth options.
Notes
/metrics is meant for frequent scraping, so the exported metrics should remain low-cardinality and low-cost./metrics returns Prometheus text, not the standard OpenViking {status, result, time} JSON response format./api/v1/stats/*, not /metrics./api/v1/observer/*.