Instrumentation

What each built-in Android instrumentation captures, the spz.type it attaches, whether it is on by default, and how to turn it on or off.

The Android SDK splits instrumentation into modules. Each one wraps a single Android API or framework and attaches a spz.type attribute to the telemetry it produces. Dashboards and the session timeline classify data by that value, so which type an instrumentation uses is also what you query on.

The type scheme

spz.type takes the form type.subtype. There are four top-level types.

TypeMeaningApplies to
perfHow long an interval tookSpans
uxUser behaviour or something visible on screenSpans, logs, span events
sysSystem events not tied to user behaviourSpans, logs, span events
stateA value that changes over the sessionState timelines

Performance

Instrumentationspz.typeDefaultSwitchAlso needs
App startup traceperfOn——
Screen loadperf.ui_loadOnautomatic_data_capture.ui_load_tracing_disabled—
ANR (thread blockage)perf.thread_blockageOnautomatic_data_capture.anr_info—
Thermal stateperf.thermal_stateOnRemote configAPI 29+
Frame smoothnessperf.smoothnessOffRemote configAPI 24+
Screen load detailperf.screen_loadOffRemote configAPI 24+
OkHttpperf.network_requestOnBytecode okhttpEnabledOkHttp
HttpURLConnection (lite)perf.network_requestOnnetworking.enable_huc_lite_instrumentation—
HttpURLConnection (full)perf.network_requestOffnetworking.enable_native_monitoringSeparate artifact

The startup trace builds a tree of process-init, sophonz-init, activity-init, and app-ready. You can add your own child spans and attributes with addStartupTraceChildSpan and addStartupTraceAttribute.

The two HttpURLConnection instrumentations do not run together: enabling the full one stands the lite one down.

User experience

Instrumentationspz.typeDefaultSwitchAlso needs
Screen (Activity)ux.viewOnview_config.enable_automatic_activity_capture—
Tap (View)ux.tapOnBytecode onClickEnabled, onLongClickEnabled—
Tap (Compose)ux.tapOffcompose.capture_compose_onclickCompose, separate artifact
WebViewux.webviewOnwebview.enable plus bytecode webviewOnPageStartedEnabled—

Tap coordinates are captured only with taps.capture_coordinates, which is off by default. Compose taps identify elements by test tag, so an element without one is recorded unnamed.

WebView records the URL at onPageStarted. Query parameters are controlled by webview.capture_query_params and the fragment by webview.fragment_capture (keep, redact, remove).

System

Instrumentationspz.typeDefaultSwitchAlso needs
JVM crashsys.android.crashOncrash_handler.enabled—
Native crashsys.android.native_crashOnndk_enabledNDK
App exit infosys.exitOnapp_exit_info.aei_enabledAPI 30+
Push notification (FCM)sys.push_notificationOffBytecode firebasePushNotificationsEnabledFirebase Messaging
Power save modesys.low_powerOnautomatic_data_capture.power_save_mode_info—
Connectivity changesys.network_statusOnautomatic_data_capture.network_connectivity_info—
Request and response bodiessys.network_capturePer remote rule——

App exit info carries Android's own ApplicationExitInfo records: exit reason, importance, memory usage, and any ANR or native trace. It is read on the next launch after the process has already died, which is how it covers the terminations crash instrumentation cannot see.

The FCM module is bundled but captures nothing unless the bytecode instrumentation is enabled. Personal data such as the title and body is included only with capture_fcm_pii_data.

Body capture applies only to requests matching a remote rule. Local configuration alone does not enable it.

State timelines

Values that change while a session runs. They are recorded as intervals rather than spans, so they can be overlaid on other telemetry in the session timeline.

StateValuesDefault
ScreenCurrent screen nameOn
Networkwifi, wan, not_reachable, and so onOn
PowerWhether power-save mode is activeOn

Screen state is recorded from Activity transitions alone, but an app using Jetpack Navigation needs the androidx-navigation integration for per-destination accuracy.

Instrumentation that produces no telemetry

Memory leak detection emits neither spans nor logs. It records a session attribute listing Activity and Fragment instances that were not reclaimed. It is off by default and can only be enabled through remote config. It requires API 23+, and Fragment coverage additionally requires androidx.fragment.

Additional instrumentation

These are not bundled with the SDK. Add the artifact when you need them.

ArtifactRole
sophonz-android-instrumentation-androidx-navigationFeeds Jetpack Navigation destination changes into screen state
sophonz-android-instrumentation-compose-tapCaptures taps on Compose elements
sophonz-android-instrumentation-hucFull HttpURLConnection instrumentation

androidx-navigation is wired per screen with rememberObservedNavController or rememberObservedBackStack. It does not apply automatically.

NOTE — Items decided by remote config

Rows whose switch reads "remote config" cannot be enabled from sophonz-config.json. The server-supplied configuration decides them, and the default in the table is the value used when no remote config is present.

Turning it all off

This disables every bytecode instrumentation at once.

sophonz {
  bytecodeInstrumentation {
    enabled.set(false)
  }
}

To exclude only certain packages, use classIgnorePatterns — see Configuration.