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

xiaoyu 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 ccf8442  Code format for agent (#8752)
ccf8442 is described below

commit ccf8442bb5421ab198ae9b616b66fc6401a90633
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Dec 24 16:41:53 2020 +0800

    Code format for agent (#8752)
    
    * Code format for ZipkinTracingBootService
    
    * Code format for BuildInfoCollector
    
    * Remove duplicate copyright
---
 .../prometheus/collector/BuildInfoCollector.java        |  4 ++--
 ...rdingsphere.agent.metrics.api.MetricsRegisterFactory | 17 -----------------
 .../zipkin/service/ZipkinTracingBootService.java        |  8 ++++----
 3 files changed, 6 insertions(+), 23 deletions(-)

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/collector/BuildInfoCollector.java
 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java
index a315222..ada3f8c 100644
--- 
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java
+++ 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/main/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/BuildInfoCollector.java
@@ -30,12 +30,12 @@ public final class BuildInfoCollector extends Collector {
     
     @Override
     public List<MetricFamilySamples> collect() {
-        List<MetricFamilySamples> result = new ArrayList<>();
+        List<MetricFamilySamples> result = new ArrayList<>(1);
         GaugeMetricFamily artifactInfo = new GaugeMetricFamily(
                 "jmx_exporter_build_info",
                 "A metric with a constant '1' value labeled with the version 
of the JMX exporter.",
                 Arrays.asList("version", "name"));
-        Package pkg = this.getClass().getPackage();
+        Package pkg = getClass().getPackage();
         String version = pkg.getImplementationVersion();
         String name = pkg.getImplementationTitle();
         artifactInfo.addMetric(Arrays.asList(null != version ? version : 
"unknown", null != name ? name : "unknown"), 1L);
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
index 025aaea..2d4063d 100644
--- 
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
@@ -15,21 +15,4 @@
 # limitations under the License.
 #
 
-#
-# 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-zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/service/ZipkinTracingBootService.java
 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/service/ZipkinTracingBootService.java
index f7f43f7..3725a91 100644
--- 
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/service/ZipkinTracingBootService.java
+++ 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/service/ZipkinTracingBootService.java
@@ -34,18 +34,18 @@ public final class ZipkinTracingBootService implements 
BootService<ZipkinPluginC
     private OkHttpSender sender;
     
     private Tracing tracing;
-
+    
     @Override
     public void setup(final ZipkinPluginConfiguration configuration) {
         sender = OkHttpSender.create(buildHttpPath(configuration));
         zipkinSpanHandler = AsyncZipkinSpanHandler.create(sender);
     }
-
+    
     @Override
     public void start(final ZipkinPluginConfiguration configuration) {
         tracing = 
Tracing.newBuilder().localServiceName("shardingsphere-agent").addSpanHandler(zipkinSpanHandler).build();
     }
-
+    
     @Override
     public void cleanup() {
         tracing.close();
@@ -59,6 +59,6 @@ public final class ZipkinTracingBootService implements 
BootService<ZipkinPluginC
     }
     
     private String buildHttpPath(final ZipkinPluginConfiguration 
configuration) {
-        return "http://"; + configuration.getHost() + ":" + 
configuration.getPort();
+        return String.format("http://%s:%s";, configuration.getHost(), 
configuration.getPort());
     }
 }

Reply via email to