Monitoring
Structured Logging
Section titled “Structured Logging”All agents emit structured JSON logs via console.log() and console.error():
{ "agent": "LogTailerAgent", "event": "poll_completed", "timestamp": "2026-02-20T10:00:30Z", "eventsProcessed": 15, "newIncidents": 2, "serviceName": "my-worker"}These logs are visible in the Cloudflare dashboard under Workers → Logs with full-text search.
Workers Observability
Section titled “Workers Observability”Sentinel runs with full observability enabled:
- Invocation logs — every Worker invocation is logged
- Traces — distributed traces across agent invocations
- Head sampling rate: 1 — 100% of requests are sampled
View in the Cloudflare dashboard: Workers & Pages → sentinel → Logs/Traces.
Orchestrator API Endpoints
Section titled “Orchestrator API Endpoints”Health Check
Section titled “Health Check”curl https://sentinel.example.com/api/healthReturns { "status": "ok" } when the Orchestrator is running.
Statistics
Section titled “Statistics”curl https://sentinel.example.com/api/statsReturns counts by incident status:
{ "stats": [ { "status": "detected", "count": 5 }, { "status": "test_generating", "count": 1 }, { "status": "fixing", "count": 2 }, { "status": "resolved", "count": 15 }, { "status": "needs_human", "count": 3 } ]}Incident Listing
Section titled “Incident Listing”curl 'https://sentinel.example.com/api/incidents?status=needs_human'Filter incidents that require human attention.
LLM Cost Tracking
Section titled “LLM Cost Tracking”Every LLM call is recorded in the llm_calls D1 table with:
- Model name and provider
- Token counts (prompt, completion, total)
- Latency in milliseconds
- Cache hit status (when AI Gateway is enabled)
Query directly via D1 console:
SELECT model, provider, SUM(total_tokens) as total_tokens, AVG(latency_ms) as avg_latency_ms, COUNT(*) as callsFROM llm_callsGROUP BY model, provider;Agent Run Audit
Section titled “Agent Run Audit”The agent_runs table tracks every agent execution:
SELECT agent_type, status, COUNT(*) as count, AVG(duration_ms) as avg_duration_msFROM agent_runsWHERE started_at > datetime('now', '-24 hours')GROUP BY agent_type, status;Dead Letter Queue
Section titled “Dead Letter Queue”Failed messages appear in sentinel-dlq. The DLQ handler logs them to console.error with full message body, timestamp, and retry count.
Monitor DLQ activity in the Cloudflare dashboard under Queues → sentinel-dlq.