TypeScript SDK

TypeScript — configuration

Every option can come from the constructor or the environment, and constructor values override environment variables. Two hooks — scrubber and beforeSend — let you mutate or drop events before they are enqueued.

Environment variables

Constructor values override these:

VariablePurpose
ROLLOUT_API_KEYWorkspace API key
ROLLOUT_BASE_URLIngest endpoint override
ROLLOUT_ENVIRONMENTDeployment environment, e.g. production
ROLLOUT_RELEASEApp version or git SHA
ROLLOUT_SERVICE_NAMEService identifier
ROLLOUT_AGENT_NAMEAgent name
ROLLOUT_AGENT_IDAgent ID
ROLLOUT_AGENT_VERSIONAgent version
ROLLOUT_DEPLOYMENTDeployment slot or region
ROLLOUT_SAMPLE_RATETrace sample rate (0.0–1.0)
ROLLOUT_DEBUGVerbose logging (true/false)
ROLLOUT_DISABLEDDisable the SDK entirely (true/false)

Useful local options

config.ts
const rollout = new Rollout({  apiKey: "rl_...",  syncMode: true,                // send inline; tests / debugging only  debug: true,  beforeSend(event) {    return event.event_type === "debug.noise" ? null : event;  },  scrubber(event) {    return event;  },});

Tip

syncMode: true sends events inline in the calling thread, which makes tests deterministic. Leave it off in production so the background batcher does the work.

scrubber & beforeSend

Both hooks run before an event is enqueued, and scrubber runs before beforeSend. Use scrubber to redact or strip fields on every event, and beforeSend to mutate an event or return null to drop it. The equivalent Python pipeline and PII defaults are documented under Privacy & redaction.