Configuration
Complete reference for all PulseSDK.INSTANCE.initialize(...) parameters. If you just need a quick working setup, see Installation.
The SDK ignores subsequent initialize() calls. Call it once, as early as possible in Application.onCreate().
Required
| Parameter | Description |
|---|---|
application | Your Application instance |
endpointBaseUrl | OTLP base URL for your Pulse backend |
apiKey | Project API key |
dataCollectionState | Initial consent state — ALLOWED, PENDING, or DENIED |
Endpoints & Headers
| Parameter | Default | Description |
|---|---|---|
endpointHeaders | emptyMap() | Extra HTTP headers on all outbound requests |
configEndpointUrl | Auto-derived | URL to fetch remote SDK config. Omit unless your backend serves config from a different host |
customEventConnectivity | Same as logs | Override delivery endpoint for custom events only |
Telemetry Enrichment
globalAttributes
Key/value pairs attached to every span and log. Uses the OpenTelemetry Attributes API:
globalAttributes = {
Attributes.builder()
.put("deployment.environment", if (BuildConfig.DEBUG) "development" else "production")
.put("app.version.name", BuildConfig.VERSION_NAME)
.build()
}
See Global Attributes for the full list of what the SDK auto-attaches alongside your values.
SDK Behavior
dataCollectionState
| Value | Behavior |
|---|---|
ALLOWED | Telemetry collected and exported immediately |
PENDING | Telemetry buffered in memory; no data exported until state changes |
DENIED | SDK stops collecting; terminal for the current process |
PulseSDK.INSTANCE.initialize(
...,
dataCollectionState = PulseDataCollectionConsent.PENDING, // wait for user consent
)
Use PENDING to gate collection behind a consent prompt. See Data Collection Consent.
sessionConfig
Customize session lifetime:
import io.opentelemetry.android.agent.session.SessionConfig
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.hours
sessionConfig = SessionConfig(
backgroundInactivityTimeout = 15.minutes, // default
maxLifetime = 4.hours, // default
)
Changing session defaults will affect what counts as a "session" across all dashboards, alerts, and analysis.
diskBuffering
Telemetry is buffered to disk when offline and flushed on reconnect. Enabled by default:
diskBuffering = {
enabled(true)
}
Instrumentations
On by default:
| Instrumentation | Guide |
|---|---|
| Crash detection | Crashes |
| ANR detection | ANR |
| Screen lifecycle (Activity + Fragment) | Screen Lifecycle |
| Slow / frozen frames | Slow Rendering |
| Interaction flows | Interactions |
| App Startup | - |
| Session Management | - |
| Network connectivity changes | Network Change |
Needs extra setup:
| Instrumentation | What's needed | Guide |
|---|---|---|
| HTTP request tracking | OkHttp dep + ByteBuddy Gradle plugin | Network Monitoring |
| Session replay | Enable from Pulse Dashboard | Session Replay |
| Click tracking | Enable from Pulse Dashboard | Click Tracking |
| Location | ACCESS_COARSE_LOCATION permission | Location |
Use the instrumentations block to disable or configure any default instrumentation:
PulseSDK.INSTANCE.initialize(
...,
) {
crashReporter { enabled(false) }
fragment { enabled(false) } // useful for React Native apps
}
Remote Config
The SDK fetches a server-side config from your Pulse backend on every launch — in the background, non-blocking. The fetched config is persisted on device and applied on the next launch, so mid-session behavior stays consistent.
The config URL is auto-derived from endpointBaseUrl. Only set configEndpointUrl explicitly if your backend serves config from a different host.
Everything below can be changed from the Pulse dashboard without shipping an app update:
- Enable or disable instrumentations — crash reporting, network, session replay, click tracking, or interactions.
- Sampling rate — collect telemetry from a percentage of all sessions globally
- Rule-based sampling — override rates for specific OS versions, app versions, or countries
- Drop or add attributes — remove noisy attributes or inject static values without touching app code
Shutdown
Permanently shuts down the SDK. Flushes and releases all OTel resources, uninstalls instrumentation. Cannot be re-initialized in the current process.
PulseSDK.INSTANCE.shutdown()
Next Steps
| I want to… | Go to |
|---|---|
| Configure a specific instrumentation | Instrumentation guides |
| Track business events | Custom Events |
| Report handled errors | Error Tracking |
| Measure operation durations | Custom Spans |
| Attach user identity to telemetry | User Identification |
| Add global metadata to all signals | Global Attributes |
| Gate collection behind consent | Data Collection Consent |
| Browse all public methods | API Reference |
| Upload Mapping Files | Pulse Plugin |