You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/01/05 13:28:28 UTC

[shardingsphere] branch master updated: agent metrics plugin refactor (#8900)

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

zhangyonglun 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 128b7a2  agent metrics plugin refactor (#8900)
128b7a2 is described below

commit 128b7a23e87f7a1e61e8fe7e354be799aa3f5e7d
Author: xiaoyu <54...@qq.com>
AuthorDate: Tue Jan 5 21:28:03 2021 +0800

    agent metrics plugin refactor (#8900)
    
    * agent metrics plugin refactor
    
    * agent metrics plugin refactor
---
 .../agent/config/AgentConfiguration.java           |  2 -
 .../core/config/yaml/YamlAgentConfiguration.java   |  2 -
 .../swapper/YamlAgentConfigurationSwapper.java     |  1 -
 .../src/test/resources/conf/agent.yaml             |  1 -
 .../src/main/resources/conf/agent.yaml             |  3 +-
 .../agent/metrics/api/MetricsRegisterFactory.java  | 33 --------------
 .../metrics/api/provider/MetricsProvider.java      | 51 ----------------------
 .../metrics/api/reporter/MetricsReporter.java      | 34 +++++++++------
 .../api/fixture/FixtureMetricsRegisterFactory.java | 34 ---------------
 .../metrics/api/provider/MetricsProviderTest.java  | 35 ---------------
 ...sphere.agent.metrics.api.MetricsRegisterFactory | 18 --------
 .../src/test/resources/conf/agent.yaml             | 30 ++++++++++++-
 .../register/PrometheusMetricsRegisterFactory.java | 37 ----------------
 .../service/PrometheusPluginBootService.java       |  3 ++
 ...sphere.agent.metrics.api.MetricsRegisterFactory | 18 --------
 .../OpenTracingPluginDefinitionService.java        |  2 +-
 .../service/OpenTracingPluginBootService.java      |  2 +-
 17 files changed, 56 insertions(+), 250 deletions(-)

diff --git a/shardingsphere-agent/shardingsphere-agent-api/src/main/java/org/apache/shardingsphere/agent/config/AgentConfiguration.java b/shardingsphere-agent/shardingsphere-agent-api/src/main/java/org/apache/shardingsphere/agent/config/AgentConfiguration.java
index 7245886..498efc3 100644
--- a/shardingsphere-agent/shardingsphere-agent-api/src/main/java/org/apache/shardingsphere/agent/config/AgentConfiguration.java
+++ b/shardingsphere-agent/shardingsphere-agent-api/src/main/java/org/apache/shardingsphere/agent/config/AgentConfiguration.java
@@ -33,8 +33,6 @@ public final class AgentConfiguration {
     
     private String applicationName;
     
-    private String metricsType = "Prometheus";
-    
     private Set<String> ignoredPluginNames = new HashSet<>();
     
     private Map<String, PluginConfiguration> plugins = new HashMap<>();
diff --git a/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/YamlAgentConfiguration.java b/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/YamlAgentConfiguration.java
index fe692e9..1f03965 100644
--- a/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/YamlAgentConfiguration.java
+++ b/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/YamlAgentConfiguration.java
@@ -33,8 +33,6 @@ public final class YamlAgentConfiguration {
     
     private String applicationName = "shardingsphere-agent";
     
-    private String metricsType = "Prometheus";
-    
     private Set<String> ignoredPluginNames = new HashSet<>();
     
     private Map<String, YamlPluginConfiguration> plugins = new HashMap<>();
diff --git a/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/swapper/YamlAgentConfigurationSwapper.java b/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/swapper/YamlAgentConfigurationSwapper.java
index 321a4ae..0d897c9 100644
--- a/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/swapper/YamlAgentConfigurationSwapper.java
+++ b/shardingsphere-agent/shardingsphere-agent-core/src/main/java/org/apache/shardingsphere/agent/core/config/yaml/swapper/YamlAgentConfigurationSwapper.java
@@ -38,7 +38,6 @@ public final class YamlAgentConfigurationSwapper {
     public static AgentConfiguration swap(final YamlAgentConfiguration yamlConfig) {
         AgentConfiguration result = new AgentConfiguration();
         result.setApplicationName(yamlConfig.getApplicationName());
-        result.setMetricsType(yamlConfig.getMetricsType());
         result.setIgnoredPluginNames(yamlConfig.getIgnoredPluginNames());
         Map<String, PluginConfiguration> configurationMap = yamlConfig.getPlugins().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> transform(entry.getValue())));
         result.setPlugins(configurationMap);
diff --git a/shardingsphere-agent/shardingsphere-agent-core/src/test/resources/conf/agent.yaml b/shardingsphere-agent/shardingsphere-agent-core/src/test/resources/conf/agent.yaml
index db3628a..7640e30 100644
--- a/shardingsphere-agent/shardingsphere-agent-core/src/test/resources/conf/agent.yaml
+++ b/shardingsphere-agent/shardingsphere-agent-core/src/test/resources/conf/agent.yaml
@@ -16,7 +16,6 @@
 #
 
 applicationName: shardingsphere-agent
-metricsType : Prometheus
 ignoredPluginNames:
   - Jaeger
   - Opentracing
diff --git a/shardingsphere-agent/shardingsphere-agent-distribution/src/main/resources/conf/agent.yaml b/shardingsphere-agent/shardingsphere-agent-distribution/src/main/resources/conf/agent.yaml
index 3f85bc7..5fa7a9e 100644
--- a/shardingsphere-agent/shardingsphere-agent-distribution/src/main/resources/conf/agent.yaml
+++ b/shardingsphere-agent/shardingsphere-agent-distribution/src/main/resources/conf/agent.yaml
@@ -16,7 +16,6 @@
 #
 
 applicationName: shardingsphere-agent
-metricsType : Prometheus
 ignoredPluginNames:
   - Jaeger
   - Opentracing
@@ -37,7 +36,7 @@ plugins:
       JAEGER_REPORTER_FLUSH_INTERVAL: "1"
   Zipkin:
     host: "localhost"
-    port: 15775
+    port: 9441
     props:
       NAME: "Zipkin"
   Opentracing:
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/MetricsRegisterFactory.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/MetricsRegisterFactory.java
deleted file mode 100644
index 75553ee..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/MetricsRegisterFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.metrics.api;
-
-import org.apache.shardingsphere.agent.spi.type.AgentTypedSPI;
-
-/**
- * Metrics register factory.
- */
-public interface MetricsRegisterFactory extends AgentTypedSPI {
-    
-    /**
-     * New instance metrics register.
-     *
-     * @return the metrics register
-     */
-    MetricsRegister newInstance();
-}
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/provider/MetricsProvider.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/provider/MetricsProvider.java
deleted file mode 100644
index c57219e..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/provider/MetricsProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.metrics.api.provider;
-
-import org.apache.shardingsphere.agent.config.AgentConfiguration;
-import org.apache.shardingsphere.agent.core.config.cache.AgentObjectPool;
-import org.apache.shardingsphere.agent.core.spi.AgentTypedSPIRegistry;
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegister;
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory;
-
-/**
- * The enum metrics provider.
- */
-public enum MetricsProvider {
-    
-    /**
-     * Instance metrics provider.
-     */
-    INSTANCE;
-    
-    private static MetricsRegisterFactory metricRegisterFactory;
-    
-    static {
-        AgentConfiguration agentConfiguration = AgentObjectPool.INSTANCE.get(AgentConfiguration.class);
-        metricRegisterFactory = AgentTypedSPIRegistry.getRegisteredService(MetricsRegisterFactory.class, agentConfiguration.getMetricsType());
-    }
-    
-    /**
-     * Create metric register.
-     *
-     * @return metric register
-     */
-    public MetricsRegister newInstance() {
-        return metricRegisterFactory.newInstance();
-    }
-}
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/reporter/MetricsReporter.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/reporter/MetricsReporter.java
index 42166b1..fb03dff 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/reporter/MetricsReporter.java
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/main/java/org/apache/shardingsphere/agent/metrics/api/reporter/MetricsReporter.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.agent.metrics.api.reporter;
 
 import java.util.Collection;
 import java.util.List;
-import org.apache.shardingsphere.agent.metrics.api.provider.MetricsProvider;
 import org.apache.shardingsphere.agent.metrics.api.MetricsRegister;
 import org.apache.shardingsphere.agent.metrics.api.entity.Metric;
 
@@ -28,7 +27,16 @@ import org.apache.shardingsphere.agent.metrics.api.entity.Metric;
  */
 public final class MetricsReporter {
     
-    private static final MetricsRegister METRICS_REGISTER = MetricsProvider.INSTANCE.newInstance();
+    private static MetricsRegister metricsRegister;
+    
+    /**
+     * Register.
+     *
+     * @param metricsRegister metrics register
+     */
+    public static void register(final MetricsRegister metricsRegister) {
+        MetricsReporter.metricsRegister = metricsRegister;
+    }
     
     /**
      * Register metrics.
@@ -61,7 +69,7 @@ public final class MetricsReporter {
      * @param document document for counter
      */
     public static void registerCounter(final String name, final String[] labelNames, final String document) {
-        METRICS_REGISTER.registerCounter(name, labelNames, document);
+        metricsRegister.registerCounter(name, labelNames, document);
     }
     
     /**
@@ -71,7 +79,7 @@ public final class MetricsReporter {
      * @param document document for counter
      */
     public static void registerCounter(final String name, final String document) {
-        METRICS_REGISTER.registerCounter(name, null, document);
+        metricsRegister.registerCounter(name, null, document);
     }
     
     /**
@@ -82,7 +90,7 @@ public final class MetricsReporter {
      * @param document document for gauge
      */
     public static void registerGauge(final String name, final String[] labelNames, final String document) {
-        METRICS_REGISTER.registerGauge(name, labelNames, document);
+        metricsRegister.registerGauge(name, labelNames, document);
     }
     
     /**
@@ -92,7 +100,7 @@ public final class MetricsReporter {
      * @param document document for gauge
      */
     public static void registerGauge(final String name, final String document) {
-        METRICS_REGISTER.registerGauge(name, null, document);
+        metricsRegister.registerGauge(name, null, document);
     }
     
     /**
@@ -103,7 +111,7 @@ public final class MetricsReporter {
      * @param document document for histogram
      */
     public static void registerHistogram(final String name, final String[] labelNames, final String document) {
-        METRICS_REGISTER.registerHistogram(name, labelNames, document);
+        metricsRegister.registerHistogram(name, labelNames, document);
     }
     
     /**
@@ -113,7 +121,7 @@ public final class MetricsReporter {
      * @param document document for histogram
      */
     public static void registerHistogram(final String name, final String document) {
-        METRICS_REGISTER.registerHistogram(name, null, document);
+        metricsRegister.registerHistogram(name, null, document);
     }
     
     /**
@@ -123,7 +131,7 @@ public final class MetricsReporter {
      * @param labelValues label values
      */
     public static void counterIncrement(final String name, final String[] labelValues) {
-        METRICS_REGISTER.counterIncrement(name, labelValues);
+        metricsRegister.counterIncrement(name, labelValues);
     }
     
     /**
@@ -143,7 +151,7 @@ public final class MetricsReporter {
      * @param count count
      */
     public static void counterIncrement(final String name, final String[] labelValues, final long count) {
-        METRICS_REGISTER.counterIncrement(name, labelValues, count);
+        metricsRegister.counterIncrement(name, labelValues, count);
     }
     
     /**
@@ -153,7 +161,7 @@ public final class MetricsReporter {
      * @param labelValues label values
      */
     public static void gaugeIncrement(final String name, final String[] labelValues) {
-        METRICS_REGISTER.gaugeIncrement(name, labelValues);
+        metricsRegister.gaugeIncrement(name, labelValues);
     }
     
     /**
@@ -172,7 +180,7 @@ public final class MetricsReporter {
      * @param labelValues label values
      */
     public static void gaugeDecrement(final String name, final String[] labelValues) {
-        METRICS_REGISTER.gaugeDecrement(name, labelValues);
+        metricsRegister.gaugeDecrement(name, labelValues);
     }
     
     /**
@@ -192,7 +200,7 @@ public final class MetricsReporter {
      * @param duration duration
      */
     public static void recordTime(final String name, final String[] labelValues, final long duration) {
-        METRICS_REGISTER.recordTime(name, labelValues, duration);
+        metricsRegister.recordTime(name, labelValues, duration);
     }
     
     /**
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/java/org/apache/shardingsphere/agent/metrics/api/fixture/FixtureMetricsRegisterFactory.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/java/org/apache/shardingsphere/agent/metrics/api/fixture/FixtureMetricsRegisterFactory.java
deleted file mode 100644
index 6bc459a..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/java/org/apache/shardingsphere/agent/metrics/api/fixture/FixtureMetricsRegisterFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.metrics.api.fixture;
-
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegister;
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory;
-
-public final class FixtureMetricsRegisterFactory implements MetricsRegisterFactory {
-    
-    @Override
-    public MetricsRegister newInstance() {
-        return new FixtureMetricsRegister();
-    }
-    
-    @Override
-    public String getType() {
-        return "fixture";
-    }
-}
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/java/org/apache/shardingsphere/agent/metrics/api/provider/MetricsProviderTest.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/java/org/apache/shardingsphere/agent/metrics/api/provider/MetricsProviderTest.java
deleted file mode 100644
index 62562b8..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/java/org/apache/shardingsphere/agent/metrics/api/provider/MetricsProviderTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.metrics.api.provider;
-
-import org.apache.shardingsphere.agent.metrics.api.BaseTest;
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegister;
-import org.apache.shardingsphere.agent.metrics.api.fixture.FixtureMetricsRegister;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertThat;
-
-public final class MetricsProviderTest extends BaseTest {
-    
-    @Test
-    public void assertInstance() {
-        MetricsRegister metricsRegister = MetricsProvider.INSTANCE.newInstance();
-        assertThat(metricsRegister, instanceOf(FixtureMetricsRegister.class));
-    }
-}
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/META-INF/services/org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/META-INF/services/org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory
deleted file mode 100644
index 44452b9..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/META-INF/services/org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.shardingsphere.agent.metrics.api.fixture.FixtureMetricsRegisterFactory
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/conf/agent.yaml b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/conf/agent.yaml
index e501cda..a97b18c 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/conf/agent.yaml
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-api/src/test/resources/conf/agent.yaml
@@ -16,4 +16,32 @@
 #
 
 applicationName: shardingsphere-agent
-metricsType: fixture
\ No newline at end of file
+ignoredPluginNames:
+  - Jaeger
+  - Opentracing
+
+plugins:
+  prometheus:
+    host:  "localhost"
+    port: 9090
+    props:
+      JVM_INFORMATION_COLLECTOR_ENABLED : "true"
+  Jaeger:
+    host: "localhost"
+    port: 5775
+    props:
+      JAEGER_SAMPLER_TYPE: "const"
+      JAEGER_SAMPLER_PARAM: "1"
+      JAEGER_REPORTER_LOG_SPANS: "true"
+      JAEGER_REPORTER_FLUSH_INTERVAL: "1"
+  Zipkin:
+    host: "localhost"
+    port: 9441
+    props:
+      NAME: "Zipkin"
+  Opentracing:
+    props:
+      OPENTRACING_TRACER_CLASS_NAME: "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
+  Logging:
+    props:
+      LEVEL: "INFO"
\ No newline at end of file
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/register/PrometheusMetricsRegisterFactory.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/register/PrometheusMetricsRegisterFactory.java
deleted file mode 100644
index 5f6a3a9..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/register/PrometheusMetricsRegisterFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.agent.metrics.prometheus.register;
-
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegister;
-import org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory;
-
-/**
- * Prometheus metrics register factory.
- */
-public final class PrometheusMetricsRegisterFactory implements MetricsRegisterFactory {
-    
-    @Override
-    public MetricsRegister newInstance() {
-        return PrometheusMetricsRegister.getInstance();
-    }
-    
-    @Override
-    public String getType() {
-        return "Prometheus";
-    }
-}
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java
index 1e46edb..dc20e614 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootService.java
@@ -22,6 +22,8 @@ import io.prometheus.client.exporter.HTTPServer;
 import io.prometheus.client.hotspot.DefaultExports;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.agent.config.PluginConfiguration;
+import org.apache.shardingsphere.agent.metrics.api.reporter.MetricsReporter;
+import org.apache.shardingsphere.agent.metrics.prometheus.register.PrometheusMetricsRegister;
 import org.apache.shardingsphere.agent.spi.boot.PluginBootService;
 import org.apache.shardingsphere.agent.metrics.prometheus.collector.BuildInfoCollector;
 
@@ -39,6 +41,7 @@ public final class PrometheusPluginBootService implements PluginBootService {
     @Override
     public void start(final PluginConfiguration pluginConfig) {
         startServer(pluginConfig);
+        MetricsReporter.register(PrometheusMetricsRegister.getInstance());
     }
     
     @Override
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory
deleted file mode 100644
index 2d4063d..0000000
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.metrics.api.MetricsRegisterFactory
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.shardingsphere.agent.metrics.prometheus.register.PrometheusMetricsRegisterFactory
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/definition/OpenTracingPluginDefinitionService.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/definition/OpenTracingPlugi [...]
index eedbfb9..5dc9844 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/definition/OpenTracingPluginDefinitionService.java
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/definition/OpenTracingPluginDefinitionService.java
@@ -65,6 +65,6 @@ public final class OpenTracingPluginDefinitionService extends AbstractPluginDefi
     
     @Override
     public String getType() {
-        return "OpenTracing";
+        return "Opentracing";
     }
 }
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/service/OpenTracingPluginBootService.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/service/OpenTracingPluginBootService.java
index 78a1a90..8bc13fb 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/service/OpenTracingPluginBootService.java
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/service/OpenTracingPluginBootService.java
@@ -45,7 +45,7 @@ public final class OpenTracingPluginBootService implements PluginBootService {
     
     @Override
     public String getType() {
-        return "OpenTracing";
+        return "Opentracing";
     }
     
     private void init(final Tracer tracer) {