managarten/services/mana-ai/src
Till JS 1d3794f96c feat(mana-ai): Prometheus metrics for tool-calls, loop rounds, provider errors
Three new counters + one histogram fill the observability gap from
the function-calling migration:

- mana_ai_tool_calls_total{tool, policy, outcome} — one tick per
  tool_call the planner produced. `outcome` is `deferred` on the
  server (stub onToolCall records for later client execution);
  webapp runner will emit success/failure once it grows its own
  Prom surface.
- mana_ai_planner_rounds (histogram, buckets 1..5) — distribution of
  rounds consumed per iteration. Runs close to the cap signal a
  planner struggling with the mission objective.
- mana_ai_provider_errors_total{provider, kind} — structured errors
  surfaced from mana-llm. Kind mirrors the ProviderError hierarchy
  added in commit 1 of the migration (blocked/truncated/auth/
  rate_limit/capability/unknown).

Plumbing:
- llm-client.ts parses mana-llm's `{detail: {kind, message}}` 4xx/5xx
  body shape and re-throws as ProviderCallError carrying the kind.
- tick.ts observes metrics at the natural emission points — rounds
  + per-call counter after runPlannerLoop returns, provider_errors
  in the catch block.

Grafana dashboards + status.mana.how already pick up the
collectDefaultMetrics prefix, so these metrics land in the existing
mana-ai panel without scraper changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 20:48:29 +02:00
..
cron feat(mana-ai): Prometheus metrics for tool-calls, loop rounds, provider errors 2026-04-20 20:48:29 +02:00
crypto feat(mana-ai): encrypted resolver + tick uses Mission Grant to decrypt scoped inputs 2026-04-15 13:42:31 +02:00
db docs: update architecture comparison — 5/10 roadmap items done 2026-04-16 15:00:09 +02:00
middleware feat(mana-ai): scaffold server-side Mission Runner (v0.1) 2026-04-14 23:48:30 +02:00
planner feat(mana-ai): Prometheus metrics for tool-calls, loop rounds, provider errors 2026-04-20 20:48:29 +02:00
config.ts feat(ai-tools): server-side web-research + contacts for agents 2026-04-16 12:25:45 +02:00
index.ts feat(ai): Mission Grant consent UI + Workbench audit tab 2026-04-15 13:53:11 +02:00
metrics.ts feat(mana-ai): Prometheus metrics for tool-calls, loop rounds, provider errors 2026-04-20 20:48:29 +02:00
tracing.ts feat(mana-ai): OpenTelemetry tracing + Grafana Tempo backend 2026-04-16 15:21:23 +02:00