Skip to content

Commit 6048d26

Browse files
authored
Rename IgnoreNoResponseMetricsCollector (elastic#125934)
Originally this metrics collector was just there to ignore API calls that didn't make it all the way to S3, but (a) it doesn't really do that because it also apparently ignores 4xx responses and (b) it also does a bunch of other metrics collection too. `IgnoreNoResponseMetricsCollector` is definitely the wrong name these days so this commit renames it to something more general.
1 parent 505f21b commit 6048d26

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

modules/repository-s3/src/internalClusterTest/java/org/elasticsearch/repositories/s3/S3BlobStoreRepositoryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public void testMetrics() throws Exception {
285285
final BlobStore blobStore = blobStoreRepository.blobStore();
286286
final BlobStore delegateBlobStore = ((BlobStoreWrapper) blobStore).delegate();
287287
final S3BlobStore s3BlobStore = (S3BlobStore) delegateBlobStore;
288-
final Map<S3BlobStore.StatsKey, S3BlobStore.IgnoreNoResponseMetricsCollector> statsCollectors = s3BlobStore
288+
final Map<S3BlobStore.StatsKey, S3BlobStore.ElasticsearchS3MetricsCollector> statsCollectors = s3BlobStore
289289
.getStatsCollectors().collectors;
290290

291291
final var plugins = internalCluster().getInstance(PluginsService.class, nodeName)

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,17 @@ public TimeValue getCompareAndExchangeAntiContentionDelay() {
143143
return service.compareAndExchangeAntiContentionDelay;
144144
}
145145

146-
// metrics collector that ignores null responses that we interpret as the request not reaching the S3 endpoint due to a network
147-
// issue
148-
class IgnoreNoResponseMetricsCollector extends RequestMetricCollector {
146+
/**
147+
* A {@link RequestMetricCollector} that processes the metrics related to each API invocation attempt according to Elasticsearch's needs
148+
*/
149+
class ElasticsearchS3MetricsCollector extends RequestMetricCollector {
149150

150151
final LongAdder requests = new LongAdder();
151152
final LongAdder operations = new LongAdder();
152153
private final Operation operation;
153154
private final Map<String, Object> attributes;
154155

155-
private IgnoreNoResponseMetricsCollector(Operation operation, OperationPurpose purpose) {
156+
private ElasticsearchS3MetricsCollector(Operation operation, OperationPurpose purpose) {
156157
this.operation = operation;
157158
this.attributes = RepositoriesMetrics.createAttributesMap(repositoryMetadata, purpose, operation.getKey());
158159
}
@@ -582,7 +583,7 @@ public String toString() {
582583
}
583584

584585
class StatsCollectors {
585-
final Map<StatsKey, IgnoreNoResponseMetricsCollector> collectors = new ConcurrentHashMap<>();
586+
final Map<StatsKey, ElasticsearchS3MetricsCollector> collectors = new ConcurrentHashMap<>();
586587

587588
RequestMetricCollector getMetricCollector(Operation operation, OperationPurpose purpose) {
588589
return collectors.computeIfAbsent(new StatsKey(operation, purpose), k -> buildMetricCollector(k.operation(), k.purpose()));
@@ -605,8 +606,8 @@ Map<String, BlobStoreActionStats> statsMap(boolean isStateless) {
605606
}
606607
}
607608

608-
IgnoreNoResponseMetricsCollector buildMetricCollector(Operation operation, OperationPurpose purpose) {
609-
return new IgnoreNoResponseMetricsCollector(operation, purpose);
609+
ElasticsearchS3MetricsCollector buildMetricCollector(Operation operation, OperationPurpose purpose) {
610+
return new ElasticsearchS3MetricsCollector(operation, purpose);
610611
}
611612
}
612613

0 commit comments

Comments
 (0)