4.1 KiB
4.1 KiB
Observability Signals
This document describes runtime observability emitted by Agent Orchestrator.
Goals
- Structured, low-noise telemetry for session lifecycle and operator workflows.
- Correlated traces across core services, API routes, SSE, and websocket terminal health.
- Clear failure reasons and current health surfaces for fast diagnosis.
Emission Model
- Structured logs: JSON lines on stderr when enabled by config or
AO_OBSERVABILITY_STDERR.- Supported levels:
debug,info,warn,error. - Default level:
warn(production-safe, avoids high-volume info logs). - Default stderr mirroring: disabled.
- Runtime env vars override YAML:
AO_LOG_LEVEL=infoAO_OBSERVABILITY_STDERR=1
- Supported levels:
- Durable snapshots: process-local JSON snapshots under:
~/.agent-orchestrator/{config-hash}-observability/processes/*.json
- Aggregated view: merged by project via:
GET /api/observability
Correlation
- API routes accept
x-correlation-id; when absent, AO generates one. - Responses include
x-correlation-idfor traceability from UI or CLI. - SSE snapshots include
correlationIdandemittedAt.
Metrics
Counters are emitted per project and operation:
spawn(session.spawn)restore(session.restore)kill(session.kill)claim_pr(session.claim_pr)cleanup(session.cleanup)send(session.send)lifecycle_poll(lifecycle.poll,lifecycle.transition)lifecycle_poll(lifecycle.merge_cleanup.completed) — auto-cleanup ran after a PR was detected as merged; session runtime + worktree + metadata were torn downlifecycle_poll(lifecycle.merge_cleanup.deferred) — auto-cleanup is waiting for the agent to idle (or for themergeCleanupIdleGraceMswindow to elapse) before tearing downlifecycle_poll(lifecycle.merge_cleanup.failed) — auto-cleanup threw duringsessionManager.kill(); the session stays inmergedso the next poll retriesnotification_delivery(notification.deliver) — per-target notifier dispatch success/failure, with event ID/type, priority, project/session IDs, target reference, plugin name, and delivery methodapi_request(web API routes)sse_connect,sse_snapshot,sse_disconnectwebsocket_connect,websocket_disconnect,websocket_error(websocket servers)
Each metric counter tracks:
total,success,failurelastAt,lastSuccessAt,lastFailureAtlastFailureReason
Trace Fields
Recent traces keep operation-level diagnostics:
idtimestampcomponentoperationoutcomecorrelationIdprojectIdsessionIdpathreasondurationMsdata
Health Surfaces
Health records provide current status and failure context per surface:
surface(for example:lifecycle.worker,sse.events)status(ok,warn,error)updatedAtcomponentprojectIdcorrelationIdreasondetails
Operator-Facing Diagnostics
- Dashboard: use Copy debug info in the hero toolbar (desktop) to copy
/api/observabilityplus page URL, project scope, and correlation id to the clipboard for issue reports. The observability banner shows overall status, SSE stream state, last correlation id, and latest failure reason. - API:
/api/observabilityreturns merged per-project diagnostics (overallStatus, metrics, health, recent traces, session state). - Terminal websocket health:
/healthendpoints include active sessions and websocket/terminal health counters with last error/disconnect reasons. - Notifications: successful deliveries update
notification_deliverymetrics and per-target health; failed/missing targets also appear inao events.
Rollout Notes
- Deploy with default
observability.logLevel: warnandobservability.stderr: falseto avoid noisy logs. - Validate
/api/observabilityand dashboard banner in a canary environment. - If deeper triage is needed, temporarily raise
AO_LOG_LEVEL=info(ordebug) and setAO_OBSERVABILITY_STDERR=1, then revert to defaults. - Monitor
lastFailureReasonand surface-levelreasonfields before enabling broader rollout.