jackye1995 commented on code in PR #7198:
URL: https://github.com/apache/iceberg/pull/7198#discussion_r1151196353


##########
aws/src/main/java/org/apache/iceberg/aws/AwsClientFactories.java:
##########
@@ -88,6 +91,32 @@ private static AwsClientFactory loadClientFactory(String 
impl, Map<String, Strin
     return factory;
   }
 
+  /**
+   * Metrics are the only reliable way provided by the AWS SDK to determine if 
an API call was
+   * retried. Not for public use.
+   */
+  public static class InternalRetryDetector implements MetricPublisher {
+    private boolean retried = false;
+
+    @Override
+    public void publish(MetricCollection metricCollection) {
+      if (!retried) {
+        if 
(metricCollection.metricValues(CoreMetric.RETRY_COUNT).stream().anyMatch(i -> i 
> 0)) {
+          retried = true;
+        } else {
+          metricCollection.children().forEach(this::publish);
+        }
+      }
+    }
+
+    @Override
+    public void close() {}
+
+    public boolean wasRetried() {

Review Comment:
   nit: prefer simple adjective method names for boolean, like just `retried()`



-- 
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]

Reply via email to