# Observability and tracing

Read structured errors, durable audit records and Cloudflare spans as separate signals.

## Application errors and logs [#application-errors-and-logs]

The web middleware integrates evlog. Shared error codes and localized messages come from `packages/errors`; its server handler logs unexpected failures while the client resolver returns a safe user message. During development, inspect `.evlog/logs/` when available. Do not copy credentials, prompts or private payloads into logs.

An Audit Event is a durable domain record, not a log line. The Audit Log is the admin table; an Activity Timeline is one User's security history. Release notes belong to the public [changelog](/docs/changelog).

## Worker traces [#worker-traces]

Wrangler enables observability and traces. The scheduled handler passes `ctx.tracing` into `runScheduledJobs`; `workersTracer` adapts Effect spans to Cloudflare spans. It records scalar attributes, failures and interruption.

The native API cannot assign an explicit parent to each Effect span. Those spans appear as siblings under `jobs.scheduled`, alongside platform fetch and Hyperdrive spans. Node execution runs without this tracer. Local successful jobs do not prove that production custom spans are visible in the Cloudflare dashboard.

## Diagnose a failure [#diagnose-a-failure]

Trace the entry point, transport result and durable row together. For an import, inspect its state and persisted failure reason before assuming the queue lost it. For a webhook, inspect the delivery lease and next attempt. For a client error, keep the stable error code and correlation context rather than exposing an exception message.

Bundle and fault experiments are recorded in `docs/measurements`. Their local timings are not production latency or billing measurements. Add a dated report when changing runtime ownership, deadlines or a heavy dependency.


## Key files [#key-files]

- [`packages/errors/src/server.ts`](https://github.com/CarlosZiegler/doro/blob/main/packages/errors/src/server.ts)
- [`packages/api/src/lib/tracer.ts`](https://github.com/CarlosZiegler/doro/blob/main/packages/api/src/lib/tracer.ts)
- [`packages/db/src/audit.ts`](https://github.com/CarlosZiegler/doro/blob/main/packages/db/src/audit.ts)
- [`apps/web/wrangler.jsonc`](https://github.com/CarlosZiegler/doro/blob/main/apps/web/wrangler.jsonc)

