Skip to content

Commit 31088f5

Browse files
authored
Fix units in metrics, stop using cached time (#133456)
1 parent 68dbec9 commit 31088f5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server/src/main/java/org/elasticsearch/repositories/SnapshotMetrics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public SnapshotMetrics(MeterRegistry meterRegistry) {
7171
meterRegistry.registerLongCounter(SNAPSHOT_BYTES_UPLOADED, "snapshot bytes uploaded", "bytes"),
7272
meterRegistry.registerLongCounter(SNAPSHOT_UPLOAD_DURATION, "snapshot upload duration", "ms"),
7373
meterRegistry.registerLongCounter(SNAPSHOT_UPLOAD_READ_DURATION, "time spent in read() calls when snapshotting", "ms"),
74-
meterRegistry.registerLongCounter(SNAPSHOT_CREATE_THROTTLE_DURATION, "time throttled in snapshot create", "bytes"),
75-
meterRegistry.registerLongCounter(SNAPSHOT_RESTORE_THROTTLE_DURATION, "time throttled in snapshot restore", "bytes"),
74+
meterRegistry.registerLongCounter(SNAPSHOT_CREATE_THROTTLE_DURATION, "time throttled in snapshot create", "ns"),
75+
meterRegistry.registerLongCounter(SNAPSHOT_RESTORE_THROTTLE_DURATION, "time throttled in snapshot restore", "ns"),
7676
meterRegistry
7777
);
7878
}

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4156,9 +4156,9 @@ private void checkAborted() {
41564156
};
41574157
final String partName = fileInfo.partName(i);
41584158
logger.trace("[{}] Writing [{}] to [{}]", metadata.name(), partName, shardContainer.path());
4159-
final long startMillis = threadPool.relativeTimeInMillis();
4159+
final long startMillis = threadPool.rawRelativeTimeInMillis();
41604160
shardContainer.writeBlob(OperationPurpose.SNAPSHOT_DATA, partName, inputStream, partBytes, false);
4161-
final long uploadTimeInMillis = threadPool.relativeTimeInMillis() - startMillis;
4161+
final long uploadTimeInMillis = threadPool.rawRelativeTimeInMillis() - startMillis;
41624162
blobStoreSnapshotMetrics.incrementCountersForPartUpload(partBytes, uploadTimeInMillis);
41634163
logger.trace(
41644164
"[{}] Writing [{}] of size [{}b] to [{}] took [{}ms]",

0 commit comments

Comments
 (0)