Repository navigation
ref(core): Sample performance data on the timer executor (JAVA-837) - #6589
Draft
runningcode wants to merge 1 commit into
Draft
runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
📲 Install BuildsAndroid
|
9 tasks done
DefaultCompositePerformanceCollector sampled CPU and memory every 100ms on a java.util.Timer, the last one in the SDK. Timer schedules on the wall clock, so a backward clock step stopped sampling, and the 30s collection budget check that runs in the same task, until the clock caught back up. The loop now runs on options.getTimerExecutorService(), which schedules on System.nanoTime(). The executor only has one-shot schedule(), so each run reschedules itself. A generation counter, bumped in close(), stops a run that is already in flight from rescheduling a cancelled chain. Based on #5816. Fixes JAVA-837 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
force-pushed
the
no/java-837-collector-timer
branch
from
November 17, 2026 10:30
8a0aeef to
dd1a717
Compare
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.
DefaultCompositePerformanceCollectorsamples CPU and memory every 100ms for running transactions and profiles. It did this on ajava.util.Timer, which schedules on the wall clock: after a backward clock step, sampling stopped until the clock caught up. The 30s collection timeout runs in the same task, so it stalled too.The loop now runs on
options.getTimerExecutorService(), which schedules onSystem.nanoTime()and is already used bySentryTracerfor its idle and deadline timeouts. That executor only has a one-shotschedule(), so each run schedules the next one:The generation counter is the part worth reviewing.
cancel()can't stop a run that is already executing, and that run may itself close the collector by timing out the last transaction. Without the check it would reschedule a chain that was just cancelled.Only scheduling changes. Samples are stamped and computed as before, so no metric or API changes. The collector also no longer creates a thread for each burst of transactions.
Based on #5816, which made the same change and was closed without review. The 30s timeout fix in this class (#6101) is only on
9.x.x, so expect a small conflict the next timemainis merged into it.#skip-changelog
🤖 Generated with Claude Code