This is an automated email from the ASF dual-hosted git repository.

xuba pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git


The following commit(s) were added to refs/heads/master by this push:
     new de0e6ffbc [AMORO-2871] Fix promethues reporter bugs (#2874)
de0e6ffbc is described below

commit de0e6ffbcd044cc277cda19ab87103b3534794b5
Author: Xavier Bai <[email protected]>
AuthorDate: Wed May 29 14:00:17 2024 +0800

    [AMORO-2871] Fix promethues reporter bugs (#2874)
    
    Fix promethues reporter bugs
---
 .../org.apache.amoro.api.metrics.MetricReporter       | 19 +++++++++++++++++++
 .../amoro/server/manager/AbstractPluginManager.java   |  6 +++---
 .../amoro/server/table/TableOptimizingMetrics.java    |  2 +-
 amoro-ams/dist/src/main/assemblies/bin.xml            |  2 +-
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git 
a/amoro-ams/amoro-ams-metrics/amoro-metrics-prometheus/src/main/resources/META-INF/services/org.apache.amoro.api.metrics.MetricReporter
 
b/amoro-ams/amoro-ams-metrics/amoro-metrics-prometheus/src/main/resources/META-INF/services/org.apache.amoro.api.metrics.MetricReporter
new file mode 100644
index 000000000..54193405f
--- /dev/null
+++ 
b/amoro-ams/amoro-ams-metrics/amoro-metrics-prometheus/src/main/resources/META-INF/services/org.apache.amoro.api.metrics.MetricReporter
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.amoro.metrics.promethues.PrometheusMetricsReporter
\ No newline at end of file
diff --git 
a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/manager/AbstractPluginManager.java
 
b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/manager/AbstractPluginManager.java
index c74e6be00..b3821591d 100644
--- 
a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/manager/AbstractPluginManager.java
+++ 
b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/manager/AbstractPluginManager.java
@@ -109,7 +109,8 @@ public abstract class AbstractPluginManager<T extends 
ActivePlugin> implements P
         name -> {
           T plugin = foundedPlugins.get(name);
           if (plugin == null) {
-            throw new LoadingPluginException("Cannot find am implement class 
for plugin:" + name);
+            throw new LoadingPluginException(
+                "Cannot find an implement class for the plugin:" + name);
           }
           plugin.open(pluginConfig.getProperties());
           exists.set(false);
@@ -221,8 +222,7 @@ public abstract class AbstractPluginManager<T extends 
ActivePlugin> implements P
   protected void findSingleJarExternalPlugins(File pluginJarFile, ClassLoader 
parentClassLoader) {
     try {
       ClassLoader pluginClassLoader =
-          new URLClassLoader(
-              new URL[] {new URL(pluginJarFile.getAbsolutePath())}, 
parentClassLoader);
+          new URLClassLoader(new URL[] {pluginJarFile.toURI().toURL()}, 
parentClassLoader);
       ServiceLoader<T> loader = ServiceLoader.load(pluginType, 
pluginClassLoader);
       addToFoundedPlugin(loader);
     } catch (MalformedURLException e) {
diff --git 
a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableOptimizingMetrics.java
 
b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableOptimizingMetrics.java
index 7c08d7c51..0839669b9 100644
--- 
a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableOptimizingMetrics.java
+++ 
b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableOptimizingMetrics.java
@@ -174,7 +174,7 @@ public class TableOptimizingMetrics {
 
   private final ServerTableIdentifier identifier;
 
-  private OptimizingStatus optimizingStatus;
+  private OptimizingStatus optimizingStatus = OptimizingStatus.IDLE;
   private long statusSetTimestamp = System.currentTimeMillis();
   private final List<MetricKey> registeredMetricKeys = Lists.newArrayList();
   private MetricRegistry globalRegistry;
diff --git a/amoro-ams/dist/src/main/assemblies/bin.xml 
b/amoro-ams/dist/src/main/assemblies/bin.xml
index b662220aa..a91440430 100644
--- a/amoro-ams/dist/src/main/assemblies/bin.xml
+++ b/amoro-ams/dist/src/main/assemblies/bin.xml
@@ -48,7 +48,7 @@
             <source>
                 
../amoro-ams-metrics/amoro-metrics-prometheus/target/amoro-metrics-prometheus-${project.version}-jar-with-dependencies.jar
             </source>
-            <outputDirectory>plugin/metrics-reporter</outputDirectory>
+            <outputDirectory>plugin/metric-reporters</outputDirectory>
             <destName>prometheus-reporter.jar</destName>
             <fileMode>0644</fileMode>
         </file>

Reply via email to