docs/deploy/observability.md

Observability

In the app

Most questions are answered without leaving Vocion: each chat turn's steps, tool calls, citations, tokens and cost; Activity for every run and fire; Observability (/dashboard/observability) for cost and latency. See Runs and evidence.

Spend

Every model call is written to one ledger with what it cost and who it was for: the workspace, agent, person, run, conversation, feature and model. Observability → Spend groups it any of those ways over a period.

Over the API, GET /api/v1/spend?group_by=agent&period=30d returns the same rows (group_by: workspace, agent, user, feature, model, run, conversation, day). Use period (today, 7d, 30d, 90d) or from and to, and filter with agent, user, feature, model, run_kind, run_id or conversation. Amounts are in micro-cents. It needs the manage_sources capability, and a token reads only its own workspace.

Langfuse

Langfuse records every model call — prompt, completion, tokens, cost, latency — tagged by feature, workspace and agent, so one model invoice becomes per-workspace, per-agent spend.

LANGFUSE_ENABLEDBehavior
falseOff
trueOn; missing keys fail at boot
unsetOn when keys are present; in production, off when they're missing

Set LANGFUSE_BASE_URL, LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY (and LANGFUSE_PROJECT_ID for links). Traces older than LANGFUSE_RETENTION_DAYS (365) are deleted by a daily job, which needs the schedule owner running.

  • Local: npm run dev:up starts Langfuse at http://localhost:3200.
  • vocion-stack: doesn't self-host Langfuse. Use Langfuse Cloud (keys in the app secret) or set LANGFUSE_ENABLED=false.
  • Older single-host path: self-hosts Langfuse on the host by default; LANGFUSE_SELF_HOSTED_REPLICAS=0 opts out.

Check a setup with npm run langfuse:smoke --workspace @vocion/core.

Errors and logs

  • Sentry: NEXT_PUBLIC_SENTRY_DSN.
  • Logs: LogTape to stdout; Better Stack with NEXT_PUBLIC_BETTER_STACK_SOURCE_TOKEN and NEXT_PUBLIC_BETTER_STACK_INGESTING_HOST.
  • On vocion-stack: the deploy log is /var/log/vocion-deploy-last.log on the host; ALB, WAF and VPC flow logs are kept 90 days; alarms go to alarm_emails.