Overview
Bifrost exposes Prometheus metrics via two methods:- Pull-based (Scraping): Traditional
/metricsendpoint that Prometheus can scrape - Push-based (Push Gateway): Push metrics to a Prometheus Push Gateway for cluster deployments
For multi-node deployments: Use the Push Gateway method to ensure accurate metric aggregation. Traditional scraping may miss nodes behind load balancers.
Pull-based Scraping
Bifrost automatically exposes a/metrics endpoint when the telemetry plugin is enabled (enabled by default). No additional configuration is needed.
When Bifrost’s authentication is enabled (
auth_config.is_enabled = true), the /metrics endpoint requires Basic auth credentials. You must include the same admin_username and admin_password from your auth_config in the Prometheus scrape configuration. Without this, Prometheus will receive 401 Unauthorized responses and scraping will silently fail.Prometheus Configuration
Add Bifrost to your Prometheusprometheus.yml:
basic_auth to your scrape config:
Endpoint
Push-based (Push Gateway)
For multi-node cluster deployments, the Prometheus plugin pushes metrics to a Prometheus Push Gateway. This ensures all nodes’ metrics are captured regardless of load balancer routing.Configuration
Basic Auth Configuration
Setup
- UI
- Config File
- Navigate to Observability → Prometheus in the Bifrost UI
- The
/metricsendpoint is shown at the top for scraping configuration - To enable Push Gateway:
- Enter the Push Gateway URL
- Configure Job Name and Push Interval as needed
- Optionally set a custom Instance ID
- Enable Basic Authentication if required
- Toggle Enable Push Gateway on
- Click Save Prometheus Configuration
Available Metrics
The following metrics are available from both the/metrics endpoint and Push Gateway:
HTTP Metrics
The
path label contains the matched route template (e.g. /genai/v1beta/models/{model:*}, /v1/messages/batches/{batch_id}), not the raw URL path. This keeps metric cardinality bounded by the number of registered routes instead of growing with every model name or resource ID that appears in a URL. For per-model breakdowns, use the model and provider labels on the bifrost_* metrics.Bifrost LLM Metrics
Default Labels
Most request-level Bifrost LLM metrics include these labels (thebifrost_key_rotation_events_total counter is an exception — see Key Rotation Events below for its narrower label set):
provider- LLM provider namemodel- Model identifieralias- Alias resolved to this model (empty if none)method- Request type (chat, completion, embedding, etc.)virtual_key_id/virtual_key_name- Virtual key identifiersrouting_engine_used- Comma-separated list of routing engines that contributed to the decision (e.g.governance,routing-rule,loadbalancing,model-catalog,core).coreis emitted when the Bifrost orchestrator itself makes a routing decision — fallback transitions or retry transitions.routing_rule_id/routing_rule_name- Routing rule that matched the requestselected_key_id/selected_key_name- API key that successfully served the request (""when all attempts failed)fallback_index- Fallback positionteam_id/team_name- Team identifiers (empty when governance is not used)customer_id/customer_name- Customer identifiers (empty when governance is not used)
v1.5.0-prerelease4+:
selected_key_id / selected_key_name are only populated when the request succeeds. On final errors both are empty — use the attempt_trail log field to see which keys were tried.Key Rotation Events v1.5.0-prerelease4+
bifrost_key_rotation_events_total is incremented once per actual key rotation — i.e. when a per-key failure causes the next retry to switch to a different key. Rotation-triggering failures are bound to the specific key/account rather than the request:
429 Too Many Requests— this key is rate-limited; another may have capacity.401 Unauthorized/403 Forbidden— bad / revoked key, or key lacks permission.402 Payment Required— billing issue on this key’s account.
- terminal failures (no retry happens, including
max_retries = 0or every key permanently dead), - same-key retries on transient 5xx / network errors,
- non-retryable request-bound 4xx (400/404/422/…).
To inspect every attempted key on a failed request (including terminal failures that did not rotate), read the
attempt_trail field on the corresponding log entry instead.
Example queries:
Push Gateway Setup
If you don’t have a Push Gateway running, deploy one:Docker
Kubernetes (Helm)
Configure Prometheus to Scrape Push Gateway
Add to yourprometheus.yml:
The
honor_labels: true setting is important - it preserves the job and instance labels pushed by Bifrost instead of overwriting them with the Push Gateway’s labels.Pull vs Push: When to Use Each
Why Push for Clusters?
When multiple Bifrost instances run behind a load balancer:- Scraping randomness: Each scrape may hit different nodes, missing metrics from others
- Instance tracking: Push Gateway properly tracks per-instance metrics via
instancelabel - Aggregation: Downstream tools (Grafana, Datadog) can aggregate across all instances
Troubleshooting
Push Gateway Connection Failed
- Verify the Push Gateway URL is correct and reachable from Bifrost
- Check firewall rules between Bifrost and Push Gateway
- Ensure Push Gateway is running:
curl http://pushgateway:9091/metrics
Metrics Not Appearing
- Verify the telemetry plugin is enabled (required for metrics collection)
- Check Bifrost logs for push errors
- Verify Prometheus is scraping the Push Gateway with
honor_labels: true
Authentication Failed
- Double-check username and password
- Ensure basic auth is configured on the Push Gateway side
- Check for special characters that may need escaping

