geruh commented on code in PR #15122:
URL: https://github.com/apache/iceberg/pull/15122#discussion_r2747556143


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java:
##########
@@ -1136,6 +1145,53 @@ public <T extends S3ClientBuilder> void 
applyS3AccessGrantsConfigurations(T buil
     }
   }
 
+  public <T extends S3ClientBuilder> void applyMetricsPublisherConfiguration(T 
builder) {
+    if (metricsPublisherImpl != null) {
+      software.amazon.awssdk.metrics.MetricPublisher metricPublisher =

Review Comment:
   `software.amazon.awssdk.metrics.MetricPublisher` and same for 
MetricsCollection are used full path imports. Consider adding imports to clean 
this up



##########
aws/src/test/java/org/apache/iceberg/aws/TestS3FileIOProperties.java:
##########
@@ -320,4 +320,63 @@ public void 
testIsTreatS3DirectoryBucketListPrefixAsDirectoryEnabled() {
     S3FileIOProperties properties = new S3FileIOProperties(map);
     
assertThat(properties.isS3DirectoryBucketListPrefixAsDirectory()).isEqualTo(false);
   }
+
+  @Test
+  public void testMetricsPublisherWithCreateMethod() {

Review Comment:
   Can you add a test for a missing/invalid class?



##########
aws/src/test/java/org/apache/iceberg/aws/TestS3FileIOProperties.java:
##########
@@ -320,4 +320,63 @@ public void 
testIsTreatS3DirectoryBucketListPrefixAsDirectoryEnabled() {
     S3FileIOProperties properties = new S3FileIOProperties(map);
     
assertThat(properties.isS3DirectoryBucketListPrefixAsDirectory()).isEqualTo(false);
   }
+
+  @Test
+  public void testMetricsPublisherWithCreateMethod() {
+    Map<String, String> properties =
+        ImmutableMap.of(
+            S3FileIOProperties.METRICS_PUBLISHER_IMPL, 
FactoryMetricPublisher.class.getName());
+    S3FileIOProperties s3Properties = new S3FileIOProperties(properties);
+    S3ClientBuilder builder = S3Client.builder();
+
+    s3Properties.applyMetricsPublisherConfiguration(builder);
+
+    assertThat(builder.overrideConfiguration().metricPublishers()).hasSize(1);

Review Comment:
   Can we strengthen the assertion by checking if the instance type is set for 
some of these?



##########
aws/src/main/java/org/apache/iceberg/aws/s3/DefaultS3FileIOAwsClientFactory.java:
##########


Review Comment:
   Wdyt about adding this to the S3Async client?



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