adoroszlai commented on code in PR #4383:
URL: https://github.com/apache/ozone/pull/4383#discussion_r1155302179
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java:
##########
@@ -341,7 +369,13 @@ public Response head(@PathParam("bucket") String
bucketName)
throws OS3Exception, IOException {
S3GAction s3GAction = S3GAction.HEAD_BUCKET;
try {
- getBucket(bucketName);
+ captureLatencyNs(getLatencyMetrics().getHeadBucketLatencyNs(), () -> {
+ try {
+ getBucket(bucketName);
+ } catch (OS3Exception ex) {
+ throw new RuntimeException(ex);
+ }
Review Comment:
@tanvipenumudy acceptance test is failing with:
```
Head Bucket not existent | FAIL
|
'
An error occurred (500) when calling the HeadBucket operation (reached max
retries: 4): Internal Server Error' does not contain '404'
```
https://github.com/tanvipenumudy/ozone/actions/runs/4571528625/jobs/8070135759#step:5:475
https://github.com/tanvipenumudy/ozone/actions/runs/4571528625/jobs/8070135913#step:5:337
https://github.com/tanvipenumudy/ozone/actions/runs/4571528625/jobs/8070135972#step:5:249
https://github.com/tanvipenumudy/ozone/actions/runs/4571528625/jobs/8070136118#step:5:708
I guess it happens because of this exception translation. The wrapped
`OS3Exception` should be rethrown in the outer `catch`.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java:
##########
@@ -327,6 +352,9 @@ public Response listMultipartUploads(
AUDIT.logReadFailure(
buildAuditMessageForFailure(s3GAction, getAuditParameters(), ex));
throw ex;
+ } finally {
+ getLatencyMetrics().addListMultipartUploadsLatencyNs(
+ Time.monotonicNowNanos() - start);
Review Comment:
Doesn't mixing latency for both successful and failed operations distort the
picture?
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/metrics/S3GatewayLatencyMetrics.java:
##########
@@ -0,0 +1,244 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.s3.metrics;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsRecordBuilder;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metric;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.MetricsRegistry;
+import org.apache.hadoop.metrics2.lib.MutableRate;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * This class maintains S3 Latency Gateway related metrics.
+ */
[email protected]
+@Metrics(about = "S3 Gateway Latency Metrics", context = OzoneConsts.OZONE)
+public final class S3GatewayLatencyMetrics implements MetricsSource {
Review Comment:
Do we need a separate metrics source for latency instead of adding these to
`S3GatewayMetrics`?
I think we could simplify metrics by incrementing operation count and
recording operation latency in the same method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]