Error Tracking Instrumentation
Generates: Events (Log Records)
Manually report non-fatal errors in your Android application.
Note: For automatic crash detection, see Crash Instrumentation. This section covers manual error reporting for non-fatal errors.
Usage Patterns
1. Report Non-Fatal Error with Message
PulseSDK.INSTANCE.trackNonFatal(
name = "API request failed",
observedTimeStampInMs = System.currentTimeMillis(),
params = mapOf(
"endpoint" to "/api/users",
"statusCode" to 500,
"retryAttempt" to 3,
)
)
2. Report Non-Fatal Exception
try {
riskyOperation()
} catch (e: Exception) {
PulseSDK.INSTANCE.trackNonFatal(
throwable = e,
observedTimeStampInMs = System.currentTimeMillis(),
params = mapOf(
"context" to "payment_flow",
"userId" to "user-123",
)
)
}
Generated Telemetry
Type: Log Record (Event)
Body: Error message or custom name
pulse.type: non_fatal
Attributes
Error Tracking Attributes
| Attribute | Description | Example | Always Present |
|---|---|---|---|
pulse.type | Instrumentation type | "non_fatal" | ✅ Yes |
exception.type | Exception class name | "java.net.SocketTimeoutException" | ⚠️ Only if Throwable provided |
exception.message | Exception message | "Network timeout occurred" | ⚠️ Only if Throwable provided |
exception.stacktrace | Full stack trace | Complete stack trace string | ⚠️ Only if Throwable provided |
screen.name | Current screen/activity name | "MainActivity" | ⚠️ If available |
session.id | Session identifier | "f40364c92b85ec0c19c35a65be42b97f" | ✅ Yes |
| Custom attributes | Any key-value pairs you define | endpoint: "/api/users", statusCode: 500 | ⚠️ Only if provided |
Note: All error tracking events include global attributes (service, device, OS, session, network carrier, etc.) in the
resourcesobject. See Global Attributes for complete list.
Sample Payload: Non-Fatal Error (String)
{
"body": "API request failed",
"date": "2025-11-27T08:44:00.000000Z",
"id": "0iiPdg5oW57kWey8dHienFjlP9S",
"timestamp": "2025-11-27T08:44:00.000000Z",
"attributes": {
"pulse.type": "non_fatal",
"endpoint": "/api/users",
"statusCode": 500,
"retryAttempt": 3,
"screen.name": "MainActivity",
"session.id": "f40364c92b85ec0c19c35a65be42b97f"
},
"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"
}
}
Sample Payload: Non-Fatal Error (Exception)
{
"body": "Network timeout occurred",
"date": "2025-11-27T08:45:00.000000Z",
"id": "0iiPdg5oW57kWey8dHienFjlP9S",
"timestamp": "2025-11-27T08:45:00.000000Z",
"attributes": {
"pulse.type": "non_fatal",
"exception.type": "java.net.SocketTimeoutException",
"exception.message": "Network timeout occurred",
"exception.stacktrace": "java.net.SocketTimeoutException: Network timeout...\n at com.example.ApiClient.request(ApiClient.kt:42)\n ...",
"context": "payment_flow",
"userId": "user-123",
"screen.name": "MainActivity",
"session.id": "f40364c92b85ec0c19c35a65be42b97f"
},
"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"
}
}
Note: When reporting a
Throwable, the SDK automatically extractsexception.type,exception.message, andexception.stacktraceattributes following OpenTelemetry semantic conventions.
Best Practices
- Include context: Always provide relevant context in the
paramsmap - Use descriptive names: Make error names clear and searchable
- Report immediately: Report errors as soon as they occur
Related
- Crashes - Automatic crash detection
- Custom Spans - Record exceptions on spans
- API Reference - Complete API documentation