Docs/Trace/SDK Reference

SDK Reference

The `@probe/trace` SDK is the easiest way to integrate Trace into your JavaScript or TypeScript application.

Installation

npm install @probe/trace

Configuration

Initialize the Trace instance with the following options:

OptionTypeDefaultDescription
apiKeystringrequiredYour Trace API Key found in the dashboard.
environmentstring'development'Current environment name (e.g., 'production').
sampleRatenumber1.0Percentage of events to capture (0.0 to 1.0).

Methods

mount()

Starts the automatic error capturing and performance monitoring.

captureError(error, context?)

Manually capture an exception.

trace.captureError(new Error('Something went wrong'), { userId: 123 });

log(message, level?)

Send a custom log event.