Skip to content

Add missing GaugeCounter increment. #6966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ private synchronized void scheduleCpuMetricCollectionOnce(Timer referenceTime) {
CpuMetricReading currCpuReading = syncCollectCpuMetric(referenceTime);
if (currCpuReading != null) {
cpuMetricReadings.add(currCpuReading);
GaugeCounter.INSTANCE.incrementCounter();
}
},
/* initialDelay */ 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ private synchronized void scheduleMemoryMetricCollectionOnce(Timer referenceTime
AndroidMemoryReading memoryReading = syncCollectMemoryMetric(referenceTime);
if (memoryReading != null) {
memoryMetricReadings.add(memoryReading);
GaugeCounter.INSTANCE.incrementCounter();
}
},
/* initialDelay */ 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public void testGaugeCounterStartsAJobToConsumeTheGeneratedMetrics() throws Inte
PerfSession fakeSession = createTestSession(1);
testGaugeManager.setApplicationProcessState(ApplicationProcessState.FOREGROUND);
testGaugeManager.startCollectingGauges(fakeSession);
GaugeCounter.INSTANCE.setGaugeManager(testGaugeManager);
GaugeCounter.setGaugeManager(testGaugeManager);

// There's no job to log the gauges.
assertThat(fakeScheduledExecutorService.isEmpty()).isTrue();
Expand Down Expand Up @@ -377,7 +377,7 @@ public void testUpdateAppStateHandlesMultipleAppStates() {
fakeSession.setGaugeAndEventCollectionEnabled(true);
testGaugeManager.setApplicationProcessState(ApplicationProcessState.FOREGROUND);
testGaugeManager.startCollectingGauges(fakeSession);
GaugeCounter.INSTANCE.setGaugeManager(testGaugeManager);
GaugeCounter.setGaugeManager(testGaugeManager);

// Generate metrics that don't exceed the GaugeCounter.MAX_COUNT.
generateMetricsAndIncrementCounter(10);
Expand Down
Loading