Repository navigation
ref(time): Read the epoch time from EpochClock (JAVA-836) - #6588
Draft
runningcode wants to merge 1 commit into
Draft
runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
The ApplicationExitInfo cutoff and okhttp's replay breadcrumb timestamps only need the current epoch time, which options.getEpochClock() gives. Moving them off CurrentDateProvider changes no values, and leaves fewer callers for v9 to touch when it removes ICurrentDateProvider. The three exit-info integrations no longer take a date provider: the dispatcher reads the clock from the options it already has. Timestamp.epochMillis() converts for the call sites that need millis. Fixes JAVA-836 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
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
Moves the call sites that use
CurrentDateProvideronly to read the current epoch time ontooptions.getEpochClock():ApplicationExitInfoHistoryDispatcher: the 90-day cutoff forApplicationExitInfotimestamps. It now reads the clock from the options it already holds, soAnrV2Integration,TombstoneIntegrationandMemoryLimiterIntegrationno longer take a date provider. Their only other constructors were package-private and passedCurrentDateProvider.getInstance()anyway.SentryOkHttpInterceptorandSentryOkHttpEvent:HTTP_START_TIMESTAMPandHTTP_END_TIMESTAMPon the breadcrumb that Session Replay reads.Each one compares against or sends an epoch instant, so each stays on the wall clock.
EpochClockis the wall clock:System.currentTimeMillis()on Android, andInstanton Java 9+, which gives the same millisecond. No values change.Adds
Timestamp.epochMillis()for the call sites that need milliseconds.💡 Motivation and Context
Fewer callers left for v9 to change when it removes
ICurrentDateProvider(JAVA-827), and fewer@SuppressWarnings("deprecation")for the deprecation PR (JAVA-839).Left alone on purpose:
LifecycleWatcher: already moved on9.x.xby fix(android): Decide session rotation on a monotonic clock (JAVA-573) #6096.RateLimiterandReplayIntegration: theirICurrentDateProviderconstructors are public API, so they change in v9.DebouncerandAndroidEnvelopeCache: JAVA-729.💚 How did you test it?
TimestampTestcase forepochMillis()truncation.AnrV2IntegrationTest,TombstoneIntegrationTest,MemoryLimiterIntegrationTest,ApplicationExitInfoCrossIntegrationTest(78 tests) and all ofsentry-okhttp(150 tests) pass. The tests already used the real clock, so they now go through the public constructors.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
JAVA-839 deprecates
CurrentDateProvider.getInstance()and the rest of the legacy clock surface.#skip-changelog
🤖 Generated with Claude Code