Edge runtimes
Import from @mv37/rollout/edge for request-scoped runtimes such as Vercel Edge and Cloudflare Workers:
import { Rollout } from "@mv37/rollout/edge";const rollout = new Rollout({ apiKey: process.env.ROLLOUT_API_KEY });await rollout.trace("request", async () => { // work});await rollout.flush();Note
The edge build uses a fallback stack-based context manager and does not promise arbitrary async context propagation. Keep the traced work inside the trace() callback.
Flush per request
There is no background worker draining a queue between requests on the edge, so call flush() before the request handler returns to make sure events are sent. See Lifecycle & shutdown for the batching model in long-lived Node apps.
Browser mode
Heads up
@mv37/rollout/browser is disabled by default. Rollout workspace API keys must not be exposed in browser bundles — instrument from the server (a route handler, an edge function) instead of the client.