Skip to content

Tracing is gated and time-boxed

Accepted. Built for functions; the same gate semantics are reused by ingestion tracing.

2026-10-21.

Functions are first-party code that handles business requests. When one misbehaves, the author needs to see what it was asked, what it answered and what it decided, for one business key such as an order number. Always-on capture of that is the wrong default. Bodies and log lines contain sensitive data, volume is unbounded and a forgotten debug flag becomes a standing cost and a standing leak.

The ordinary log pipeline stays as it is. This decision is about a second, deliberate channel for diagnosis.

Trace capture is gated, never always-on, and time-boxed.

  • Grain is (function, context). A context is a name. A function declares its own in its describe document; one built-in context, http, records each invocation’s request, response, timing, outcome and the log lines printed during it.
  • Nothing is stored unless an operator switched a context on. Enabling sets an expiry. A declared context is capped (60 minutes by default); http has a lower cap (15 minutes) because bodies are sensitive. A declared context can be left on until switched off only with a separate permission, and that still has a hard ceiling in days. http never can.
  • The gate is compared when read, against the clock, so expiry needs no scheduled job.
  • Sampling captures one invocation in N, decided once per invocation so a captured call is captured whole.
  • A business key (reference) and the request’s correlation id are stored with every record, so “everything about trip X” is the main query.
  • Tracing never affects the call. Records are queued in the runner and shipped in batches whatever the outcome. The queue is bounded, overflow drops the oldest and counts them, and a trace call for a context that is not live is a silent no-op.
  • Four permissions: manage (switch on and off), view (metadata, and for http the method, path without query, status, timings, sizes), view-bodies (headers, queries, bodies, log lines and author data; also required to enable http) and indefinite. The general viewer role does not hold view.
  • Credentials are redacted from captured headers and query strings by name pattern before storage.
  • Retention is 30 days, measured from the platform’s own timestamp and pruned in chunks.
  • Enabling and disabling are audited use cases, and a toggle wakes the runners’ desired-state poll so it takes effect in about a second.

Out of scope for the first version: a per-client filter, live push to the console (it polls) and table partitioning.

Good:

  • The cost and exposure of tracing are bounded by construction: a window that expires by itself, a sampling rate, a body size limit and a retention period.
  • Authors can add trace calls freely, because they are cheap when off.
  • Who turned tracing on, and when, is in the audit log.

Bad:

  • A problem that happened before someone switched tracing on cannot be investigated from trace records. The ordinary logs are the only record.
  • A runner that predates the trace operations answers “unknown operation”, which SDKs treat as not tracing. Older runners silently capture nothing.
  • The rate cap is per platform process, so it bounds a runaway but is not a quota.
Alternative Why not
Always-on capture with short retention Stores sensitive bodies for every call, and cost scales with traffic.
A log level switch on the function No business key, no body capture, no expiry, and it mixes diagnosis with the main log pipeline.
Indefinite windows for everything Forgotten switches become permanent capture. Kept only for declared contexts, behind a permission and a ceiling.