Repository navigation
ref(core): Measure the performance-collection budget on a monotonic ticker (JAVA-579) - #6101
Open
runningcode wants to merge 3 commits into
Open
runningcode wants to merge 3 commits into
runningcode wants to merge 3 commits into
Conversation
9 tasks done
📲 Install BuildsAndroid
|
…icker (JAVA-579) DefaultCompositePerformanceCollector decided a transaction had been collecting for 30s by subtracting two options.getDateProvider() readings. Those are wall-clock on every platform, including Android: SentryNanotimeDate.nanoTimestamp() returns millisToNanos(unixDateMillis), not its nanoTime component, so the extra precision that type exists for never entered this comparison. A device time change therefore ended collection early or kept it running past the budget. Each CompositeData now holds a Deadline on a MonotonicTicker. The budget is not a serialized value, so this only changes when the collector stops. Two side effects worth review: the 30s boundary is now inclusive, where the old strict `>` let a sample land exactly at 30s; and addDataAndCheckTimeout no longer takes the shared clock reading, since each transaction owns its own deadline. TestMonotonicTicker's field is now volatile, as the timer thread reads a ticker the test thread advances. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Drop the package-private constructor overload that took a MonotonicTicker and read options.getMonotonicTicker() instead. The test overrides getMonotonicTicker() on a SentryOptions subclass, as SentryOptionsTest already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
force-pushed
the
no/java-579-c6-collection-budget
branch
from
November 6, 2026 13:33
e46de12 to
88f31b6
Compare
runningcode
marked this pull request as ready for review
November 6, 2026 14:16
runningcode
requested review from
0xadam-brown and
markushi
and removed request for
a team
November 6, 2026 14:16
This branch has not been deployed
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
This switches the
DefaultCompositePerformanceCollectorto use a monotonic clock for the collection deadline.Before it seemed like it was using a monotonic clock but SentryNanotimeDate.nanoTimestamp return the epoch millis. 😢
Each
CompositeDatanow holds aDeadlineonoptions.getMonotonicTicker().Tiny behavior changes:
Deadline.hasPassed()is>=, where the old check was>.addDataAndCheckTimeoutno longer takes a sharednowNanos, since each transaction owns its own deadline.TestMonotonicTicker's field is now@Volatile, because the collector's timer thread reads a ticker the test thread advances.💡 Motivation and Context
Clock-usage audit finding §C6.
💚 How did you test it?
The two 30 second tests in
DefaultCompositePerformanceCollectorTestnow advance aTestMonotonicTickerinstead of stubbingdateProvider.now()with a positional sequence of return values.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The 100ms sampling loop in this class still runs on
java.util.Timer, whose scheduling is wall-clock. Moving it is a scheduling change and gets its own PR.🤖 Generated with Claude Code