Skip to content

Commit 8102e0f

Browse files
committed
style
1 parent ab0707f commit 8102e0f

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/session/FirebasePerformanceSessionSubscriber.kt

+5-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ class FirebasePerformanceSessionSubscriber(override val isDataCollectionEnabled:
3131
FirebaseSessionsEnforcementCheck.checkSession(currentPerfSession, "onSessionChanged")
3232

3333
if (currentPerfSession.isLegacy() && currentPerfSession.isVerbose) {
34-
GaugeManager.getInstance().logGaugeMetadata(sessionDetails.sessionId, ApplicationProcessState.FOREGROUND)
35-
GaugeManager.getInstance().logExistingGaugeMetrics(sessionDetails.sessionId, ApplicationProcessState.FOREGROUND)
34+
GaugeManager.getInstance()
35+
.logGaugeMetadata(sessionDetails.sessionId, ApplicationProcessState.FOREGROUND)
36+
GaugeManager.getInstance()
37+
.logExistingGaugeMetrics(sessionDetails.sessionId, ApplicationProcessState.FOREGROUND)
3638
}
3739

3840
val updatedSession = PerfSession.createWithId(sessionDetails.sessionId)
3941
SessionManager.getInstance().updatePerfSession(updatedSession)
4042
GaugeManager.getInstance()
4143
.logGaugeMetadata(updatedSession.sessionId(), ApplicationProcessState.FOREGROUND)
42-
SessionManager.getInstance().updateGaugeCollectionOnNewSession();
44+
SessionManager.getInstance().updateGaugeCollectionOnNewSession()
4345
}
4446
}

firebase-perf/src/main/java/com/google/firebase/perf/session/SessionManager.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ private long updateGaugeCollection(ApplicationProcessState applicationProcessSta
180180
return gaugeManager.updateGaugeCollection(applicationProcessState, perfSession.getTimer());
181181
}
182182

183-
private void updateGaugeLogging(String sessionId, ApplicationProcessState applicationProcessState, long collectionFrequency) {
183+
private void updateGaugeLogging(
184+
String sessionId, ApplicationProcessState applicationProcessState, long collectionFrequency) {
184185
gaugeManager.updateGaugeLogging(sessionId, applicationProcessState, collectionFrequency);
185186
}
186187

firebase-perf/src/main/java/com/google/firebase/perf/session/gauges/GaugeManager.java

+27-23
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,28 @@ public static synchronized GaugeManager getInstance() {
105105
return instance;
106106
}
107107

108-
public void updateGaugeLogging(String sessionId, ApplicationProcessState applicationProcessState, long collectionFrequency) {
108+
public void updateGaugeLogging(
109+
String sessionId, ApplicationProcessState applicationProcessState, long collectionFrequency) {
109110
try {
110111
gaugeManagerDataCollectionJob =
111-
gaugeManagerExecutor
112-
.get()
113-
.scheduleWithFixedDelay(
114-
() -> {
115-
syncFlush(sessionId, applicationProcessState);
116-
},
117-
/* initialDelay= */ collectionFrequency
118-
* APPROX_NUMBER_OF_DATA_POINTS_PER_GAUGE_METRIC,
119-
/* period= */ collectionFrequency * APPROX_NUMBER_OF_DATA_POINTS_PER_GAUGE_METRIC,
120-
TimeUnit.MILLISECONDS);
112+
gaugeManagerExecutor
113+
.get()
114+
.scheduleWithFixedDelay(
115+
() -> {
116+
syncFlush(sessionId, applicationProcessState);
117+
},
118+
/* initialDelay= */ collectionFrequency
119+
* APPROX_NUMBER_OF_DATA_POINTS_PER_GAUGE_METRIC,
120+
/* period= */ collectionFrequency * APPROX_NUMBER_OF_DATA_POINTS_PER_GAUGE_METRIC,
121+
TimeUnit.MILLISECONDS);
121122

122123
} catch (RejectedExecutionException e) {
123124
logger.warn("Unable to start collecting Gauges: " + e.getMessage());
124125
}
125126
}
126127

127-
public long updateGaugeCollection(ApplicationProcessState applicationProcessState, Timer gaugeCollectionTimer) {
128+
public long updateGaugeCollection(
129+
ApplicationProcessState applicationProcessState, Timer gaugeCollectionTimer) {
128130
if (isCollectingGauges) {
129131
stopCollectingGauges();
130132
}
@@ -364,20 +366,20 @@ public void collectGaugeMetricOnce(Timer referenceTime) {
364366
collectGaugeMetricOnce(cpuGaugeCollector.get(), memoryGaugeCollector.get(), referenceTime);
365367
}
366368

367-
public void logExistingGaugeMetrics(String sessionId, ApplicationProcessState applicationProcessState) {
369+
public void logExistingGaugeMetrics(
370+
String sessionId, ApplicationProcessState applicationProcessState) {
368371
// Flush any data that was collected and associate it with the given session ID and
369372
// applicationProcessState.
370373
@SuppressWarnings("FutureReturnValueIgnored")
371374
ScheduledFuture<?> unusedFuture =
372-
gaugeManagerExecutor
373-
.get()
374-
.schedule(
375-
() -> {
376-
syncFlush(sessionId, applicationProcessState);
377-
},
378-
TIME_TO_WAIT_BEFORE_FLUSHING_GAUGES_QUEUE_MS,
379-
TimeUnit.MILLISECONDS);
380-
375+
gaugeManagerExecutor
376+
.get()
377+
.schedule(
378+
() -> {
379+
syncFlush(sessionId, applicationProcessState);
380+
},
381+
TIME_TO_WAIT_BEFORE_FLUSHING_GAUGES_QUEUE_MS,
382+
TimeUnit.MILLISECONDS);
381383
}
382384

383385
private static void collectGaugeMetricOnce(
@@ -452,6 +454,8 @@ private long getMemoryGaugeCollectionFrequencyMs(
452454
}
453455

454456
private long getGaugeLoggingFrequency(ApplicationProcessState applicationProcessState) {
455-
return Math.min(getMemoryGaugeCollectionFrequencyMs(applicationProcessState), getCpuGaugeCollectionFrequencyMs(applicationProcessState));
457+
return Math.min(
458+
getMemoryGaugeCollectionFrequencyMs(applicationProcessState),
459+
getCpuGaugeCollectionFrequencyMs(applicationProcessState));
456460
}
457461
}

0 commit comments

Comments
 (0)