sentry-java
sentry-java copied to clipboard
Wrong TTID and TTFD
Integration
sentry-android
Build System
Gradle
AGP Version
8.1.0
Proguard
Enabled
Version
7.2.0
Steps to Reproduce
There is a case where TTID and TTFD are incorrectly recorded. The reproducible path is as follows: when Activity(1) is turned on, if you immediately enter the new Activity(2) within 1-2 seconds, and then return to Activity(1), TTID and TTFD are overwritten with onResume timestamp values, resulting in incorrect values being recorded. The suspected code location is as follows.
https://github.com/getsentry/sentry-java/blob/9119d59d9db7822ab9319598cce020e731c9d015/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java#L564
However, it seems to be frequently reproducible when the time between starting Activity(1) and returning to Activity(1) is within about 3 seconds. If you navigate to Activity(2) and stay there for a while, you can confirm that TTID and TTFD of Activity(1) are correctly recorded on the Discovery page. However, in cases where you return within 3 seconds, there are occasional instances of incorrect recording.
Expected Result
Activity(2) was started through a button click in Activity(1), and since TTFD was reported before the start, it should represent the time just before Activity(2) started.
Actual Result
The time when returned to Activity(1).
┆Issue is synchronized with this Jira Improvement by Unito
Hey @ohjunki thanks for reporting and the detailed steps to reproduce! If you're using SaaS, would you be able to post links to transactions that show this behavior (vs. transactions that don't)? You can also send them to [email protected] if you prefer.
The solution would be to only set TTID/TTFD values once and not overwrite when coming back to onResume for already running transaction
Hi @kahest I sent the link via email, which subject is "[sentry-java][issue-3145] TTID TTFD debug content". Thank you for the prompt response!
@kahest Hi, is there any update?
Hi @ohjunki - your data confirmed our assumptions and our approach, but we didn't have the bandwidth to implement this yet, we plan to tackle this soon.
Added example issue from a large sales-led customer to linked Jira
I'm not able to reproduce the issue anymore.
This is likely fixed by https://github.com/getsentry/sentry-java/pull/3219 in version 7.5.0
, where we introduced a check to avoid changing measurements in finished spans
@ohjunki @realkosty Can you try again with SDK version 7.5.0
or higher?
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀