Skip to main content

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

AttributeDescriptionExampleAlways Present
pulse.typeInstrumentation type"non_fatal"✅ Yes
exception.typeException class name"java.net.SocketTimeoutException"⚠️ Only if Throwable provided
exception.messageException message"Network timeout occurred"⚠️ Only if Throwable provided
exception.stacktraceFull stack traceComplete stack trace string⚠️ Only if Throwable provided
screen.nameCurrent screen/activity name"MainActivity"⚠️ If available
session.idSession identifier"f40364c92b85ec0c19c35a65be42b97f"✅ Yes
Custom attributesAny key-value pairs you defineendpoint: "/api/users", statusCode: 500⚠️ Only if provided

Note: All error tracking events include global attributes (service, device, OS, session, network carrier, etc.) in the resources object. 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 extracts exception.type, exception.message, and exception.stacktrace attributes following OpenTelemetry semantic conventions.

Best Practices

  1. Include context: Always provide relevant context in the params map
  2. Use descriptive names: Make error names clear and searchable
  3. Report immediately: Report errors as soon as they occur