DeepTracer
SDK Reference

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

OptionTypeDefaultDescription
apiKeystringDEEPTRACER_KEY env varYour DeepTracer API key (dt_xxx).
endpointstringDEEPTRACER_ENDPOINT env varIngestion endpoint URL.
servicestring"nextjs" / "server" / "web"Service name for grouping events on the dashboard.
environmentstringNODE_ENV or "production""production", "staging", "development", or any string.
levelLogLevel"info" (prod) / "debug" (dev)Minimum log level to send. Logs below this are filtered.
batchSizenumber50Number of log entries per batch.
flushIntervalMsnumber5000 (200 on Vercel/Lambda)Milliseconds between automatic batch flushes.
releasestringAuto-detectedDeployment version. Used for source map resolution.
debugbooleanfalseMirror all log calls to the local console.
maxBreadcrumbsnumber20Max breadcrumb trail length for error reports.
beforeSend(event) => event | null--Filter or modify events before sending. Return null to drop.
waitUntil(promise) => voidAuto on VercelKeep serverless functions alive for in-flight requests.

Environment variables

Server packages (@deeptracer/node, @deeptracer/nextjs):

VariableMaps to
DEEPTRACER_KEYapiKey
DEEPTRACER_ENDPOINTendpoint
DEEPTRACER_SERVICEservice
DEEPTRACER_ENVIRONMENTenvironment
DEEPTRACER_LOG_LEVELlevel
DEEPTRACER_RELEASErelease

Client packages (@deeptracer/react, @deeptracer/browser, and @deeptracer/nextjs/client):

VariableMaps to
NEXT_PUBLIC_DEEPTRACER_KEYapiKey
NEXT_PUBLIC_DEEPTRACER_ENDPOINTendpoint
NEXT_PUBLIC_DEEPTRACER_SERVICEservice
NEXT_PUBLIC_DEEPTRACER_ENVIRONMENTenvironment
NEXT_PUBLIC_DEEPTRACER_LOG_LEVELlevel

Priority

Explicit config values always win over environment variables, which win over defaults:

explicit config > env vars > defaults

No-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 request

This 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:

OptionTypeDefaultDescription
captureGlobalErrorsbooleantrueCatch uncaught exceptions and unhandled rejections.
captureConsolebooleanfalseForward console.log/warn/error to DeepTracer.
autoTracingbooleantrueConsume Next.js OpenTelemetry spans and forward them to DeepTracer.
tracePropagationTargets(string | RegExp)[]All URLsRestrict 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:

  1. DEEPTRACER_RELEASE
  2. VERCEL_GIT_COMMIT_SHA
  3. RAILWAY_GIT_COMMIT_SHA
  4. RENDER_GIT_COMMIT
  5. FLY_IMAGE_REF
  6. GIT_COMMIT_SHA
  7. COMMIT_SHA

No config needed if you deploy to Vercel, Railway, Render, or Fly.

On this page