diff --git a/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricCollector.java b/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricCollector.java index b90d73f2..db882198 100644 --- a/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricCollector.java +++ b/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricCollector.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.stream.Collectors; +import org.apache.kafka.common.MetricNameTemplate; import org.apache.kafka.common.metrics.JmxReporter; import org.apache.kafka.common.metrics.KafkaMetricsContext; import org.apache.kafka.common.metrics.MetricConfig; @@ -39,64 +40,240 @@ import software.amazon.awssdk.metrics.MetricCollection; import software.amazon.awssdk.metrics.MetricPublisher; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.ABORT_MULTIPART_UPLOAD_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.ABORT_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.ABORT_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.ABORT_MULTIPART_UPLOAD_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.ABORT_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.ABORT_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.COMPLETE_MULTIPART_UPLOAD_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.COMPLETE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.COMPLETE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.COMPLETE_MULTIPART_UPLOAD_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.COMPLETE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.COMPLETE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CONFIGURED_TIMEOUT_ERRORS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CONFIGURED_TIMEOUT_ERRORS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CONFIGURED_TIMEOUT_ERRORS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CREATE_MULTIPART_UPLOAD_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CREATE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CREATE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CREATE_MULTIPART_UPLOAD_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CREATE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.CREATE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECTS_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECTS_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECTS_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECTS_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECTS_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECTS_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECT_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECT_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECT_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECT_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECT_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.DELETE_OBJECT_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.GET_OBJECT_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.GET_OBJECT_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.GET_OBJECT_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.GET_OBJECT_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.GET_OBJECT_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.GET_OBJECT_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.IO_ERRORS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.IO_ERRORS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.IO_ERRORS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.METRIC_CONTEXT; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.OTHER_ERRORS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.OTHER_ERRORS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.OTHER_ERRORS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.PUT_OBJECT_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.PUT_OBJECT_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.PUT_OBJECT_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.PUT_OBJECT_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.PUT_OBJECT_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.PUT_OBJECT_TIME_MAX_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.SERVER_ERRORS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.SERVER_ERRORS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.SERVER_ERRORS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.THROTTLING_ERRORS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.THROTTLING_ERRORS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.THROTTLING_ERRORS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.UPLOAD_PART_REQUESTS; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.UPLOAD_PART_REQUESTS_RATE_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.UPLOAD_PART_REQUESTS_TOTAL_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.UPLOAD_PART_TIME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.UPLOAD_PART_TIME_AVG_METRIC_NAME; +import static io.aiven.kafka.tieredstorage.storage.s3.MetricRegistry.UPLOAD_PART_TIME_MAX_METRIC_NAME; import static software.amazon.awssdk.core.internal.metrics.SdkErrorType.CONFIGURED_TIMEOUT; import static software.amazon.awssdk.core.internal.metrics.SdkErrorType.IO; import static software.amazon.awssdk.core.internal.metrics.SdkErrorType.OTHER; import static software.amazon.awssdk.core.internal.metrics.SdkErrorType.SERVER_ERROR; import static software.amazon.awssdk.core.internal.metrics.SdkErrorType.THROTTLING; -class MetricCollector implements MetricPublisher { +public class MetricCollector implements MetricPublisher { private static final Logger log = LoggerFactory.getLogger(MetricCollector.class); private final org.apache.kafka.common.metrics.Metrics metrics; - private static final String METRIC_GROUP = "s3-client-metrics"; private final Map requestMetrics = new HashMap<>(); private final Map latencyMetrics = new HashMap<>(); private final Map errorMetrics = new HashMap<>(); - MetricCollector() { + public MetricCollector() { final MetricsReporter reporter = new JmxReporter(); metrics = new org.apache.kafka.common.metrics.Metrics( new MetricConfig(), List.of(reporter), Time.SYSTEM, - new KafkaMetricsContext("aiven.kafka.server.tieredstorage.s3") - ); - requestMetrics.put("GetObject", createRequestsSensor("get-object-requests")); - latencyMetrics.put("GetObject", createLatencySensor("get-object-time")); - requestMetrics.put("UploadPart", createRequestsSensor("upload-part-requests")); - latencyMetrics.put("UploadPart", createLatencySensor("upload-part-time")); - requestMetrics.put("CreateMultipartUpload", createRequestsSensor("create-multipart-upload-requests")); - latencyMetrics.put("CreateMultipartUpload", createLatencySensor("create-multipart-upload-time")); - requestMetrics.put("CompleteMultipartUpload", createRequestsSensor("complete-multipart-upload-requests")); - latencyMetrics.put("CompleteMultipartUpload", createLatencySensor("complete-multipart-upload-time")); - requestMetrics.put("PutObject", createRequestsSensor("put-object-requests")); - latencyMetrics.put("PutObject", createLatencySensor("put-object-time")); - requestMetrics.put("DeleteObject", createRequestsSensor("delete-object-requests")); - latencyMetrics.put("DeleteObject", createLatencySensor("delete-object-time")); - requestMetrics.put("DeleteObjects", createRequestsSensor("delete-objects-requests")); - latencyMetrics.put("DeleteObjects", createLatencySensor("delete-objects-time")); - requestMetrics.put("AbortMultipartUpload", createRequestsSensor("abort-multipart-upload-requests")); - latencyMetrics.put("AbortMultipartUpload", createLatencySensor("abort-multipart-upload-time")); - - errorMetrics.put(THROTTLING.toString(), createRequestsSensor("throttling-errors")); - errorMetrics.put(SERVER_ERROR.toString(), createRequestsSensor("server-errors")); - errorMetrics.put(CONFIGURED_TIMEOUT.toString(), createRequestsSensor("configured-timeout-errors")); - errorMetrics.put(IO.toString(), createRequestsSensor("io-errors")); - errorMetrics.put(OTHER.toString(), createRequestsSensor("other-errors")); + new KafkaMetricsContext(METRIC_CONTEXT) + ); + final Sensor getObjectRequestsSensor = createRequestsSensor( + GET_OBJECT_REQUESTS, + GET_OBJECT_REQUESTS_RATE_METRIC_NAME, + GET_OBJECT_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("GetObject", getObjectRequestsSensor); + final Sensor getObjectTimeSensor = createLatencySensor( + GET_OBJECT_TIME, + GET_OBJECT_TIME_AVG_METRIC_NAME, + GET_OBJECT_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("GetObject", getObjectTimeSensor); + final Sensor uploadPartRequestsSensor = createRequestsSensor( + UPLOAD_PART_REQUESTS, + UPLOAD_PART_REQUESTS_RATE_METRIC_NAME, + UPLOAD_PART_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("UploadPart", uploadPartRequestsSensor); + final Sensor uploadPartTimeSensor = createLatencySensor( + UPLOAD_PART_TIME, + UPLOAD_PART_TIME_AVG_METRIC_NAME, + UPLOAD_PART_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("UploadPart", uploadPartTimeSensor); + final Sensor createMpuRequestsSensor = createRequestsSensor( + CREATE_MULTIPART_UPLOAD_REQUESTS, + CREATE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME, + CREATE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("CreateMultipartUpload", createMpuRequestsSensor); + final Sensor createMpuTimeSensor = createLatencySensor( + CREATE_MULTIPART_UPLOAD_TIME, + CREATE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME, + CREATE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("CreateMultipartUpload", createMpuTimeSensor); + final Sensor completeMpuRequestsSensor = createRequestsSensor( + COMPLETE_MULTIPART_UPLOAD_REQUESTS, + COMPLETE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME, + COMPLETE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("CompleteMultipartUpload", completeMpuRequestsSensor); + final Sensor completeMpuTimeSensor = createLatencySensor( + COMPLETE_MULTIPART_UPLOAD_TIME, + COMPLETE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME, + COMPLETE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("CompleteMultipartUpload", completeMpuTimeSensor); + final Sensor putObjectRequestsSensor = createRequestsSensor( + PUT_OBJECT_REQUESTS, + PUT_OBJECT_REQUESTS_RATE_METRIC_NAME, + PUT_OBJECT_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("PutObject", putObjectRequestsSensor); + final Sensor putObjectTimeSensor = createLatencySensor( + PUT_OBJECT_TIME, + PUT_OBJECT_TIME_AVG_METRIC_NAME, + PUT_OBJECT_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("PutObject", putObjectTimeSensor); + final Sensor deleteObjectRequestsSensor = createRequestsSensor( + DELETE_OBJECT_REQUESTS, + DELETE_OBJECT_REQUESTS_RATE_METRIC_NAME, + DELETE_OBJECT_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("DeleteObject", deleteObjectRequestsSensor); + final Sensor deleteObjectTimeSensor = createLatencySensor( + DELETE_OBJECT_TIME, + DELETE_OBJECT_TIME_AVG_METRIC_NAME, + DELETE_OBJECT_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("DeleteObject", deleteObjectTimeSensor); + final Sensor deleteObjectsRequestsSensor = createRequestsSensor( + DELETE_OBJECTS_REQUESTS, + DELETE_OBJECTS_REQUESTS_RATE_METRIC_NAME, + DELETE_OBJECTS_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("DeleteObjects", deleteObjectsRequestsSensor); + final Sensor deleteObjectsTimeSensor = createLatencySensor( + DELETE_OBJECTS_TIME, + DELETE_OBJECTS_TIME_AVG_METRIC_NAME, + DELETE_OBJECTS_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("DeleteObjects", deleteObjectsTimeSensor); + final Sensor abortMpuRequestsSensor = createRequestsSensor( + ABORT_MULTIPART_UPLOAD_REQUESTS, + ABORT_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME, + ABORT_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME + ); + requestMetrics.put("AbortMultipartUpload", abortMpuRequestsSensor); + final Sensor abortMpuTimeSensor = createLatencySensor( + ABORT_MULTIPART_UPLOAD_TIME, + ABORT_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME, + ABORT_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME + ); + latencyMetrics.put("AbortMultipartUpload", abortMpuTimeSensor); + + final Sensor throttlingErrorsSensor = createRequestsSensor( + THROTTLING_ERRORS, + THROTTLING_ERRORS_RATE_METRIC_NAME, + THROTTLING_ERRORS_TOTAL_METRIC_NAME + ); + errorMetrics.put(THROTTLING.toString(), throttlingErrorsSensor); + final Sensor serverErrorsSensor = createRequestsSensor( + SERVER_ERRORS, + SERVER_ERRORS_RATE_METRIC_NAME, + SERVER_ERRORS_TOTAL_METRIC_NAME + ); + errorMetrics.put(SERVER_ERROR.toString(), serverErrorsSensor); + final Sensor configuredTimeoutErrorsSensor = createRequestsSensor( + CONFIGURED_TIMEOUT_ERRORS, + CONFIGURED_TIMEOUT_ERRORS_RATE_METRIC_NAME, + CONFIGURED_TIMEOUT_ERRORS_TOTAL_METRIC_NAME + ); + errorMetrics.put(CONFIGURED_TIMEOUT.toString(), configuredTimeoutErrorsSensor); + final Sensor ioErrorsSensor = createRequestsSensor( + IO_ERRORS, + IO_ERRORS_RATE_METRIC_NAME, + IO_ERRORS_TOTAL_METRIC_NAME + ); + errorMetrics.put(IO.toString(), ioErrorsSensor); + final Sensor otherErrorsSensor = createRequestsSensor( + OTHER_ERRORS, + OTHER_ERRORS_RATE_METRIC_NAME, + OTHER_ERRORS_TOTAL_METRIC_NAME + ); + errorMetrics.put(OTHER.toString(), otherErrorsSensor); } - private Sensor createRequestsSensor(final String name) { + private Sensor createRequestsSensor( + final String name, + final MetricNameTemplate rateMetricName, + final MetricNameTemplate totalMetricName + ) { final Sensor sensor = metrics.sensor(name); - sensor.add(metrics.metricName(name + "-rate", METRIC_GROUP), new Rate()); - sensor.add(metrics.metricName(name + "-total", METRIC_GROUP), new CumulativeCount()); + sensor.add(metrics.metricInstance(rateMetricName), new Rate()); + sensor.add(metrics.metricInstance(totalMetricName), new CumulativeCount()); return sensor; } - private Sensor createLatencySensor(final String name) { + private Sensor createLatencySensor( + final String name, + final MetricNameTemplate avgMetricName, + final MetricNameTemplate maxMetricName + ) { final Sensor sensor = metrics.sensor(name); - sensor.add(metrics.metricName(name + "-max", METRIC_GROUP), new Max()); - sensor.add(metrics.metricName(name + "-avg", METRIC_GROUP), new Avg()); + sensor.add(metrics.metricInstance(maxMetricName), new Max()); + sensor.add(metrics.metricInstance(avgMetricName), new Avg()); return sensor; } diff --git a/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricRegistry.java b/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricRegistry.java new file mode 100644 index 00000000..39f330f4 --- /dev/null +++ b/storage/s3/src/main/java/io/aiven/kafka/tieredstorage/storage/s3/MetricRegistry.java @@ -0,0 +1,377 @@ +/* + * Copyright 2024 Aiven Oy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.aiven.kafka.tieredstorage.storage.s3; + +import java.util.List; + +import org.apache.kafka.common.MetricNameTemplate; + +public class MetricRegistry { + public static final String METRIC_CONTEXT = "aiven.kafka.server.tieredstorage.s3"; + + static final String METRIC_GROUP = "s3-client-metrics"; + static final String GET_OBJECT_REQUESTS = "get-object-requests"; + static final String GET_OBJECT_REQUESTS_RATE = GET_OBJECT_REQUESTS + "-rate"; + static final String GET_OBJECT_REQUESTS_TOTAL = GET_OBJECT_REQUESTS + "-total"; + static final String GET_OBJECT_REQUESTS_DOC = "get object request operations"; + static final String GET_OBJECT_TIME = "get-object-time"; + static final String GET_OBJECT_TIME_AVG = GET_OBJECT_TIME + "-avg"; + static final String GET_OBJECT_TIME_MAX = GET_OBJECT_TIME + "-max"; + static final String GET_OBJECT_TIME_DOC = "time spent getting a response from a get object request"; + static final String PUT_OBJECT_REQUESTS = "put-object-requests"; + static final String PUT_OBJECT_REQUESTS_RATE = PUT_OBJECT_REQUESTS + "-rate"; + static final String PUT_OBJECT_REQUESTS_TOTAL = PUT_OBJECT_REQUESTS + "-total"; + static final String PUT_OBJECT_REQUESTS_DOC = "put object request operations"; + static final String PUT_OBJECT_TIME = "put-object-time"; + static final String PUT_OBJECT_TIME_AVG = PUT_OBJECT_TIME + "-avg"; + static final String PUT_OBJECT_TIME_MAX = PUT_OBJECT_TIME + "-max"; + static final String PUT_OBJECT_TIME_DOC = "time spent uploading an object"; + static final String DELETE_OBJECT_REQUESTS = "delete-object-requests"; + static final String DELETE_OBJECT_REQUESTS_RATE = DELETE_OBJECT_REQUESTS + "-rate"; + static final String DELETE_OBJECT_REQUESTS_TOTAL = DELETE_OBJECT_REQUESTS + "-total"; + static final String DELETE_OBJECT_REQUESTS_DOC = "delete object request operations"; + static final String DELETE_OBJECT_TIME = "delete-object-time"; + static final String DELETE_OBJECT_TIME_AVG = DELETE_OBJECT_TIME + "-avg"; + static final String DELETE_OBJECT_TIME_MAX = DELETE_OBJECT_TIME + "-max"; + static final String DELETE_OBJECT_TIME_DOC = "time spent deleting an object"; + static final String DELETE_OBJECTS_REQUESTS = "delete-objects-requests"; + static final String DELETE_OBJECTS_REQUESTS_RATE = DELETE_OBJECTS_REQUESTS + "-rate"; + static final String DELETE_OBJECTS_REQUESTS_TOTAL = DELETE_OBJECTS_REQUESTS + "-total"; + static final String DELETE_OBJECTS_REQUESTS_DOC = "delete a set of objects request operations"; + static final String DELETE_OBJECTS_TIME = "delete-objects-time"; + static final String DELETE_OBJECTS_TIME_AVG = DELETE_OBJECTS_TIME + "-avg"; + static final String DELETE_OBJECTS_TIME_MAX = DELETE_OBJECTS_TIME + "-max"; + static final String DELETE_OBJECTS_TIME_DOC = "time spent deleting a set of objects"; + static final String UPLOAD_PART_REQUESTS = "upload-part-requests"; + static final String UPLOAD_PART_REQUESTS_RATE = UPLOAD_PART_REQUESTS + "-rate"; + static final String UPLOAD_PART_REQUESTS_TOTAL = UPLOAD_PART_REQUESTS + "-total"; + static final String UPLOAD_PART_REQUESTS_DOC = "upload part request operations " + + "(as part of multi-part upload)"; + static final String UPLOAD_PART_TIME = "upload-part-time"; + static final String UPLOAD_PART_TIME_AVG = UPLOAD_PART_TIME + "-avg"; + static final String UPLOAD_PART_TIME_MAX = UPLOAD_PART_TIME + "-max"; + static final String UPLOAD_PART_TIME_DOC = "time spent uploading a single part"; + static final String CREATE_MULTIPART_UPLOAD_REQUESTS = "create-multipart-upload-requests"; + static final String CREATE_MULTIPART_UPLOAD_REQUESTS_RATE = CREATE_MULTIPART_UPLOAD_REQUESTS + "-rate"; + static final String CREATE_MULTIPART_UPLOAD_REQUESTS_TOTAL = CREATE_MULTIPART_UPLOAD_REQUESTS + "-total"; + static final String CREATE_MULTIPART_UPLOAD_REQUESTS_DOC = "create multi-part upload operations"; + static final String CREATE_MULTIPART_UPLOAD_TIME = "create-multipart-upload-time"; + static final String CREATE_MULTIPART_UPLOAD_TIME_AVG = CREATE_MULTIPART_UPLOAD_TIME + "-avg"; + static final String CREATE_MULTIPART_UPLOAD_TIME_MAX = CREATE_MULTIPART_UPLOAD_TIME + "-max"; + static final String CREATE_MULTIPART_UPLOAD_TIME_DOC = "time spent creating a new multi-part upload operation"; + static final String COMPLETE_MULTIPART_UPLOAD_REQUESTS = "complete-multipart-upload-requests"; + static final String COMPLETE_MULTIPART_UPLOAD_REQUESTS_RATE = COMPLETE_MULTIPART_UPLOAD_REQUESTS + "-rate"; + static final String COMPLETE_MULTIPART_UPLOAD_REQUESTS_TOTAL = COMPLETE_MULTIPART_UPLOAD_REQUESTS + "-total"; + static final String COMPLETE_MULTIPART_UPLOAD_REQUESTS_DOC = "complete multi-part upload operations"; + static final String COMPLETE_MULTIPART_UPLOAD_TIME = "complete-multipart-upload-time"; + static final String COMPLETE_MULTIPART_UPLOAD_TIME_AVG = COMPLETE_MULTIPART_UPLOAD_TIME + "-avg"; + static final String COMPLETE_MULTIPART_UPLOAD_TIME_MAX = COMPLETE_MULTIPART_UPLOAD_TIME + "-max"; + static final String COMPLETE_MULTIPART_UPLOAD_TIME_DOC = "time spent completing a new multi-part upload operation"; + static final String ABORT_MULTIPART_UPLOAD_REQUESTS = "abort-multipart-upload-requests"; + static final String ABORT_MULTIPART_UPLOAD_REQUESTS_RATE = ABORT_MULTIPART_UPLOAD_REQUESTS + "-rate"; + static final String ABORT_MULTIPART_UPLOAD_REQUESTS_TOTAL = ABORT_MULTIPART_UPLOAD_REQUESTS + "-total"; + static final String ABORT_MULTIPART_UPLOAD_REQUESTS_DOC = "abort multi-part upload operations"; + static final String ABORT_MULTIPART_UPLOAD_TIME = "abort-multipart-upload-time"; + static final String ABORT_MULTIPART_UPLOAD_TIME_AVG = ABORT_MULTIPART_UPLOAD_TIME + "-avg"; + static final String ABORT_MULTIPART_UPLOAD_TIME_MAX = ABORT_MULTIPART_UPLOAD_TIME + "-max"; + static final String ABORT_MULTIPART_UPLOAD_TIME_DOC = "time spent aborting a new multi-part upload operation"; + + static final String THROTTLING_ERRORS = "throttling-errors"; + static final String THROTTLING_ERRORS_RATE = THROTTLING_ERRORS + "-rate"; + static final String THROTTLING_ERRORS_TOTAL = THROTTLING_ERRORS + "-total"; + static final String THROTTLING_ERRORS_DOC = "throttling errors"; + static final String SERVER_ERRORS = "server-errors"; + static final String SERVER_ERRORS_RATE = SERVER_ERRORS + "-rate"; + static final String SERVER_ERRORS_TOTAL = SERVER_ERRORS + "-total"; + static final String SERVER_ERRORS_DOC = "server errors"; + static final String CONFIGURED_TIMEOUT_ERRORS = "configured-timeout-errors"; + static final String CONFIGURED_TIMEOUT_ERRORS_RATE = CONFIGURED_TIMEOUT_ERRORS + "-rate"; + static final String CONFIGURED_TIMEOUT_ERRORS_TOTAL = CONFIGURED_TIMEOUT_ERRORS + "-total"; + static final String CONFIGURED_TIMEOUT_ERRORS_DOC = "configured timeout errors"; + static final String IO_ERRORS = "io-errors"; + static final String IO_ERRORS_RATE = IO_ERRORS + "-rate"; + static final String IO_ERRORS_TOTAL = IO_ERRORS + "-total"; + static final String IO_ERRORS_DOC = "IO errors"; + static final String OTHER_ERRORS = "other-errors"; + static final String OTHER_ERRORS_RATE = OTHER_ERRORS + "-rate"; + static final String OTHER_ERRORS_TOTAL = OTHER_ERRORS + "-total"; + static final String OTHER_ERRORS_DOC = "other errors"; + + private static final String RATE_DOC_PREFIX = "Rate of "; + private static final String TOTAL_DOC_PREFIX = "Total number of "; + private static final String AVG_DOC_PREFIX = "Average "; + private static final String MAX_DOC_PREFIX = "Maximum "; + + static final MetricNameTemplate GET_OBJECT_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + GET_OBJECT_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + GET_OBJECT_REQUESTS_DOC + ); + static final MetricNameTemplate GET_OBJECT_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + GET_OBJECT_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + GET_OBJECT_REQUESTS_DOC + ); + static final MetricNameTemplate GET_OBJECT_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + GET_OBJECT_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + GET_OBJECT_TIME_DOC + ); + static final MetricNameTemplate GET_OBJECT_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + GET_OBJECT_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + GET_OBJECT_TIME_DOC + ); + static final MetricNameTemplate PUT_OBJECT_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + PUT_OBJECT_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + PUT_OBJECT_REQUESTS_DOC + ); + static final MetricNameTemplate PUT_OBJECT_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + PUT_OBJECT_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + PUT_OBJECT_REQUESTS_DOC + ); + static final MetricNameTemplate PUT_OBJECT_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + PUT_OBJECT_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + PUT_OBJECT_TIME_DOC + ); + static final MetricNameTemplate PUT_OBJECT_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + PUT_OBJECT_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + PUT_OBJECT_TIME_DOC + ); + static final MetricNameTemplate DELETE_OBJECT_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECT_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + DELETE_OBJECT_REQUESTS_DOC + ); + static final MetricNameTemplate DELETE_OBJECT_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECT_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + DELETE_OBJECT_REQUESTS_DOC + ); + static final MetricNameTemplate DELETE_OBJECT_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECT_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + DELETE_OBJECT_TIME_DOC + ); + static final MetricNameTemplate DELETE_OBJECT_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECT_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + DELETE_OBJECT_TIME_DOC + ); + static final MetricNameTemplate DELETE_OBJECTS_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECTS_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + DELETE_OBJECTS_REQUESTS_DOC + ); + static final MetricNameTemplate DELETE_OBJECTS_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECTS_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + DELETE_OBJECTS_REQUESTS_DOC + ); + static final MetricNameTemplate DELETE_OBJECTS_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECTS_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + DELETE_OBJECTS_TIME_DOC + ); + static final MetricNameTemplate DELETE_OBJECTS_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + DELETE_OBJECTS_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + DELETE_OBJECTS_TIME_DOC + ); + static final MetricNameTemplate UPLOAD_PART_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + UPLOAD_PART_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + UPLOAD_PART_REQUESTS_DOC + ); + static final MetricNameTemplate UPLOAD_PART_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + UPLOAD_PART_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + UPLOAD_PART_REQUESTS_DOC + ); + static final MetricNameTemplate UPLOAD_PART_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + UPLOAD_PART_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + UPLOAD_PART_TIME_DOC + ); + static final MetricNameTemplate UPLOAD_PART_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + UPLOAD_PART_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + UPLOAD_PART_TIME_DOC + ); + static final MetricNameTemplate CREATE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + CREATE_MULTIPART_UPLOAD_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + CREATE_MULTIPART_UPLOAD_REQUESTS_DOC + ); + static final MetricNameTemplate CREATE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + CREATE_MULTIPART_UPLOAD_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + CREATE_MULTIPART_UPLOAD_REQUESTS_DOC + ); + static final MetricNameTemplate CREATE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + CREATE_MULTIPART_UPLOAD_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + CREATE_MULTIPART_UPLOAD_TIME_DOC + ); + static final MetricNameTemplate CREATE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + CREATE_MULTIPART_UPLOAD_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + CREATE_MULTIPART_UPLOAD_TIME_DOC + ); + static final MetricNameTemplate COMPLETE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + COMPLETE_MULTIPART_UPLOAD_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + COMPLETE_MULTIPART_UPLOAD_REQUESTS_DOC + ); + static final MetricNameTemplate COMPLETE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + COMPLETE_MULTIPART_UPLOAD_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + COMPLETE_MULTIPART_UPLOAD_REQUESTS_DOC + ); + static final MetricNameTemplate COMPLETE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + COMPLETE_MULTIPART_UPLOAD_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + COMPLETE_MULTIPART_UPLOAD_TIME_DOC + ); + static final MetricNameTemplate COMPLETE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + COMPLETE_MULTIPART_UPLOAD_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + COMPLETE_MULTIPART_UPLOAD_TIME_DOC + ); + static final MetricNameTemplate ABORT_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME = new MetricNameTemplate( + ABORT_MULTIPART_UPLOAD_REQUESTS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + ABORT_MULTIPART_UPLOAD_REQUESTS_DOC + ); + static final MetricNameTemplate ABORT_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME = new MetricNameTemplate( + ABORT_MULTIPART_UPLOAD_REQUESTS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + ABORT_MULTIPART_UPLOAD_REQUESTS_DOC + ); + static final MetricNameTemplate ABORT_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME = new MetricNameTemplate( + ABORT_MULTIPART_UPLOAD_TIME_AVG, + METRIC_GROUP, + AVG_DOC_PREFIX + ABORT_MULTIPART_UPLOAD_TIME_DOC + ); + static final MetricNameTemplate ABORT_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME = new MetricNameTemplate( + ABORT_MULTIPART_UPLOAD_TIME_MAX, + METRIC_GROUP, + MAX_DOC_PREFIX + ABORT_MULTIPART_UPLOAD_TIME_DOC + ); + + static final MetricNameTemplate THROTTLING_ERRORS_RATE_METRIC_NAME = new MetricNameTemplate( + THROTTLING_ERRORS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + THROTTLING_ERRORS_DOC + ); + static final MetricNameTemplate THROTTLING_ERRORS_TOTAL_METRIC_NAME = new MetricNameTemplate( + THROTTLING_ERRORS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + THROTTLING_ERRORS_DOC + ); + static final MetricNameTemplate SERVER_ERRORS_RATE_METRIC_NAME = new MetricNameTemplate( + SERVER_ERRORS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + SERVER_ERRORS_DOC + ); + static final MetricNameTemplate SERVER_ERRORS_TOTAL_METRIC_NAME = new MetricNameTemplate( + SERVER_ERRORS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + SERVER_ERRORS_DOC + ); + static final MetricNameTemplate CONFIGURED_TIMEOUT_ERRORS_RATE_METRIC_NAME = new MetricNameTemplate( + CONFIGURED_TIMEOUT_ERRORS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + CONFIGURED_TIMEOUT_ERRORS_DOC + ); + static final MetricNameTemplate CONFIGURED_TIMEOUT_ERRORS_TOTAL_METRIC_NAME = new MetricNameTemplate( + CONFIGURED_TIMEOUT_ERRORS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + CONFIGURED_TIMEOUT_ERRORS_DOC + ); + static final MetricNameTemplate IO_ERRORS_RATE_METRIC_NAME = new MetricNameTemplate( + IO_ERRORS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + IO_ERRORS_DOC + ); + static final MetricNameTemplate IO_ERRORS_TOTAL_METRIC_NAME = new MetricNameTemplate( + IO_ERRORS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + IO_ERRORS_DOC + ); + static final MetricNameTemplate OTHER_ERRORS_RATE_METRIC_NAME = new MetricNameTemplate( + OTHER_ERRORS_RATE, + METRIC_GROUP, + RATE_DOC_PREFIX + OTHER_ERRORS_DOC + ); + static final MetricNameTemplate OTHER_ERRORS_TOTAL_METRIC_NAME = new MetricNameTemplate( + OTHER_ERRORS_TOTAL, + METRIC_GROUP, + TOTAL_DOC_PREFIX + OTHER_ERRORS_DOC + ); + + public List all() { + return List.of( + GET_OBJECT_REQUESTS_RATE_METRIC_NAME, + GET_OBJECT_REQUESTS_TOTAL_METRIC_NAME, + GET_OBJECT_TIME_AVG_METRIC_NAME, + GET_OBJECT_TIME_MAX_METRIC_NAME, + PUT_OBJECT_REQUESTS_RATE_METRIC_NAME, + PUT_OBJECT_REQUESTS_TOTAL_METRIC_NAME, + PUT_OBJECT_TIME_AVG_METRIC_NAME, + PUT_OBJECT_TIME_MAX_METRIC_NAME, + DELETE_OBJECT_REQUESTS_RATE_METRIC_NAME, + DELETE_OBJECT_REQUESTS_TOTAL_METRIC_NAME, + DELETE_OBJECT_TIME_AVG_METRIC_NAME, + DELETE_OBJECT_TIME_MAX_METRIC_NAME, + DELETE_OBJECTS_REQUESTS_RATE_METRIC_NAME, + DELETE_OBJECTS_REQUESTS_TOTAL_METRIC_NAME, + DELETE_OBJECTS_TIME_AVG_METRIC_NAME, + DELETE_OBJECTS_TIME_MAX_METRIC_NAME, + UPLOAD_PART_REQUESTS_RATE_METRIC_NAME, + UPLOAD_PART_REQUESTS_TOTAL_METRIC_NAME, + UPLOAD_PART_TIME_AVG_METRIC_NAME, + UPLOAD_PART_TIME_MAX_METRIC_NAME, + CREATE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME, + CREATE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME, + CREATE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME, + CREATE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME, + COMPLETE_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME, + COMPLETE_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME, + COMPLETE_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME, + COMPLETE_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME, + ABORT_MULTIPART_UPLOAD_REQUESTS_RATE_METRIC_NAME, + ABORT_MULTIPART_UPLOAD_REQUESTS_TOTAL_METRIC_NAME, + ABORT_MULTIPART_UPLOAD_TIME_AVG_METRIC_NAME, + ABORT_MULTIPART_UPLOAD_TIME_MAX_METRIC_NAME, + THROTTLING_ERRORS_RATE_METRIC_NAME, + THROTTLING_ERRORS_TOTAL_METRIC_NAME, + SERVER_ERRORS_RATE_METRIC_NAME, + SERVER_ERRORS_TOTAL_METRIC_NAME, + CONFIGURED_TIMEOUT_ERRORS_RATE_METRIC_NAME, + CONFIGURED_TIMEOUT_ERRORS_TOTAL_METRIC_NAME, + IO_ERRORS_RATE_METRIC_NAME, + IO_ERRORS_TOTAL_METRIC_NAME, + OTHER_ERRORS_RATE_METRIC_NAME, + OTHER_ERRORS_TOTAL_METRIC_NAME + ); + } +}