pvary commented on code in PR #16155:
URL: https://github.com/apache/iceberg/pull/16155#discussion_r3162972771
##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergStreamWriterMetrics.java:
##########
@@ -97,4 +107,55 @@ public Counter getFlushedDataFiles() {
public Counter getFlushedDeleteFiles() {
return flushedDeleteFiles;
}
+
+ @Nullable
+ Histogram dataFilesSizeHistogram() {
+ return dataFilesSizeHistogram;
+ }
+
+ @Nullable
+ Histogram deleteFilesSizeHistogram() {
+ return deleteFilesSizeHistogram;
+ }
+
+ static Histogram loadHistogramIfAvailable(
+ MetricGroup group, String name, int reservoirSize, ClassLoader
classLoader) {
+
+ if (isFlinkDropwizardAvailable(classLoader)) {
+ return HistogramLoader.load(name, group, reservoirSize);
+ } else {
+ LOG.warn(
+ "flink-metrics-dropwizard is not on the classpath. '{}' histogram
metrics will be disabled. Add org.apache.flink:flink-metrics-dropwizard to
enable them.",
+ name);
+ return null;
+ }
+ }
+
+ /**
+ * Checks whether the Dropwizard-based histogram wrapper provided through
Flink's optional
+ * flink-metrics-dropwizard dependency is available.
+ */
+ private static boolean isFlinkDropwizardAvailable(ClassLoader classLoader) {
+ try {
+ Class.forName(
Review Comment:
We usually use DynClasses, DynConstructors for this kind of stuff.
Would it be too complicated that way?
--
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]