You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/12/18 06:02:59 UTC

[shardingsphere] branch master updated: Move Prometheus dependency to Prometheus agent only (#22950)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b9060602d3e Move Prometheus dependency to Prometheus agent only (#22950)
b9060602d3e is described below

commit b9060602d3edf23be2f30845764aed2fb4bb11f7
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Dec 18 14:02:52 2022 +0800

    Move Prometheus dependency to Prometheus agent only (#22950)
---
 agent/plugins/metrics/type/prometheus/pom.xml      |  9 +++++++++
 .../prometheus/PrometheusPluginBootService.java    |  4 ++--
 .../prometheus/collector/BuildInfoCollector.java   |  2 +-
 pom.xml                                            | 22 ----------------------
 4 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/agent/plugins/metrics/type/prometheus/pom.xml b/agent/plugins/metrics/type/prometheus/pom.xml
index b91b1a14550..49b6edcb8b1 100644
--- a/agent/plugins/metrics/type/prometheus/pom.xml
+++ b/agent/plugins/metrics/type/prometheus/pom.xml
@@ -27,6 +27,11 @@
     <artifactId>shardingsphere-agent-metrics-prometheus</artifactId>
     <name>${project.artifactId}</name>
     
+    <properties>
+        <prometheus.version>0.11.0</prometheus.version>
+        <prometheus.jmx.version>0.16.1</prometheus.jmx.version>
+    </properties>
+    
     <dependencies>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
@@ -55,18 +60,22 @@
         <dependency>
             <groupId>io.prometheus</groupId>
             <artifactId>simpleclient</artifactId>
+            <version>${prometheus.version}</version>
         </dependency>
         <dependency>
             <groupId>io.prometheus</groupId>
             <artifactId>simpleclient_hotspot</artifactId>
+            <version>${prometheus.version}</version>
         </dependency>
         <dependency>
             <groupId>io.prometheus</groupId>
             <artifactId>simpleclient_httpserver</artifactId>
+            <version>${prometheus.version}</version>
         </dependency>
         <dependency>
             <groupId>io.prometheus.jmx</groupId>
             <artifactId>collector</artifactId>
+            <version>${prometheus.jmx.version}</version>
         </dependency>
     </dependencies>
     
diff --git a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/PrometheusPluginBootService.java b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/PrometheusPluginBootService.java
index 19b39fc9bef..0d7ed761f04 100644
--- a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/PrometheusPluginBootService.java
+++ b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/PrometheusPluginBootService.java
@@ -61,13 +61,13 @@ public final class PrometheusPluginBootService implements PluginBootService {
         }
     }
     
-    private void registerCollector(final boolean isEnableCollectJVMInformation, final boolean isEnhancedForProxy) {
+    private void registerCollector(final boolean isCollectJVMInformation, final boolean isEnhancedForProxy) {
         new BuildInfoCollector(isEnhancedForProxy).register();
         if (isEnhancedForProxy) {
             new ProxyInfoCollector().register();
             new MetaDataInfoCollector().register();
         }
-        if (isEnableCollectJVMInformation) {
+        if (isCollectJVMInformation) {
             DefaultExports.initialize();
         }
     }
diff --git a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java
index 1d73459d3d0..4bf18bce74d 100644
--- a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java
+++ b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java
@@ -32,8 +32,8 @@ import java.util.Optional;
 /**
  * Build information collector.
  */
-@Slf4j
 @RequiredArgsConstructor
+@Slf4j
 public final class BuildInfoCollector extends Collector {
     
     private static final String PROXY_BOOTSTRAP_CLASS = "org.apache.shardingsphere.proxy.Bootstrap";
diff --git a/pom.xml b/pom.xml
index 9c230420673..1b6f5658450 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,8 +88,6 @@
         
         <elasticjob.version>3.0.2</elasticjob.version>
         
-        <prometheus.version>0.11.0</prometheus.version>
-        <prometheus.jmx.version>0.16.1</prometheus.jmx.version>
         <opentracing.version>0.31.0</opentracing.version>
         <jaeger-client.version>0.31.0</jaeger-client.version>
         <zipkin-brave.version>5.13.2</zipkin-brave.version>
@@ -429,26 +427,6 @@
                 </exclusions>
             </dependency>
             
-            <dependency>
-                <groupId>io.prometheus</groupId>
-                <artifactId>simpleclient</artifactId>
-                <version>${prometheus.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.prometheus</groupId>
-                <artifactId>simpleclient_hotspot</artifactId>
-                <version>${prometheus.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.prometheus</groupId>
-                <artifactId>simpleclient_httpserver</artifactId>
-                <version>${prometheus.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.prometheus.jmx</groupId>
-                <artifactId>collector</artifactId>
-                <version>${prometheus.jmx.version}</version>
-            </dependency>
             <dependency>
                 <groupId>io.opentracing</groupId>
                 <artifactId>opentracing-api</artifactId>