You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e907d8d
Browse filesBrowse the repository at this point in the historyBrowse files
ref(checkin): Measure check-in durations with Stopwatch (JAVA-576) (#6032)
* ref(checkin): Measure check-in durations with Stopwatch (JAVA-576)
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>
* test(checkin): Pin the check-in duration to the options ticker (JAVA-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>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments