danielcweeks commented on a change in pull request #4254:
URL: https://github.com/apache/iceberg/pull/4254#discussion_r819176474
##########
File path: core/src/main/java/org/apache/iceberg/CatalogUtil.java
##########
@@ -275,6 +276,27 @@ public static FileIO loadFileIO(
return fileIO;
}
+ public static MetricsContext loadFileIOMetricsContext(
+ String impl,
+ Map<String, String> properties,
+ Object hadoopConf) {
+ LOG.info("Loading custom MetricsContext implementation: {}", impl);
+ MetricsContext metricsContext;
+ try {
+ DynConstructors.Ctor<MetricsContext> ctor =
+
DynConstructors.builder(MetricsContext.class).impl(impl).buildChecked();
+ metricsContext = ctor.newInstance();
+ } catch (NoSuchMethodException | ClassCastException e) {
+ LOG.warn("Unable to load metrics class: '{}', falling back to null
metrics", impl, e);
+ return null;
Review comment:
We should return the null metrics impl not `null` here because engines
without hadoop (e.g. Flink) will then NPE in the S3FileIO.
--
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]