Skip to content

Commit 7cebca4

Browse files
committed
tidy
1 parent a3d427b commit 7cebca4

File tree

4 files changed

+25
-65
lines changed

4 files changed

+25
-65
lines changed

modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ OptionalBytesReference compareAndExchangeRegister(
751751
Storage.BlobTargetOption.generationMatch()
752752
)
753753
);
754-
stats.trackOperation(OperationPurpose.SNAPSHOT_DATA, Operation.MULTIPART_UPLOAD);
754+
stats.trackOperation(purpose, Operation.MULTIPART_UPLOAD);
755755
return OptionalBytesReference.of(expected);
756756
} catch (Exception e) {
757757
final var serviceException = unwrapServiceException(e);

modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageOperationsStats.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ final class GoogleCloudStorageOperationsStats {
2424
* Represented by {@code Map<Purpose,Map<Operation,Counters>>}
2525
* <pre>
2626
* {@code
27-
* | Purpose | Operation | OperationsCnt | RequestCnt |
28-
* |--------------+-------------+---------------+-------------|
29-
* | SnapshotData | GetObject | 10 | 10 |
30-
* | SnapshotData | ListObjects | 20 | 21(1 retry) |
31-
* | SnapshotData | ... | | |
32-
* | Translog | GetObject | 5 | 5 |
33-
* | ... | | | |
27+
* | Purpose | Operation | OperationsCnt | RequestCnt |
28+
* |--------------+-----------------+---------------+------------|
29+
* | SnapshotData | GetObject | 1 | 1 |
30+
* | SnapshotData | ListObjects | 2 | 2 |
31+
* | SnapshotData | ResumableUpload | 1 | 10 |
32+
* | SnapshotData | ... | | |
33+
* | Translog | GetObject | 5 | 5 |
34+
* | ... | | | |
3435
* }
3536
* </pre>
3637
*/

modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainerStatsTests.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageClientSettings.CONNECT_TIMEOUT_SETTING;
5353
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageClientSettings.PROJECT_ID_SETTING;
5454
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageClientSettings.READ_TIMEOUT_SETTING;
55+
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageOperationsStats.Operation;
5556
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageOperationsStats.Operation.GET_OBJECT;
5657
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageOperationsStats.Operation.MULTIPART_UPLOAD;
5758
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageOperationsStats.Operation.RESUMABLE_UPLOAD;
58-
import static org.elasticsearch.repositories.gcs.GoogleCloudStorageOperationsStatsTests.StatsMap;
5959

6060
@SuppressForbidden(reason = "Uses a HttpServer to emulate a Google Cloud Storage endpoint")
6161
public class GoogleCloudStorageBlobContainerStatsTests extends ESTestCase {
@@ -275,6 +275,21 @@ protected String getEndpointForServer(final HttpServer server) {
275275
return "http://" + address.getHostString() + ":" + address.getPort();
276276
}
277277

278+
static class StatsMap extends HashMap<String, BlobStoreActionStats> {
279+
StatsMap() {
280+
for (var purpose : OperationPurpose.values()) {
281+
for (var operation : Operation.values()) {
282+
put(purpose + "_" + operation, new BlobStoreActionStats(0, 0));
283+
}
284+
}
285+
}
286+
287+
StatsMap add(OperationPurpose purpose, Operation operation, long ops, long reqs) {
288+
put(purpose + "_" + operation, new BlobStoreActionStats(ops, reqs));
289+
return this;
290+
}
291+
}
292+
278293
private record ContainerAndBlobStore(GoogleCloudStorageBlobContainer blobContainer, GoogleCloudStorageBlobStore blobStore)
279294
implements
280295
Closeable {

modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageOperationsStatsTests.java

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)