Configuration
All configuration options, environment variables, and defaults.
Every config field is optional. Set environment variables and the SDK reads them automatically.
Minimal setup
// Next.js — instrumentation.ts
import { init } from "@deeptracer/nextjs"
export const { register, onRequestError } = init()// Node.js / Express / Hono
import { init } from "@deeptracer/node"
const logger = init()That's it. The SDK reads DEEPTRACER_KEY and DEEPTRACER_ENDPOINT from your environment.
All options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | DEEPTRACER_KEY env var | Your DeepTracer API key (dt_xxx). |
endpoint | string | DEEPTRACER_ENDPOINT env var | Ingestion endpoint URL. |
service | string | "nextjs" / "server" / "web" | Service name for grouping events on the dashboard. |
environment | string | NODE_ENV or "production" | "production", "staging", "development", or any string. |
level | LogLevel | "info" (prod) / "debug" (dev) | Minimum log level to send. Logs below this are filtered. |
batchSize | number | 50 | Number of log entries per batch. |
flushIntervalMs | number | 5000 (200 on Vercel/Lambda) | Milliseconds between automatic batch flushes. |
release | string | Auto-detected | Deployment version. Used for source map resolution. |
debug | boolean | false | Mirror all log calls to the local console. |
maxBreadcrumbs | number | 20 | Max breadcrumb trail length for error reports. |
beforeSend | (event) => event | null | -- | Filter or modify events before sending. Return null to drop. |
waitUntil | (promise) => void | Auto on Vercel | Keep serverless functions alive for in-flight requests. |
Environment variables
Server packages (@deeptracer/node, @deeptracer/nextjs):
| Variable | Maps to |
|---|---|
DEEPTRACER_KEY | apiKey |
DEEPTRACER_ENDPOINT | endpoint |
DEEPTRACER_SERVICE | service |
DEEPTRACER_ENVIRONMENT | environment |
DEEPTRACER_LOG_LEVEL | level |
DEEPTRACER_RELEASE | release |
Client packages (@deeptracer/react, @deeptracer/browser, and @deeptracer/nextjs/client):
| Variable | Maps to |
|---|---|
NEXT_PUBLIC_DEEPTRACER_KEY | apiKey |
NEXT_PUBLIC_DEEPTRACER_ENDPOINT | endpoint |
NEXT_PUBLIC_DEEPTRACER_SERVICE | service |
NEXT_PUBLIC_DEEPTRACER_ENVIRONMENT | environment |
NEXT_PUBLIC_DEEPTRACER_LOG_LEVEL | level |
Priority
Explicit config values always win over environment variables, which win over defaults:
explicit config > env vars > defaultsNo-op mode
If apiKey or endpoint is missing, the SDK runs in no-op mode. All methods are safe to call -- they just don't send anything. Your app never crashes because of a missing API key.
const logger = init() // no key? no problem. methods still work.
logger.info("this is fine") // no error, no network requestThis means next build works in CI even without DeepTracer env vars. The SDK returns a silent no-op logger and your build succeeds.
Next.js-specific options
The init() function from @deeptracer/nextjs accepts these additional options:
| Option | Type | Default | Description |
|---|---|---|---|
captureGlobalErrors | boolean | true | Catch uncaught exceptions and unhandled rejections. |
captureConsole | boolean | false | Forward console.log/warn/error to DeepTracer. |
autoTracing | boolean | true | Consume Next.js OpenTelemetry spans and forward them to DeepTracer. |
tracePropagationTargets | (string | RegExp)[] | All URLs | Restrict which outgoing fetch URLs receive traceparent headers. |
import { init } from "@deeptracer/nextjs"
export const { register, onRequestError } = init({
captureConsole: true,
tracePropagationTargets: [
"https://api.myapp.com",
/^https:\/\/.*\.internal\.myapp\.com/,
],
})Release auto-detection
The release field is auto-detected from platform environment variables, in this order:
DEEPTRACER_RELEASEVERCEL_GIT_COMMIT_SHARAILWAY_GIT_COMMIT_SHARENDER_GIT_COMMITFLY_IMAGE_REFGIT_COMMIT_SHACOMMIT_SHA
No config needed if you deploy to Vercel, Railway, Render, or Fly.