Skip to content

Document setting app launch span sample rate via tracesSampler #7235

Description

@noahsmartin

Problem Statement

Users can set a global sample rate, or use a custom sampler, but there isn't a clear way to set a sample rate for app launches. Many apps will have hundreds of spans throughout the lifetime of a process but only one app launch. A reasonable global sample rate might greatly reduce the number of app launch spans that get sent to Sentry even though they are arguably the most important spans. We should provide an easy way to customize the sample rate just for app launch spans.

Solution

The standalone app start transaction will have the op app.start which you can use to set a different sample rate:

options.tracesSampler = { context in
    if context.transactionContext.operation == "app.start" {
        return 1.0
    }
    return nil
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions