Error Instrumentation
Generates: Logs
Automatically captures unhandled & handled JavaScript errors. Also supports manual error reporting.
Configuration
Error instrumentation is enabled by default. You can disable it if needed:
Pulse.start({
autoDetectExceptions: true // Enabled by default
});
When autoDetectExceptions: false, unhandled errors are not automatically captured. However, you can still manually report errors using Pulse.reportException().
What Gets Tracked
When autoDetectExceptions is enabled:
- Runtime errors and crashes
- Fatal and non-fatal exceptions
You can also manually report caught exceptions:
try {
await riskyOperation();
} catch (error) {
Pulse.reportException(error);
}
Generated Telemetry
Type: Logs
Body: Error message
Attributes
Error-Specific Attributes
| Attribute | Description | Example | Always Present |
|---|---|---|---|
pulse.type | Instrumentation type | "non_fatal" | ✅ Yes |
error.fatal | Whether error is fatal | true, false | ✅ Yes |
error.source | Error source | "js" | ✅ Yes |
exception.type | Error class name | "Error", "TypeError" | ✅ Yes |
exception.message | Error message | "Handled error (demo)" | ✅ Yes |
exception.stacktrace | Full JavaScript stack trace | Complete stack trace string | ✅ Yes |
platform | React Native platform | "react-native" | ✅ Yes |
thread.id | JavaScript thread ID | "69", "91" | ✅ Yes |
thread.name | JavaScript thread name | "mqt_v_js" | ✅ Yes |
screen.name | Current screen name | "MainActivity" | ⚠️ If available |
session.id | Session identifier | "e19b517c705f78d5937c38005259ee1f" | ✅ Yes |
span_id | Active span ID | "dc01e758f8c88a95" | ⚠️ Only if error occurs during active span |
trace_id | Active trace ID | "09ae56c35b2170fbb9a30a9376f75ea2" | ⚠️ Only if error occurs during active trace |
trace_flags | Trace flags | 0 (no trace) or 1 (active trace) | ✅ Yes |
Note: When an error occurs during an active trace or span,
span_idandtrace_idare included in the error event. For fatal errors, active spans can be traced since the error occurred before the span ended, allowing you to see the full context of what was happening when the crash occurred.
Sample Payload: Handled Error (Non-Fatal)
{
"body": "Handled error (demo)",
"date": "2025-11-27T12:50:45.334Z",
"id": "0iiWlkd7cv7ADf2xPGO1TmIBPEO",
"timestamp": "2025-11-27T12:50:45.334Z",
"attributes": {
"error.fatal": false,
"error.source": "js",
"exception.message": "Handled error (demo)",
"exception.stacktrace": "Error: Handled error (demo)\n at triggerHandledError (...)",
"exception.type": "Error",
"network.carrier.icc": "us",
"network.carrier.mcc": "310",
"network.carrier.mnc": "260",
"network.carrier.name": "T-Mobile",
"network.connection.type": "cell",
"platform": "react-native",
"pulse.type": "non_fatal",
"screen.name": "MainActivity",
"session.id": "e19b517c705f78d5937c38005259ee1f",
"thread.id": "69",
"thread.name": "mqt_v_js"
},
"resources": {
"android.os.api_level": "36",
"app.build_id": "1",
"app.build_name": "1.0_1",
"device.manufacturer": "Google",
"device.model.identifier": "sdk_gphone64_arm64",
"device.model.name": "sdk_gphone64_arm64",
"os.description": "BE2A.250530.026.D1",
"os.name": "Android",
"os.type": "linux",
"os.version": "16",
"rum.sdk.version": "0.16.0-alpha-SNAPSHOT",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"telemetry.sdk.language": "java",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.54.1"
},
"span_id": "",
"trace_flags": 0,
"trace_id": ""
}
Sample Payload: Unhandled Error (Fatal)
{
"body": "Unhandled error (demo)",
"date": "2025-11-27T12:50:51.361Z",
"id": "0iiWlvYzccwGGo3DAeTeaJlGKsC",
"timestamp": "2025-11-27T12:50:51.361Z",
"attributes": {
"error.fatal": true,
"error.source": "js",
"exception.message": "Unhandled error (demo)",
"exception.stacktrace": "Error: Unhandled error (demo)\n at anonymous (...)",
"exception.type": "Error",
"network.carrier.icc": "us",
"network.carrier.mcc": "310",
"network.carrier.mnc": "260",
"network.carrier.name": "T-Mobile",
"network.connection.type": "cell",
"platform": "react-native",
"pulse.type": "non_fatal",
"screen.name": "MainActivity",
"session.id": "e19b517c705f78d5937c38005259ee1f",
"thread.id": "69",
"thread.name": "mqt_v_js"
},
"resources": {
"android.os.api_level": "36",
"app.build_id": "1",
"app.build_name": "1.0_1",
"device.manufacturer": "Google",
"device.model.identifier": "sdk_gphone64_arm64",
"device.model.name": "sdk_gphone64_arm64",
"os.description": "BE2A.250530.026.D1",
"os.name": "Android",
"os.type": "linux",
"os.version": "16",
"rum.sdk.version": "0.16.0-alpha-SNAPSHOT",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"telemetry.sdk.language": "java",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.54.1"
},
"span_id": "",
"trace_flags": 0,
"trace_id": ""
}
Sample Payload: Error During Active Span
{
"body": "Handled error with span (demo)",
"date": "2025-11-27T13:12:30.666Z",
"id": "0iiXNwat6hg4eSAvt1XMJORsXE7",
"timestamp": "2025-11-27T13:12:30.666Z",
"attributes": {
"error.fatal": false,
"error.source": "js",
"exception.message": "Handled error with span (demo)",
"exception.stacktrace": "Error: Handled error with span (demo)\n at triggerHandledErrorWithSpan (...)",
"exception.type": "Error",
"network.carrier.icc": "us",
"network.carrier.mcc": "310",
"network.carrier.mnc": "260",
"network.carrier.name": "T-Mobile",
"network.connection.type": "cell",
"platform": "react-native",
"pulse.type": "non_fatal",
"screen.name": "MainActivity",
"session.id": "dce09977c69b0a5c15aa5fd01f817514",
"thread.id": "68",
"thread.name": "mqt_v_js"
},
"resources": {
"android.os.api_level": "36",
"app.build_id": "1",
"app.build_name": "1.0_1",
"device.manufacturer": "Google",
"device.model.identifier": "sdk_gphone64_arm64",
"device.model.name": "sdk_gphone64_arm64",
"os.description": "BE2A.250530.026.D1",
"os.name": "Android",
"os.type": "linux",
"os.version": "16",
"rum.sdk.version": "0.16.0-alpha-SNAPSHOT",
"service.name": "PulseReactNativeOtelExample",
"service.version": "1.0_1",
"telemetry.sdk.language": "java",
"telemetry.sdk.name": "opentelemetry",
"telemetry.sdk.version": "1.54.1"
},
"span_id": "dc01e758f8c88a95",
"trace_flags": 1,
"trace_id": "09ae56c35b2170fbb9a30a9376f75ea2"
}
Note: All error events include global attributes (service, device, OS, session, network carrier, etc.) in the
resourcesobject. See Global Attributes for complete list.
Manual Error Reporting API
// Basic reporting
Pulse.reportException(error);
// Report as fatal
Pulse.reportException(error, true);
// With custom attributes
Pulse.reportException(error, false, {
userId: 'user-123',
operation: 'checkout'
});
Related
- Error Boundaries - React component error handling
- Custom Spans - Record exceptions on spans