Expand description
Observability - opt-in, local-first structured event logging and secret-safe protocol redaction.
Feedback 03 “Observability” contract: no invasive telemetry by default.
This module is disabled by default: EventLog::from_env returns a
no-op log unless AUTH_CLOUDFLARE_OBSERVABILITY=1. When enabled, events
are appended as one JSON object per line (JSONL) to a local file - never
shipped anywhere, never read back by this crate.
§Privacy invariants (binding)
- The standard event log never stores prompt content or full tool
output.
Eventcarries only request metadata (model id, counts, latency, cost estimate, trace id) - no user text, no secrets. redactis the shared scrubber for any text that might reach a developer log: it removesAuthorizationheaders,Bearertokens,cfut_/cfwt_token prefixes,cookievalues, andENV_VAR=value-style substrings.debug_protocol_enabledgates an explicit developer-only mode (AUTH_CLOUDFLARE_DEBUG_PROTOCOL=1). That mode only enables sanitized protocol traces - every trace must still pass throughredactsoAuthorization,Bearertokens, cookies, env-var values, known token prefixes, and private file contents never reach the log.
Structs§
- Event
- One structured observability event, serialized as a single snake_case JSON line.
- Event
Log - Local JSONL event log. Disabled (no-op) unless explicitly enabled.
Constants§
- DEBUG_
PROTOCOL_ ENV - Enables sanitized protocol traces when set to the exact value
"1". - EVENT_
LOG_ ENV - Overrides the event-log file path when set.
- OBSERVABILITY_
ENV - Enables the local event log when set to the exact value
"1".
Functions§
- debug_
protocol_ enabled - True when
AUTH_CLOUDFLARE_DEBUG_PROTOCOLis exactly"1"- the developer-only gate for sanitized protocol traces. Any other value (including"true","0", or unset) isfalse. - redact
- Scrub secret-bearing text for a developer log or protocol trace.