singhpk234 commented on code in PR #16235:
URL: https://github.com/apache/iceberg/pull/16235#discussion_r3470231027


##########
aws/src/test/java/org/apache/iceberg/aws/s3/TestS3FileIOProperties.java:
##########
@@ -587,4 +589,154 @@ public void testChunkedEncodingDisabled() {
         .as("chunked encoding should be disabled when explicitly set to false")
         .isFalse();
   }
+
+  @Test
+  public void testApplyMetricsPublisherConfigurationWithFactoryMethod() {
+    Map<String, String> properties = Maps.newHashMap();
+    properties.put(
+        S3FileIOProperties.METRICS_PUBLISHER_IMPL, 
FactoryMetricPublisher.class.getName());
+    S3FileIOProperties s3FileIOProperties = new S3FileIOProperties(properties);
+
+    S3ClientBuilder builder = S3Client.builder();
+    s3FileIOProperties.applyMetricsPublisherConfiguration(builder);
+
+    assertThat(builder.overrideConfiguration()).isNotNull();
+    assertThat(builder.overrideConfiguration().metricPublishers()).hasSize(1);
+    assertThat(builder.overrideConfiguration().metricPublishers().get(0))
+        .isInstanceOf(FactoryMetricPublisher.class);
+  }
+
+  @Test
+  public void testApplyMetricsPublisherConfigurationWithNoArgConstructor() {
+    Map<String, String> properties = Maps.newHashMap();
+    properties.put(S3FileIOProperties.METRICS_PUBLISHER_IMPL, 
NoArgMetricPublisher.class.getName());
+    S3FileIOProperties s3FileIOProperties = new S3FileIOProperties(properties);
+
+    S3ClientBuilder builder = S3Client.builder();
+    s3FileIOProperties.applyMetricsPublisherConfiguration(builder);
+
+    assertThat(builder.overrideConfiguration()).isNotNull();
+    assertThat(builder.overrideConfiguration().metricPublishers()).hasSize(1);
+    assertThat(builder.overrideConfiguration().metricPublishers().get(0))
+        .isInstanceOf(NoArgMetricPublisher.class);
+  }

Review Comment:
   The only variable here is the metrics class right ? can we make this test 
paramterized instead ? 



##########
docs/docs/aws.md:
##########
@@ -659,6 +659,24 @@ spark-sql --conf 
spark.sql.catalog.my_catalog=org.apache.iceberg.spark.SparkCata
 
 For more details on using S3 Dual-stack, please refer [Using dual-stack 
endpoints from the AWS CLI and the AWS 
SDKs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/dual-stack-endpoints.html#dual-stack-endpoints-cli)
 
+### S3 Custom MetricPublisher
+
+A custom `MetricPublisher` implementation can be plugged into the S3 client by 
setting the `s3.metrics-publisher-impl` catalog property to the fully qualified 
class name of a class that implements 
`software.amazon.awssdk.metrics.MetricPublisher`.

Review Comment:
   should we put the link to the java sdk v2 java doc 



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