Observability: logs, deliveries, executions
Everything an operator needs lands in a small set of queryable tables. There is no external telemetry service: public.logs is the unified sink, and the logs, observability, deliveries, and pipeline-executions functions are the read APIs over it.
What gets written, and where
public.logs holds three overlapping kinds of rows:
- Audit/log events —
emitLog,emitAudit, andemitActivityin_shared/audit.tsinsert business events (trigger.fired,pipeline.completed,integration.outbound.failed_http,api_key.created,registration.completed, …) with actor, target, and details. - Spans —
emitSpanwrites trace spans (span_name,trace_id,span_id,parent_span_id,duration_ms,outcome)._shared/tracing.tsimplements W3Ctraceparentparsing/formatting, andtraceDbwraps the request's DB client so every query emits adb.<operation>span — a singletrace_idstitches the request, its queries, and the pipeline stages it caused. - Operation logs —
logAdminDataOperationin_shared/logging.tswrites admin-data CRUD records, gated by resolved log levels.
Log levels are 'off' | 'timing' | 'warnings' | 'errors' | 'all', resolved per request from system_settings rows (key='logging', global plus scoped overrides); the default is ['timing', 'errors']. Under the default, errors and timing rows are written; warnings-level and all-level verbosity require opt-in settings. A request's x-log-level header can raise verbosity for that call.
Reading logs
logs (.framework/functions/logs.ts) is system-admin oriented (system admins query with the service client across accounts; account members get their RLS-scoped view):
action=account/action=target/action=person— filtered lists.action=search—ILIKEmessage search.action=stats— calls theget_log_statsRPC (totals, error count, distinct levels/sources). Note: since migration069, when nop_date_fromis passed the window defaults to the last 7 days — a call that omits the date range returns 7-day stats, not all-time stats.action=cleanup— deletes rows older thandays_to_keep(default 30).system-cronalso runscleanup_old_logson the 00:00 UTC tick, so retention is enforced continuously.
observability (.framework/functions/observability.ts) aggregates the same rows into dashboard metrics — actions event_volume, error_rate, latency_percentiles, pipeline_stats, top_actors, ai_support_metrics, cleanup — scoped to the caller's account unless the principal is system-admin.
Executions and deliveries
Two sibling tables answer "did it run / did it arrive":
public.pipeline_executions— one row per pipeline run withstatus(queued→running→completed/failed/cancelled), per-stage results,error_message,duration_ms, and thetrigger_datathat caused it (.framework/functions/pipeline-executions.ts;action=running,action=stats,action=cleanup). Rows that never reach a terminal state are swept tofailedafter 10 minutes.public.webhook_deliveries— one row per inbound/outbound webhook attempt withdirection,status(pending/processing/delivered/failed),attempt_count,next_attempt_at,last_error,response_status, andresponse_body(.framework/functions/deliveries.ts;action=retry).
item-progress (.framework/functions/item-progress.ts) is a different lens: per-person, per-item progress rows (status, score, attempts) that follow the type's design_schema.pipeline stage list (default not_started → in_progress → completed). Transitions must move forward unless force: true is passed; started_at/completed_at are stamped on first entry. Use it when you need per-user completion state rather than execution forensics.
Debugging a failed automation
Work backwards through the tables:
pipeline_executions— find the run.status: 'failed'+error_messageand per-stage results name the failing stage.status: 'queued'past 10 minutes = dispatch never arrived (sweeper will mark it failed);status: 'running'stuck = the runner died (same sweeper).logs— search bytrace_id(from the request) orspan_name(pipeline.run,pipeline.stage.<handler>,db.<operation>); audit rowstrigger.fired/trigger.failed/pipeline.completed/pipeline.failedbracket the run. Check log levels if expectedtimingrows are absent.webhook_deliveries— for outbound stages/integrations, the delivery row carriesresponse_status,response_body,last_error, andnext_attempt_at; retry withaction=retry.api_key_usage_logs(api-keys?action=usage-logs) — whether the machine caller ever arrived, and from where.observabilityactions — confirm the blast radius (error_rate,pipeline_stats,top_actors) rather than chasing a single event.