From eaba1146afc83e5e70ef520704a76a15a75c9aad Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Tue, 21 Nov 2023 11:37:47 +0900 Subject: [PATCH] [HUDI-7107] Reused MetricsReporter fails to publish metrics in Spark streaming job (#10132) --- .../src/main/java/org/apache/hudi/metrics/Metrics.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metrics/Metrics.java b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metrics/Metrics.java index f71d394238ea..47ee23bcc2fb 100644 --- a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metrics/Metrics.java +++ b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metrics/Metrics.java @@ -86,6 +86,8 @@ public static synchronized Metrics getInstance(HoodieWriteConfig metricConfig) { public static synchronized void shutdownAllMetrics() { METRICS_INSTANCE_PER_BASEPATH.values().forEach(Metrics::shutdown); + // to avoid reusing already stopped metrics + METRICS_INSTANCE_PER_BASEPATH.clear(); } private List addAdditionalMetricsExporters(HoodieWriteConfig metricConfig) {