@@ -105,26 +105,28 @@ public static synchronized GaugeManager getInstance() {
105
105
return instance ;
106
106
}
107
107
108
- public void updateGaugeLogging (String sessionId , ApplicationProcessState applicationProcessState , long collectionFrequency ) {
108
+ public void updateGaugeLogging (
109
+ String sessionId , ApplicationProcessState applicationProcessState , long collectionFrequency ) {
109
110
try {
110
111
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 );
121
122
122
123
} catch (RejectedExecutionException e ) {
123
124
logger .warn ("Unable to start collecting Gauges: " + e .getMessage ());
124
125
}
125
126
}
126
127
127
- public long updateGaugeCollection (ApplicationProcessState applicationProcessState , Timer gaugeCollectionTimer ) {
128
+ public long updateGaugeCollection (
129
+ ApplicationProcessState applicationProcessState , Timer gaugeCollectionTimer ) {
128
130
if (isCollectingGauges ) {
129
131
stopCollectingGauges ();
130
132
}
@@ -364,20 +366,20 @@ public void collectGaugeMetricOnce(Timer referenceTime) {
364
366
collectGaugeMetricOnce (cpuGaugeCollector .get (), memoryGaugeCollector .get (), referenceTime );
365
367
}
366
368
367
- public void logExistingGaugeMetrics (String sessionId , ApplicationProcessState applicationProcessState ) {
369
+ public void logExistingGaugeMetrics (
370
+ String sessionId , ApplicationProcessState applicationProcessState ) {
368
371
// Flush any data that was collected and associate it with the given session ID and
369
372
// applicationProcessState.
370
373
@ SuppressWarnings ("FutureReturnValueIgnored" )
371
374
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 );
381
383
}
382
384
383
385
private static void collectGaugeMetricOnce (
@@ -452,6 +454,8 @@ private long getMemoryGaugeCollectionFrequencyMs(
452
454
}
453
455
454
456
private long getGaugeLoggingFrequency (ApplicationProcessState applicationProcessState ) {
455
- return Math .min (getMemoryGaugeCollectionFrequencyMs (applicationProcessState ), getCpuGaugeCollectionFrequencyMs (applicationProcessState ));
457
+ return Math .min (
458
+ getMemoryGaugeCollectionFrequencyMs (applicationProcessState ),
459
+ getCpuGaugeCollectionFrequencyMs (applicationProcessState ));
456
460
}
457
461
}
0 commit comments