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 execution paths.

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:

let trace = AppeliumFeedback.startPerformanceTrace(name: "startPlayback")

trace?.setValue("movie", forAttribute: "contentType")
trace?.setValue("featured", forAttribute: "entryPoint")

// Perform the work you want to measure

trace?.stop()

startPerformanceTrace returns nil 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 or dispatch queues.

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#>,
    performanceTraces: .enabled
)

let 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, content type, environment, or experiment variant.

let trace = AppeliumFeedback.startPerformanceTrace(name: "prepareCarousel")
trace?.setValue("home", forAttribute: "screen")
trace?.setValue("hero", forAttribute: "section")
trace?.setValue("A", forAttribute: "variant")

// 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 the system pre-warms the app in the background, since the measured duration would not reflect 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.