Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void testMetrics() throws Exception {
final BlobStore blobStore = blobStoreRepository.blobStore();
final BlobStore delegateBlobStore = ((BlobStoreWrapper) blobStore).delegate();
final S3BlobStore s3BlobStore = (S3BlobStore) delegateBlobStore;
final Map<S3BlobStore.StatsKey, S3BlobStore.IgnoreNoResponseMetricsCollector> statsCollectors = s3BlobStore
final Map<S3BlobStore.StatsKey, S3BlobStore.ElasticsearchS3MetricsCollector> statsCollectors = s3BlobStore
.getStatsCollectors().collectors;

final var plugins = internalCluster().getInstance(PluginsService.class, nodeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,17 @@ public TimeValue getCompareAndExchangeAntiContentionDelay() {
return service.compareAndExchangeAntiContentionDelay;
}

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

final LongAdder requests = new LongAdder();
final LongAdder operations = new LongAdder();
private final Operation operation;
private final Map<String, Object> attributes;

private IgnoreNoResponseMetricsCollector(Operation operation, OperationPurpose purpose) {
private ElasticsearchS3MetricsCollector(Operation operation, OperationPurpose purpose) {
this.operation = operation;
this.attributes = RepositoriesMetrics.createAttributesMap(repositoryMetadata, purpose, operation.getKey());
}
Expand Down Expand Up @@ -582,7 +583,7 @@ public String toString() {
}

class StatsCollectors {
final Map<StatsKey, IgnoreNoResponseMetricsCollector> collectors = new ConcurrentHashMap<>();
final Map<StatsKey, ElasticsearchS3MetricsCollector> collectors = new ConcurrentHashMap<>();

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

IgnoreNoResponseMetricsCollector buildMetricCollector(Operation operation, OperationPurpose purpose) {
return new IgnoreNoResponseMetricsCollector(operation, purpose);
ElasticsearchS3MetricsCollector buildMetricCollector(Operation operation, OperationPurpose purpose) {
return new ElasticsearchS3MetricsCollector(operation, purpose);
}
}

Expand Down