Runtime recorder

An optional add-on for Node and Bun that attaches recent function arguments, return values, and call history to an error — not just the stack trace. Errors still report if you skip this.

How it works

While a request or job runs, Rasputin can watch the functions your code calls and keep a short record of what they received and returned. If that work throws, the record is attached to the error.

To watch those calls, Rasputin has to wrap your functions so it can observe them. That wrapping is called instrumentation. Without it, there is nothing for the recorder to collect.

You usually enable this with automatic instrumentation: after you compile, run rasputin-instrument on the output, then start the process as usual. If you run TypeScript directly, start with bun --preload … or node --import … instead. You do not hand-wrap every function. Some runtimes and bundles cannot use that — check Compatibility first. If automatic instrumentation is unavailable, Setup shows how to mark functions manually.

What you need to set up

Setup is two pieces that work together:

1. Instrument functions

Turn on automatic instrumentation (or mark functions yourself) so Rasputin can observe calls. In production, instrument compiled output with rasputin-instrument.

2. Scope an execution

Group those calls under one request, job, or task with execution.createScope(). Recorded state is only kept inside an active execution and attached if it throws.

Where to go next

  1. Compatibility — confirm your runtime and build support automatic instrumentation.
  2. Setup — turn on instrumentation, scope executions, and optionally tune configuration.