Skip to content

Commit b2a27bd

Browse files
authored
Rename IgnoreNoResponseMetricsCollector (elastic#125934) (elastic#125945)
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 f0ff2f0 commit b2a27bd

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
@@ -282,7 +282,7 @@ public void testMetrics() throws Exception {
282282
final BlobStore blobStore = blobStoreRepository.blobStore();
283283
final BlobStore delegateBlobStore = ((BlobStoreWrapper) blobStore).delegate();
284284
final S3BlobStore s3BlobStore = (S3BlobStore) delegateBlobStore;
285-
final Map<S3BlobStore.StatsKey, S3BlobStore.IgnoreNoResponseMetricsCollector> statsCollectors = s3BlobStore
285+
final Map<S3BlobStore.StatsKey, S3BlobStore.ElasticsearchS3MetricsCollector> statsCollectors = s3BlobStore
286286
.getStatsCollectors().collectors;
287287

288288
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
@@ -134,15 +134,16 @@ public TimeValue getCompareAndExchangeAntiContentionDelay() {
134134
return service.compareAndExchangeAntiContentionDelay;
135135
}
136136

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

141142
final LongAdder counter = new LongAdder();
142143
private final Operation operation;
143144
private final Map<String, Object> attributes;
144145

145-
private IgnoreNoResponseMetricsCollector(Operation operation, OperationPurpose purpose) {
146+
private ElasticsearchS3MetricsCollector(Operation operation, OperationPurpose purpose) {
146147
this.operation = operation;
147148
this.attributes = Map.of(
148149
"repo_type",
@@ -519,7 +520,7 @@ public String toString() {
519520
}
520521

521522
class StatsCollectors {
522-
final Map<StatsKey, IgnoreNoResponseMetricsCollector> collectors = new ConcurrentHashMap<>();
523+
final Map<StatsKey, ElasticsearchS3MetricsCollector> collectors = new ConcurrentHashMap<>();
523524

524525
RequestMetricCollector getMetricCollector(Operation operation, OperationPurpose purpose) {
525526
return collectors.computeIfAbsent(new StatsKey(operation, purpose), k -> buildMetricCollector(k.operation(), k.purpose()));
@@ -537,8 +538,8 @@ Map<String, Long> statsMap(boolean isStateless) {
537538
}
538539
}
539540

540-
IgnoreNoResponseMetricsCollector buildMetricCollector(Operation operation, OperationPurpose purpose) {
541-
return new IgnoreNoResponseMetricsCollector(operation, purpose);
541+
ElasticsearchS3MetricsCollector buildMetricCollector(Operation operation, OperationPurpose purpose) {
542+
return new ElasticsearchS3MetricsCollector(operation, purpose);
542543
}
543544
}
544545

0 commit comments

Comments
 (0)