ref(checkin): Measure check-in durations with Stopwatch (JAVA-576) - #6032
Draft
runningcode wants to merge 1 commit into
Draft
ref(checkin): Measure check-in durations with Stopwatch (JAVA-576)#6032runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
All four check-in paths kept a `long startTime = System.nanoTime()` and subtracted it in a finally block: CheckInUtils and the SentryCheckInAdvice in sentry-spring, sentry-spring-jakarta and sentry-spring-7. The serialized duration is unchanged, to the bit. JavaUptimeClock.tickNanos() is System.nanoTime(), and check-ins have no Android path where the two could diverge, so this is the same arithmetic behind a name. That is the point of naming the guarantee rather than the mechanism: it makes a conversion that touches a customer-facing value provably inert, and therefore landable before the major. Each site carries a TODO [MAJOR] for the change that is not inert: on elapsed-real-time, a cron job that spans device sleep would report the duration a user would measure rather than the CPU time it had. The clock is resolved as JavaUptimeClock.getInstance() rather than through options, so an uninitialised SDK reaches a working clock without a scopes lookup. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📲 Install BuildsAndroid
|
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
All four check-in paths kept a start tick and subtracted it in a
finally:CheckInUtilsplusSentryCheckInAdviceinsentry-spring,sentry-spring-jakartaandsentry-spring-7.Stacked on #6030 → #6029 → #6028.
💡 Motivation and Context
The serialized
durationis unchanged, to the bit.JavaUptimeClock.tickNanos()isSystem.nanoTime(), and check-ins have no Android path where uptime and elapsed real time could diverge. This is the same arithmetic behind a name.That is the whole argument for landing it before the major. Everything else in this series that touches a customer-facing measurement is being held for v9; this one can go now precisely because naming the guarantee makes the conversion provably inert rather than merely believed to be.
Each site carries a
// TODO [MAJOR]for the change that is not inert. On the elapsed-real-time clock, a cron job that spans device sleep would report the duration a user would measure rather than the CPU time it had — which is what a cron monitor's "duration" ought to mean, and what v9 should switch to.The clock is resolved as
JavaUptimeClock.getInstance()rather than read from options. It is a stateless singleton, so an uninitialised SDK reaches a working clock with no scopes lookup and nothing to configure. This also givesUptimeClockits first caller — it shipped in #6028 with none.#skip-changelog
💚 How did you test it?
No new tests. The conversion is mechanical and the existing check-in tests already assert the emitted
duration; a test thatStopwatch.started(JavaUptimeClock.getInstance())measures elapsed time would be testingStopwatchTesta second time..apihas no diff.sentry's check-in tests pass, and all four modules compile.A pre-existing failure you should know about, since it is in the files this PR touches:
SentryCheckInAdviceTestfails locally for me in all three Spring modules — 14 failures,expected:<1> but was:<0>on thecaptureCheckInverifications. I confirmed it is not caused by this change by running the same tests on the base branch with the change stashed: 14 failures before, 14 after, identical set. It looks like a local environment problem rather than a repo one, but I could not rule that out from here, so CI on this PR is the real check.📝 Checklist
sendDefaultPIIis enabled.