Skip to content

Monitoring ​

Dashboard ​

The Overview and Activity pages show the last 24 hours on the running pod. To keep history across restarts and see 7 and 30 days, see Usage history with Prometheus.

Prometheus metrics ​

Scrape http://valetkey.valetkey-system:8081/metrics, or enable the chart's serviceMonitor if you use the Prometheus Operator. A ready-made Grafana dashboard ships with the chart (grafanaDashboard.enabled), see Usage history.

MetricTypeLabels
valetkey_requests_totalCounterprovider, model, tenant, proxykey_ns, proxykey_name, status_code
valetkey_tokens_totalCounterprovider, model, tenant, type
valetkey_errors_totalCounterprovider, model, tenant, error_type
valetkey_rate_limited_totalCountertenant, tier
valetkey_request_duration_secondsHistogramprovider, model
valetkey_ttfb_secondsHistogramprovider, model
valetkey_upstream_duration_secondsHistogramprovider, model
valetkey_retries_totalCounterprovider
valetkey_provider_errors_totalCounterprovider
valetkey_keys_minted_totalCountertenant
valetkey_cost_usd_totalCounterprovider, model, tenant, proxykey_ns, proxykey_name
valetkey_budget_spent_usdGaugescope (key, tenant), name
valetkey_budget_usdGaugescope, name
valetkey_budget_rejections_totalCountertenant, scope
valetkey_pricing_fetched_timestamp_secondsGauge
valetkey_pricing_source_upGaugesource
valetkey_providers_activeGaugetype
valetkey_proxykeys_activeGaugetenant

Plus the standard Go and process metrics.

Example queries ​

promql
# Tokens per tenant over the last day
sum by (tenant) (increase(valetkey_tokens_total[1d]))

# Error rate per provider
sum by (provider) (rate(valetkey_requests_total{status_code=~"5.."}[5m]))
  / sum by (provider) (rate(valetkey_requests_total[5m]))

Alerts ​

With the Prometheus Operator, prometheusRule.enabled: true adds these alerts:

AlertWhen
ValetkeyBudgetAlmostUsedA key or tenant has used more than 80% of its budget
ValetkeyBudgetReachedRequests were refused because a budget is used up
ValetkeyHighErrorRateMore than 10% of requests fail with a 5xx for 10 minutes
ValetkeyProviderFailingA provider failed more than 20 times in 10 minutes
ValetkeyPricesStalePrices haven't been refreshed for a day
ValetkeyDownPrometheus can't scrape Valetkey

Without Prometheus, budgets still raise Kubernetes Events on the key or tenant (BudgetAlmostUsed at 80%, BudgetReached when used up):

bash
kubectl get events -A --field-selector reason=BudgetReached

Health ​

  • GET /healthz: the process is up.
  • GET /readyz: returns 503 until Valetkey has loaded every provider, tenant and key, so no traffic arrives before it can route.

Kubernetes status ​

Every resource reports a Ready condition:

bash
kubectl get prov,tn -n valetkey-system
kubectl get pkey -A

Released under the ISC License.