Skip to content

Performance Traces

AppeliumFeedback lets you record custom performance traces for operations that matter in your app, such as checkout, registration, image processing, etc.

Each trace records its duration and can include a small set of custom attributes to help you compare performance across different contexts.

Basic usage

Once AppeliumFeedback is initialized with performance traces enabled, you can start a trace with a descriptive name, add attributes, and stop it when the operation finishes:

val trace = AppeliumFeedback.startPerformanceTrace(name = "checkout")

trace?.setValue(value = "cart", attribute = "flow")
trace?.setValue(value = "premium", attribute = "userType")

// Perform the work you want to measure

trace?.stop()

startPerformanceTrace returns null if the SDK has not been initialized or if performance traces are not enabled. The trace is thread-safe and can be started, updated, and stopped from different threads.

Starting traces

To use performance traces, enable them when starting the SDK. This also activates automatically collected traces such as the App Start trace:

AppeliumFeedback.start(
    apiKey = <#api key#>,
    application = this,
    performanceTraces = PerformanceTracesConfiguration.Enabled()
)

val trace = AppeliumFeedback.startPerformanceTrace(name = "loadHomeScreen")

Adding attributes

You can attach up to 5 custom attributes to every trace. This is useful for adding context such as flow, backend environment, experiment variant, or user tier.

val trace = AppeliumFeedback.startPerformanceTrace(name = "fetchRecommendations")
trace?.setValue(value = "home", attribute = "screen")
trace?.setValue(value = "v2", attribute = "algorithm")
trace?.setValue(value = "staging", attribute = "environment")

// Execute the traced operation

trace?.stop()

Setting the same attribute key again overwrites the previous value without consuming an additional slot. Attributes set after stop() is called are ignored. Calling stop() more than once has no effect.

Automatic traces

AppeliumFeedback automatically collects an App Start trace that measures the time from process creation until the first screen is shown. This trace is recorded once per app launch and requires no additional code.

The App Start trace is not collected when its duration exceeds a reasonable threshold. This handles cases where the Android process was started earlier for background work (e.g. a ContentProvider, Service, or BroadcastReceiver) before the user opened the app, which would inflate the measured duration beyond what reflects a real user-initiated launch.

Limits

  • Trace name: max 100 characters
  • Attribute keys: max 32 characters
  • Attribute values: max 100 characters
  • Maximum number of distinct attributes per trace: 5

Values that exceed these limits are automatically truncated to fit.