DebugBundle
SDKs

Universal SDK Interface

The complete interface contract shared by every DebugBundle SDK — methods, config fields, behavior guarantees, and volume controls.

Every DebugBundle SDK implements this universal interface contract. Language-specific naming conventions differ (camelCase for JavaScript/PHP/Java/Kotlin/Swift, PascalCase methods for Go, snake_case for Python/Ruby), but the semantics, behavior guarantees, and volume control rules are identical.

Core Methods

Every SDK exposes these methods:

MethodPurposeReturns
init(config)Initialize the SDK with configuration. Must be called once before any capture.void
captureException(error, context?)Capture an error/exception with optional context.void
captureLog(message, level, context?)Capture a structured log event.void
captureRequest(request, response, context?)Capture an HTTP request/response pair.void
captureMessage(message, level?, context?)Capture a diagnostic message.void
setContext(key, value)Attach persistent context to all future events.void
probe(label, data, opts?)Buffer diagnostic data in a ring buffer.void
flush()Force-send all buffered events.Promise<void>

Language Naming Conventions

LanguageStyleExample
Node.jscamelCasedebugbundle.captureException(err)
BrowsercamelCasedebugbundle.captureException(err)
Pythonsnake_casedebugbundle.capture_exception(err)
PHPcamelCase (PSR)DebugBundle::captureException($e)
JavacamelCaseclient.captureException(error)
GoPascalCase methodsclient.CaptureException(ctx, err)
C# / .NETPascalCase methodsDebugBundle.CaptureException(error)
Rubysnake_caseDebugBundle.capture_exception(error)
AndroidKotlin camelCaseDebugBundle.captureException(error)
SwiftSwift camelCaseDebugBundle.captureException(error)
React NativecamelCaseDebugBundle.captureException(error)

Configuration Fields

All SDKs accept these common configuration fields:

FieldTypeDefaultDescription
projectTokenstringRequired. Project token for ingestion auth (dbundle_proj_...).
environmentstringauto-detectDeployment environment: production, staging, development, etc.
servicestringauto-detectService name for multi-service projects.
enabledbooleantrueKill switch — set to false to disable all capture.
redactFieldsstring[]Default setAdditional field names to redact before transmission.
sampleRatenumber1.0Event sampling rate (0.0–1.0). Applied per-event.
batchSizenumberSDK-specificMax events per batch (Node: 50, Browser: 25).
flushIntervalnumber (ms)SDK-specificMax time before batch send (Node: 2000, Browser: 3000).
endpointstringhttps://api.debugbundle.com/v1/eventsIngestion endpoint URL.
transportstringauto-detecthttp, file, or relay (browser only).
localEventsDirstring.debugbundle/local/eventsDirectory for file transport output.

Browser-Specific Fields

FieldTypeDefaultDescription
maxBreadcrumbsnumber10Ring buffer size for breadcrumbs.
breadcrumbsOnErrorOnlybooleantrueOnly ship breadcrumbs alongside exceptions.
captureNetworkbooleantrueCapture network request breadcrumbs.
captureClicksbooleantrueCapture click event breadcrumbs.
captureRouteChangesbooleantrueCapture navigation breadcrumbs.
captureConsolebooleanfalseCapture console.error/console.warn breadcrumbs.
networkFilterobjectFilter network breadcrumbs by URL, status code, response time.
sessionSampleRatenumber1.0Session-level sampling (all-or-nothing per session).
maxEventsPerSessionnumber100Hard cap per session; only exceptions permitted after cap.

Transport Modes

ModeSDKDescription
httpServer and mobile SDKsDirect HTTPS to ingestion API. Default for connected projects.
fileNode, Python, PHP, Java, .NET, Go, RubyWrite events to local filesystem for CLI processing. Default for local-only server projects.
offline queueAndroid, iOS, React NativeBounded app-private queue with platform-aware deferred flushing. Used for offline, background, and local/development paths.
relayBrowserSend events through your backend relay endpoint instead of directly to DebugBundle.

Transport is automatically selected based on your .debugbundle/local/connection.json mode:

  • Local-onlyfile transport (server SDKs), app-private offline queue (mobile SDKs), relay or http (browser)
  • Connectedhttp transport with SDK-specific buffering or offline retry

Event Envelope

Every captured event is wrapped in a standard envelope:

{
  "event_id": "evt_01HXYZ...",
  "event_type": "backend_exception",
  "timestamp": "2026-03-24T10:30:00.000Z",
  "service": { "name": "api-server", "environment": "production" },
  "sdk": { "name": "@debugbundle/sdk-node", "version": "1.0.0" },
  "context": { "user_id": "usr_123" },
  "payload": { /* event-type-specific data */ }
}

Backend Runtime Facts

Backend exception events include a payload.runtime object. Every backend SDK reports the runtime version; SDKs should also include safe process facts when the language exposes them without reading environment variables or secrets.

FieldMeaning
platform, archOperating system and CPU architecture.
pid, cwd, uptime_sec, hostnameProcess identity and lifetime context.
memoryBest-effort runtime memory stats when available.
framework_version, framework_extrasBest-effort framework-specific context.

Current shipped scope: the Node.js SDK captures the full safe process-fact set. Python and PHP emit runtime version today and can receive the same fuller enrichment in their SDK-specific releases.

Event Types

TypeSourceDescription
backend_exceptionServer SDKsUnhandled or manually captured exceptions.
frontend_exceptionBrowser and mobile client SDKsJavaScript, React Native, Android, or iOS client errors.
request_eventServer SDKs; Browser SDK for first-party 5xx network failures; mobile SDKs for scoped first-party requestsHTTP request/response pairs.
log_eventAll SDKsStructured log entries.
frontend_breadcrumbBrowser and mobile client SDKsUser interaction, navigation, app lifecycle, and network breadcrumbs.
deploy_metadataCLI / APIDeployment information.
error_suppressedAll SDKsAggregated duplicate errors from volume control.
probe_eventAll SDKsDiagnostic ring buffer snapshots.

Volume Control

All SDKs implement mandatory volume control to prevent event storms:

Duplicate Suppression

When the SDK captures the same error repeatedly:

  1. First 3 occurrences in a 30-second window → sent normally
  2. Subsequent duplicates → aggregated into a single error_suppressed event with occurrence count
  3. Window resets after 30 seconds of silence

"Same error" is determined by fingerprinting: error class + message + top stack frame.

Loop Protection

Prevents runaway error loops from flooding the ingestion API:

  1. Trigger: More than 10 identical errors in 2 seconds
  2. Action: Force suppression — all events for that fingerprint held in buffer
  3. Checkpoint: Every 30 seconds, one event released to check if the loop has stopped
  4. Reset: After 60 seconds with no new occurrences, normal capture resumes

Buffer Retention

  • Events are never dropped on transport failure
  • SDK respects Retry-After headers from the ingestion API
  • Buffer has a hard size limit (configurable per SDK) to prevent memory exhaustion
  • On buffer overflow, oldest non-exception events are evicted first

Probes

Probes are diagnostic ring buffers that capture application state over time:

// Node.js
debugbundle.probe('db_pool', () => ({
  active: pool.activeCount,
  idle: pool.idleCount,
  waiting: pool.waitingCount,
}));

Probe Types

TypeDescriptionTrigger
Always-onCaptures data at every probe call.Automatic, based on interval.
LazyCaptures only when an incident is being processed.On-demand during bundle generation.
HeavyCaptures detailed/expensive data. Remote-activation only (paid tiers).Activated via API/CLI/MCP.

Ring Buffer

Probe data is stored in a fixed-size ring buffer (default 10 entries). When the buffer is full, the oldest entry is overwritten. This keeps memory usage constant regardless of probe frequency.

Safety Guarantees

Every SDK enforces these guarantees:

  1. Never throw — SDK methods never throw uncaught exceptions into user code
  2. Never block — SDK methods never block the request/response cycle
  3. Never crash — SDK failures are caught internally and swallowed silently
  4. Graceful degradation — If the ingestion API is unreachable, events are buffered and retried
  5. Memory bounded — Buffers have hard limits to prevent memory exhaustion

Redaction

All SDKs apply automatic redaction before events leave the process:

Default Redacted Fields

password, secret, token, authorization, cookie, set-cookie, x-api-key, credit_card, card_number, cvv, ssn, social_security

Custom Redaction

debugbundle.init({
  projectToken: process.env.DEBUGBUNDLE_PROJECT_TOKEN,
  redactFields: ['x-custom-secret', 'internal_id'],
});

Custom fields are merged with defaults — you cannot disable default redaction.

SDK Support Snapshot

FeatureNode.jsBrowserPythonPHPJava.NETGoRubyAndroidiOSReact Native
StatusShippedShippedShippedShippedShippedReleased v1.1.1ShippedShippedReleased v1.1.0Released v0.1.1Released v1.1.0
Package@debugbundle/sdk-node@debugbundle/sdk-browserdebugbundle-pythondebugbundle/sdk-phpMaven com.debugbundle modulesNuGet DebugBundle.Sdk plus DebugBundle.* integrationsgithub.com/debugbundle/debugbundle-godebugbundleMaven com.debugbundle Android moduleshttps://github.com/debugbundle/debugbundle-swift / CocoaPods DebugBundle@debugbundle/sdk-react-native
Framework integrationsExpress, Fastify, Next.jsDjango, Flask, FastAPILaravel, SymfonySpring Boot, servlet, JAX-RSASP.NET Core, gRPC, Worker Service, Hangfire, Azure Functions isolated workernet/http, Gin, EchoRails, Rack, SidekiqAndroid runtime, OkHttp, Ktor, Navigation, ComposeiOS runtime, URLSession, Alamofire, UIKit, SwiftUIReact error boundary, React Navigation, Expo development builds
Logger integrationspino, winston, bunyanlogging, structlog, loguruMonologJUL, LogbackMicrosoft.Extensions.Logging, Serilog, NLog, log4netslog, zap, zerologLogger, Semantic LoggerTimberSwiftLogJS console/log facade plus native foundations
Safe backend/runtime factsFull process factsFull process factsFull process factsFull process facts.NET runtime and hosting factsFull process factsFull process factsAndroid app/device contextiOS app/device contextReact Native app/device context through native foundations
BreadcrumbsYesYesYesYes
Relay handlerExpress, Fastify, Next.jsRelay client pathDjango, Flask, FastAPILaravel, SymfonySpring Boot, servlet, JAX-RSASP.NET Core endpoint mappingnet/http, Gin, EchoRack middleware + Rails routeN/AN/AN/A
ProbesYesYesYesYesYesYesYesYesYesYesYes
File transportYesYesYesYesYesYesYesOffline queueOffline queueOffline queue

For the public V1 parity matrix, including 5xx request-failure behavior and relay support, see SDKs.

Next Steps

  • Node.js SDK — Full Node.js setup and framework integrations
  • Browser SDK — Full Browser SDK setup with breadcrumbs and relay
  • Python SDK — Full Python setup and framework integrations
  • PHP SDK — Full PHP setup and framework integrations
  • Java SDK — Full Java setup across Spring Boot, servlet, JAX-RS, and app servers
  • .NET SDK — Full .NET setup across ASP.NET Core, Worker Service, gRPC, Hangfire, Azure Functions, and logging adapters
  • Go SDK — Full Go setup with HTTP frameworks, logger integrations, and relay support
  • Ruby SDK — Full Ruby setup with Rails, Rack, Sidekiq, logger integrations, and relay support
  • Android SDK — Full Android setup with crash replay, ANR capture, offline queueing, native HTTP instrumentation, and probes
  • iOS SDK — Full iOS and iPadOS setup with SwiftUI, UIKit, URLSession, Alamofire, SwiftLog, offline queueing, crash replay helpers, and probes
  • React Native SDK — Full React Native setup with TypeScript APIs, React helpers, navigation, network capture, Expo development builds, and native queues
  • Browser Relay Setup — Relay architecture and backend setup

On this page