Skip to content

Wrong transactions on late SDK init/re-init #3059

@stefanosiano

Description

@stefanosiano

Description

To calculate the app start timestamp (and TTID and TTFD), the SDK changes the start timestamp of the first Activity transaction to be the app init timestamp.
When the SDK is initialized manually after the creation of the first activity, for example waiting for a feature flag or any other user logic, the SDK still applies the same logic to the first Activity transaction happening after the init, which can happen minutes later.
It also happens when the SDK is reinitialized: the SDK changes the timestamp of the first Activity transaction happening after the re-init, which can happen days later.
This breaks TTID/TTFD and other metrics, other than transaction durations.
First init example (ttid: 1.2 minutes)
Re-init example (ttid: 2.75 minutes)
Even if we can "fix" it by discarding outlier transactions, we should handle this case properly.
Reproducible example is the sample app in the https://github.com/getsentry/sentry-java/tree/repro/long-start-transaction breanch

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions