@@ -172,13 +172,14 @@ void writeIndexingBuffersTime(long took) {
172172 }
173173
174174 static class StatsHolder {
175- private final MeanMetric indexMetric = new MeanMetric (); // Used for the count and total 'took' time (in ns) of index operations
176- private final LongAdder writeIndexingBufferTime = new LongAdder ();
175+ // Used for the count and total 'took' time (in ns) of index operations
176+ private final MeanMetric indexMetric = new MeanMetric ();
177177 // Used for the total time taken to flush indexing buffers to disk (on indexing threads) (in ns)
178+ private final LongAdder writeIndexingBufferTime = new LongAdder ();
179+ // An EWMR of the total 'took' time of index operations (indexMetric) plus the writeIndexingBufferTime (in ns)
178180 private final ExponentiallyWeightedMovingRate recentIndexMetric ;
179- // An EWMR of the total 'took' time of index operations (in ns) plus the writeIndexingBufferTime
180- private final AtomicReference <Double > peakIndexMetric ;
181181 // The peak value of the EWMR (recentIndexMetric) observed in any stats() call
182+ private final AtomicReference <Double > peakIndexMetric ;
182183 private final MeanMetric deleteMetric = new MeanMetric ();
183184 private final CounterMetric indexCurrent = new CounterMetric ();
184185 private final CounterMetric indexFailed = new CounterMetric ();
@@ -208,8 +209,9 @@ IndexingStats.Stats stats(
208209 ) {
209210 final long totalIndexingTimeInNanos = indexMetric .sum ();
210211 final long totalIndexingTimeSinceShardStartedInNanos = totalIndexingTimeInNanos - indexingTimeBeforeShardStartedInNanos ;
211- final long totalIndexingLoadInNanos = totalIndexingTimeInNanos + writeIndexingBufferTime .sum ();
212- final long totalIndexingLoadSinceShardStartedInNanos = totalIndexingLoadInNanos - indexingLoadBeforeShardStartedInNanos ;
212+ // This is different from indexing time as it also includes the
213+ final long totalIndexingExecutionTimeInNanos = totalIndexingTimeInNanos + writeIndexingBufferTime .sum ();
214+ final long totalIndexingExecutionTimeSinceShardStartedInNanos = totalIndexingExecutionTimeInNanos - indexingLoadBeforeShardStartedInNanos ;
213215 final double recentIndexingLoadSinceShardStarted = recentIndexMetric .calculateRateSince (
214216 currentTimeInNanos ,
215217 recentIndexMetric .getRate (currentTimeInNanos ),
@@ -243,7 +245,7 @@ IndexingStats.Stats stats(
243245 isThrottled ,
244246 TimeUnit .MILLISECONDS .toMillis (currentThrottleMillis ),
245247 totalIndexingTimeSinceShardStartedInNanos ,
246- totalIndexingLoadSinceShardStartedInNanos ,
248+ totalIndexingExecutionTimeSinceShardStartedInNanos ,
247249 timeSinceShardStartedInNanos ,
248250 recentIndexingLoadSinceShardStarted ,
249251 peakIndexingLoad
0 commit comments