Metrics for Prometheus and Grafana
Built Octryx AI serves Prometheus metrics at/metrics, counted in the process at the moment something happens. Metrics never come from database queries.This page is about Octryx AI's own metrics. For agents reading your Grafana, Prometheus and Loki, see Grafana, Prometheus and Loki.
The metrics
The agent metrics are called octryx_*:
| Metric | Content |
|---|---|
octryx_llm_requests_total, octryx_llm_request_duration_seconds | LLM requests and duration per provider and model, outcome ok, error, timeout, cancelled |
octryx_llm_tokens_total, octryx_llm_cost_usd_total | tokens (input, output, cache_read, cache_write) and cost per model |
octryx_agent_turns_total | agent turns per agent (agent, workflow or client) and outcome |
octryx_agent_sessions_started_total, octryx_agent_sessions | sessions started (main agent or sub-agent), open sessions per status |
octryx_tool_calls_total, octryx_tool_call_duration_seconds | tool calls per tool and status, duration |
octryx_workflow_runs_started_total, octryx_workflow_runs_finished_total, octryx_workflow_run_duration_seconds, octryx_workflow_runs | workflow runs per workflow and Workspace (by name), duration, open runs |
octryx_approvals_requested_total, octryx_approvals_decided_total, octryx_approval_wait_seconds, octryx_approvals_pending | approvals: requested, decided, wait time, pending |
What is committed is counted. The counters live in the process and start at 0 after a restart, which rate() and increase() handle correctly. No label contains a run, session or user id. A metric keeps at most 500 label combinations; more count under other.
Access
Prometheus presents a token as a bearer token: the key METRICS_SCRAPE_TOKEN in the Secret, e.g. --from-literal=METRICS_SCRAPE_TOKEN="$(openssl rand -hex 32)". Without a token, only a signed-in user can read /metrics.
Internal listener (private network only)
With OCTRYX_METRICS_PORT set, the api and the worker each also serve /metrics on that port without any credential, for a Prometheus in the same private network (a local compose stack). Open that port only to the private network and never publish it (compose: no ports: entry). If the api and the worker share a network namespace, give them different ports. With several api processes (OCTRYX_API_WORKERS > 1) the api listener stays off. Unset (the default), nothing changes.
Scrape
With the Prometheus Operator, in my-values.yaml:
metrics:
serviceMonitor:
enabled: true
labels: {release: kube-prometheus-stack} # the labels your Prometheus selects ServiceMonitors byIf a separate worker process runs (python -m app.worker_main), it serves its counters on its health port (OCTRYX_WORKER_HEALTH_PORT, default 8001) at /metrics, with the same token. Prometheus then scrapes both. The gauges (octryx_agent_sessions, octryx_workflow_runs, octryx_approvals_pending) come from the api only, so a sum() over both stays right.
Dashboard
Import deployment/grafana/octryx-agents.json in Grafana (Dashboards → Import) and choose the Prometheus data source. It shows overview, LLM, agents, tools, workflow runs and approvals, with filters for model and Workspace.
