ff.withTrace() wraps that work so all the calls inside share one trace_id and a parent row lands in firstflow_traces.
Options
string
Human-readable label for the operation, stored on the trace.
string
The user the operation belongs to.
Record<string, unknown>
Arbitrary tags stored on the trace row.
unknown
Optional snapshot of the operation’s inputs.
string
Provide an explicit id to correlate with an upstream request; otherwise one is
generated.
ff.newTraceId() mints one ahead of time.How it works
withTrace uses AsyncLocalStorage to make the trace id ambient: any wrapped call inside the callback picks it up automatically you don’t thread it through. On completion it records the parent trace (latency = wall-clock of the whole operation); if the callback throws, the trace is recorded with is_error and the message, then the error re-throws.