ref(checkin): Measure check-in durations with Stopwatch (JAVA-576) - #6032
Open
runningcode wants to merge 2 commits into
Open
ref(checkin): Measure check-in durations with Stopwatch (JAVA-576)#6032runningcode wants to merge 2 commits into
runningcode wants to merge 2 commits into
Conversation
📲 Install BuildsAndroid
|
9 tasks
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 2, 2026 08:23
de557be to
edd22f0
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
from
September 2, 2026 08:23
eb4c4ad to
0a21879
Compare
This was referenced Sep 2, 2026
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 2, 2026 13:35
edd22f0 to
fef63c7
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
from
September 2, 2026 13:35
0a21879 to
074890f
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 2, 2026 13:37
fef63c7 to
9829cc8
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
2 times, most recently
from
September 3, 2026 15:11
781c864 to
8bb8665
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 3, 2026 15:11
9829cc8 to
c11fec4
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
from
September 3, 2026 15:41
8bb8665 to
fc85c12
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 3, 2026 15:41
c11fec4 to
0d1d4c9
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
from
September 4, 2026 08:33
fc85c12 to
be5eaeb
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 4, 2026 08:57
0d1d4c9 to
6861150
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
from
September 4, 2026 15:11
be5eaeb to
2168b35
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 4, 2026 15:11
6861150 to
b35959c
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
2 times, most recently
from
September 8, 2026 13:26
d40fd82 to
da479f2
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 8, 2026 13:27
b35959c to
1eb13ab
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
from
September 8, 2026 15:10
da479f2 to
7de7107
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 8, 2026 15:10
1eb13ab to
5b8105e
Compare
runningcode
force-pushed
the
no/java-574-ratelimiter-deadline
branch
2 times, most recently
from
September 9, 2026 14:56
62c2029 to
258eedb
Compare
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 9, 2026 15:44
5b8105e to
67379d3
Compare
runningcode
changed the base branch from
no/java-574-ratelimiter-deadline
to
main
September 9, 2026 15:44
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 9, 2026 16:37
67379d3 to
f540ce2
Compare
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. They now share one Stopwatch, which takes its clock from the options. Inert on every path that ships. The options hand the check-in path a JavaMonotonicTicker, whose tickNanos() is System.nanoTime(), so the serialized duration is unchanged to the bit. A new test brackets a tick between two nanoTime readings, pinning the source rather than merely the resolution. SentryAndroidOptions does override the ticker with a boottime one, but nothing reaches it from here: check-ins have no Android integration -- no WorkManager, JobScheduler or AlarmManager wrapper, no manifest option, no Android docs. Measuring a check-in across device sleep is a change for the next major. An uninitialized SDK still reaches a clock: NoOpScopes.getOptions() hands back empty options, whose ticker is the JVM one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…576) The duration was measured off System.nanoTime() directly, so a test could only assert it was some nonzero float. Now that the clock arrives through SentryOptions.getMonotonicTicker(), a test can hand the check-in path a ticker it controls and assert an exact value. Two paths are worth pinning: the callable returning normally, where only the terminal check-in carries a duration and the IN_PROGRESS one does not, and the callable throwing, where the finally block still has to report the time that passed. Both fail against the pre-refactor code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
runningcode
force-pushed
the
no/java-576-checkin-stopwatch
branch
from
September 10, 2026 07:17
0c4b606 to
bab2fcd
Compare
runningcode
marked this pull request as ready for review
September 10, 2026 07:20
runningcode
requested review from
0xadam-brown,
adinauer,
markushi and
romtsn
as code owners
September 10, 2026 07:20
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
Switch CheckIns to use Stopwatch to measure durations. This makes the code easier to reason about and makes the code more testable. This has no logical changes since this is only used in Java and the monotonic clock uses the same
System.nanoTime()under the hood.💡 Motivation and Context
This is a pure refactor to make the code easier to reason about and easier to test.
💚 How did you test it?
Existing tests pass and added new ones.
📝 Checklist
sendDefaultPIIis enabled.🤖 Generated with Claude Code