rcjverhoef commented on code in PR #15122:
URL: https://github.com/apache/iceberg/pull/15122#discussion_r2780352031
##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3FileIOProperties.java:
##########
@@ -1134,6 +1146,51 @@ public <T extends S3ClientBuilder> void
applyS3AccessGrantsConfigurations(T buil
}
}
+ public <T extends S3BaseClientBuilder<T, ?>> void
applyMetricsPublisherConfiguration(T builder) {
+ if (metricsPublisherImpl != null) {
+ MetricPublisher metricPublisher =
loadMetricPublisher(metricsPublisherImpl, allProperties);
+ ClientOverrideConfiguration.Builder configBuilder =
+ builder.overrideConfiguration() != null
+ ? builder.overrideConfiguration().toBuilder()
+ : ClientOverrideConfiguration.builder();
+
builder.overrideConfiguration(configBuilder.addMetricPublisher(metricPublisher).build());
+ }
+ }
+
+ /**
+ * Load a MetricPublisher implementation. Tries static create(Map) factory
method first, falls
+ * back to no-arg constructor.
+ */
+ private MetricPublisher loadMetricPublisher(String impl, Map<String, String>
properties) {
+ // Try static create(Map) factory method first
+ try {
+ return DynMethods.builder("create")
+ .hiddenImpl(impl, Map.class)
+ .buildStaticChecked()
+ .invoke(properties);
+ } catch (NoSuchMethodException e) {
Review Comment:
fair. I can do better with try-in-try
--
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]