Skip to main content

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 to initialize(). Most apps wire these two variables to the SDK options: Set them in .env.local (Next.js), a .env file, or your shell:
Add the line to ~/.zshrc or ~/.bashrc to persist it across terminal sessions.
On Vercel and other hosts, add 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. Call flush() 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.