SanjayMarreddi commented on code in PR #13348: URL: https://github.com/apache/iceberg/pull/13348#discussion_r2157258580
########## aws/src/main/java/org/apache/iceberg/aws/s3/S3RequestUtil.java: ########## @@ -149,4 +159,22 @@ static void configurePermission( Function<ObjectCannedACL, S3Request.Builder> aclSetter) { aclSetter.apply(s3FileIOProperties.acl()); } + + @SuppressWarnings("CatchBlockLogException") + static MetricsContext initMetrics(Map<String, String> props) { + // Report Hadoop metrics if Hadoop is available + try { + DynConstructors.Ctor<MetricsContext> ctor = + DynConstructors.builder(MetricsContext.class) + .hiddenImpl(DEFAULT_METRICS_IMPL, String.class) + .buildChecked(); + MetricsContext context = ctor.newInstance(ROOT_PREFIX); + context.initialize(props); + return context; + } catch (NoClassDefFoundError | NoSuchMethodException | ClassCastException e) { + LOG.warn( + "Unable to load metrics class: '{}', falling back to null metrics", DEFAULT_METRICS_IMPL); Review Comment: I've reverted this change fully from `S3RequestUtil` and added `TestMetricsContext` instead to prevent hadoop metrics being shared between different tests. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org