This is an automated email from the ASF dual-hosted git repository.
dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-exporter.git
The following commit(s) were added to refs/heads/master by this push:
new 59d58bb Fix travis-ci error.
59d58bb is described below
commit 59d58bb3b144620f163b47dc8008230faedd4509
Author: ShannonDing <[email protected]>
AuthorDate: Mon Mar 14 20:38:45 2022 +0800
Fix travis-ci error.
---
.travis.yml | 5 +--
README.md | 2 ++
pom.xml | 36 ++++++++++++++++++++++
src/main/docker/Dockerfile | 17 ++++++++++
.../exporter/RocketMQExporterApplication.java | 8 ++++-
.../rocketmq/exporter/task/MetricsCollectTask.java | 29 ++++++++---------
src/main/resources/logback.xml | 16 ++++++++++
.../apache/rocketmq/exporter/util/UtilsTest.java | 16 ++++++++++
8 files changed, 110 insertions(+), 19 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1c8ad51..693023b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then jdk_switcher use "$CUSTOM_JDK";
fi
script:
- - travis_retry mvn clean install
+ - travis_retry mvn -B clean apache-rat:check
+ - travis_retry mvn -B clean install cobertura:cobertura
after_success:
- - bash <(curl -s https://codecov.io/bash) -t
11a6acce-59a1-4586-9bf6-164878d045cf || echo 'Codecov failed to upload'
+ - bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'
diff --git a/README.md b/README.md
index 2442b83..1fd22e5 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# Apache RocketMQ Exporter for Prometheus.
[](https://www.apache.org/licenses/LICENSE-2.0.html)
+[](https://travis-ci.com/github/apache/rocketmq-exporter)
+[](https://codecov.io/gh/apache/rocketmq-exporter)
[](http://isitmaintained.com/project/apache/rocketmq-exporter
"Average time to resolve an issue")
[](http://isitmaintained.com/project/apache/rocketmq-exporter
"Percentage of issues still open")

diff --git a/pom.xml b/pom.xml
index 7404eab..d506f2c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,6 +103,42 @@
</resources>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.12</version>
+ <configuration>
+ <excludes>
+ <exclude>.travis.yml</exclude>
+ <exclude>.asf.yaml</exclude>
+ <exclude>CONTRIBUTING.md</exclude>
+ <exclude>.github/*</exclude>
+ <exclude>.github/*/*</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>style/**</exclude>
+ <exclude>README.md</exclude>
+ <exclude>BUILDING</exclude>
+ <exclude>LICENSE</exclude>
+ <exclude>NOTICE</exclude>
+ <exclude>example.rules</exclude>
+ <exclude>rocketmq_exporter_quickstart.md</exclude>
+ <exclude>rocketmq_exporter_overview.json</exclude>
+ <exclude>src/main/resources/application.yml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <formats>
+ <format>html</format>
+ <format>xml</format>
+ </formats>
+ <check/>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index 2cc2d94..3a559ad 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -1,3 +1,20 @@
+#
+# 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.
+#
+
FROM java:8
MAINTAINER breeze
ADD rocketmq-exporter-0.0.2-SNAPSHOT.jar quickstart.jar
diff --git
a/src/main/java/org/apache/rocketmq/exporter/RocketMQExporterApplication.java
b/src/main/java/org/apache/rocketmq/exporter/RocketMQExporterApplication.java
index 05c5654..0b0379c 100644
---
a/src/main/java/org/apache/rocketmq/exporter/RocketMQExporterApplication.java
+++
b/src/main/java/org/apache/rocketmq/exporter/RocketMQExporterApplication.java
@@ -16,6 +16,7 @@
*/
package org.apache.rocketmq.exporter;
+import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
@@ -24,10 +25,15 @@ import
org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@ServletComponentScan
@EnableScheduling
-public class RocketMQExporterApplication {
+public class RocketMQExporterApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(RocketMQExporterApplication.class, args);
}
+
+ @Override public void run(String... args) throws Exception {
+ System.out.println(args[0]);
+ System.out.println(args[1]);
+ }
}
diff --git
a/src/main/java/org/apache/rocketmq/exporter/task/MetricsCollectTask.java
b/src/main/java/org/apache/rocketmq/exporter/task/MetricsCollectTask.java
index a2c3139..da2957c 100644
--- a/src/main/java/org/apache/rocketmq/exporter/task/MetricsCollectTask.java
+++ b/src/main/java/org/apache/rocketmq/exporter/task/MetricsCollectTask.java
@@ -295,8 +295,7 @@ public class MetricsCollectTask {
//log.warn(String.format("no any offset for consumer(%s),
topic(%s), ignore this", group, topic));
continue;
}
- if (messageModel == MessageModel.CLUSTERING)
- {
+ if (messageModel == MessageModel.CLUSTERING) {
diff = consumeStats.computeTotalDiff();
consumeTPS = consumeStats.getConsumeTps();
metricsService.getCollector().addGroupDiffMetric(
@@ -499,7 +498,7 @@ public class MetricsCollectTask {
Utils.getFixedDouble(bsd.getStatsMinute().getTps()));
} catch (MQClientException ex) {
if (ex.getResponseCode() ==
ResponseCode.SYSTEM_ERROR) {
- //
log.error(String.format("GROUP_GET_SIZE-error, topic=%s, group=%s, master
broker=%s, %s", topic, group, masterAddr, ex.getErrorMessage()));
+ //
log.error(String.format("GROUP_GET_SIZE-error, topic=%s, group=%s, master
broker=%s, %s", topic, group, masterAddr, ex.getErrorMessage()));
} else {
log.error(String.format("GROUP_GET_SIZE-error,
topic=%s, group=%s, master broker=%s", topic, group, masterAddr), ex);
}
@@ -563,14 +562,13 @@ public class MetricsCollectTask {
brokerIP,
brokerName,
Utils.getFixedDouble(bsd.getStatsMinute().getTps()));
- } catch (MQClientException ex){
+ } catch (MQClientException ex) {
if (ex.getResponseCode() == ResponseCode.SYSTEM_ERROR) {
// log.error(String.format("GROUP_GET_SIZE-error,
topic=%s, group=%s, master broker=%s, %s", topic, group, masterAddr,
ex.getErrorMessage()));
} else {
- log.error(String.format("BROKER_PUT_NUMS-error, master
broker=%s", masterAddr), ex);
+ log.error(String.format("BROKER_PUT_NUMS-error, master
broker=%s", masterAddr), ex);
}
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
log.error(String.format("BROKER_PUT_NUMS-error, master
broker=%s", masterAddr), ex);
}
try {
@@ -580,14 +578,13 @@ public class MetricsCollectTask {
brokerIP,
brokerName,
Utils.getFixedDouble(bsd.getStatsMinute().getTps()));
- } catch (MQClientException ex){
- if (ex.getResponseCode() == ResponseCode.SYSTEM_ERROR) {
- // log.error(String.format("GROUP_GET_SIZE-error, topic=%s,
group=%s, master broker=%s, %s", topic, group, masterAddr,
ex.getErrorMessage()));
- } else {
- log.error(String.format("BROKER_GET_NUMS-error, master
broker=%s", masterAddr), ex);
- }
- }
- catch (Exception ex) {
+ } catch (MQClientException ex) {
+ if (ex.getResponseCode() == ResponseCode.SYSTEM_ERROR) {
+ // log.error(String.format("GROUP_GET_SIZE-error,
topic=%s, group=%s, master broker=%s, %s", topic, group, masterAddr,
ex.getErrorMessage()));
+ } else {
+ log.error(String.format("BROKER_GET_NUMS-error, master
broker=%s", masterAddr), ex);
+ }
+ } catch (Exception ex) {
log.error(String.format("BROKER_GET_NUMS-error, master
broker=%s", masterAddr), ex);
}
}
@@ -661,7 +658,7 @@ public class MetricsCollectTask {
private void handleTopicNotExistException(int responseCode, Exception ex,
String topic, String group) {
if (responseCode == ResponseCode.TOPIC_NOT_EXIST || responseCode ==
ResponseCode.CONSUMER_NOT_ONLINE) {
- // log.error(String.format("get topic's(%s) consumer-stats(%s)
exception, detail: %s", topic, group, ex.getMessage()));
+ // log.error(String.format("get topic's(%s) consumer-stats(%s)
exception, detail: %s", topic, group, ex.getMessage()));
} else {
log.error(String.format("get topic's(%s) consumer-stats(%s)
exception", topic, group), ex);
}
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index 36b2241..48a7e41 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -1,4 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="UTF-8">
diff --git a/src/test/java/org/apache/rocketmq/exporter/util/UtilsTest.java
b/src/test/java/org/apache/rocketmq/exporter/util/UtilsTest.java
index 4d756e9..6ea67c5 100644
--- a/src/test/java/org/apache/rocketmq/exporter/util/UtilsTest.java
+++ b/src/test/java/org/apache/rocketmq/exporter/util/UtilsTest.java
@@ -1,3 +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.
+ */
package org.apache.rocketmq.exporter.util;
import org.assertj.core.api.Assertions;