SDK API
Options
Python takes the same options, snake_cased (api_key, base_url, app_name, disable_batch, and instrument_http, the Python name for instrumentFetch, covering raw requests/httpx); instrumentModules is Node-only.
Environment variables
The SDK reads only what you pass toinitialize(). Most apps wire these two variables to the SDK options:
Set them in
.env.local (Next.js), a .env file, or your shell:
- macOS / Linux
- Windows (PowerShell)
- Windows (cmd)
~/.zshrc or ~/.bashrc to persist it across terminal sessions.BELVEDIR_API_KEY under the project’s environment variables and redeploy. Inside a benchmark run the variables are preset; pass them to initialize() like any other.
Flush on serverless
Spans export in batches on a background thread. A serverless function, script, or queue job can exit before the batch ships, so spans appear locally but never in production. Callflush() before the process or handler returns: in Node, await flush() (the promise is abandoned with the batch if you don’t await it); in Python, flush() is synchronous and returns once the export has completed. flush() never throws, and it silently no-ops in a process where initialize() never ran, so a missing flush and a missing initialize() look the same: no spans, no error. For local testing, disableBatch: true exports each span immediately instead.