rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wlliqip...@apache.org
Subject [rocketmq-exporter] 40/43: format codes
Date Sun, 08 Mar 2020 13:17:00 GMT
This is an automated email from the ASF dual-hosted git repository.

wlliqipeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-exporter.git

commit 95153a0f4c19ce6272d4f8d28b75e05d5e15c40a
Author: liwei5 <liwei5@vipkid.com.cn>
AuthorDate: Thu Dec 12 12:34:20 2019 +0800

    format codes
---
 pom.xml                                            | 182 ++++++++++-----------
 .../exporter/collector/RMQMetricsCollector.java    |   2 +-
 .../rocketmq/exporter/task/MetricsCollectTask.java |  15 +-
 3 files changed, 100 insertions(+), 99 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8a84c73..6a465b3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,46 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.springframework.boot</groupId>
-		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.1.2.RELEASE</version>
-		<relativePath/> <!-- lookup parent from repository -->
-	</parent>
-	<groupId>org.apache</groupId>
-	<artifactId>rocketmq-exporter</artifactId>
-	<version>0.0.1-SNAPSHOT</version>
-	<name>rocketmq-exporter</name>
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.1.2.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>org.apache</groupId>
+    <artifactId>rocketmq-exporter</artifactId>
+    <version>0.0.2-SNAPSHOT</version>
+    <name>rocketmq-exporter</name>
 
-	<description>Demo project for Spring Boot</description>
+    <description>Demo project for Spring Boot</description>
 
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<java.version>1.7</java.version>
-		<guava.version>16.0.1</guava.version>
-		<commons-digester.version>2.1</commons-digester.version>
-		<commons-lang.version>2.6</commons-lang.version>
-		<commons-io.version>2.4</commons-io.version>
-		<commons-cli.version>1.2</commons-cli.version>
-		<rocketmq.version>4.4.0</rocketmq.version>
-		<surefire.version>2.19.1</surefire.version>
-		<aspectj.version>1.8.9</aspectj.version>
-		<main.basedir>${basedir}/../..</main.basedir>
-		<docker.image.prefix>docker.io</docker.image.prefix>
-	</properties>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <java.version>1.7</java.version>
+        <guava.version>16.0.1</guava.version>
+        <commons-digester.version>2.1</commons-digester.version>
+        <commons-lang.version>2.6</commons-lang.version>
+        <commons-io.version>2.4</commons-io.version>
+        <commons-cli.version>1.2</commons-cli.version>
+        <rocketmq.version>4.4.0</rocketmq.version>
+        <surefire.version>2.19.1</surefire.version>
+        <aspectj.version>1.8.9</aspectj.version>
+        <main.basedir>${basedir}/../..</main.basedir>
+        <docker.image.prefix>docker.io</docker.image.prefix>
+    </properties>
 
-	<dependencies>
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-web</artifactId>
-		</dependency>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
 
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-test</artifactId>
-			<scope>test</scope>
-		</dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.rocketmq</groupId>
             <artifactId>rocketmq-tools</artifactId>
@@ -61,16 +61,16 @@
             <artifactId>rocketmq-broker</artifactId>
             <version>${rocketmq.version}</version>
         </dependency>
-		<dependency>
-			<groupId>org.aspectj</groupId>
-			<artifactId>aspectjrt</artifactId>
-			<version>${aspectj.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.aspectj</groupId>
-			<artifactId>aspectjweaver</artifactId>
-			<version>${aspectj.version}</version>
-		</dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjrt</artifactId>
+            <version>${aspectj.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+            <version>${aspectj.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.jooq</groupId>
             <artifactId>joor</artifactId>
@@ -86,50 +86,50 @@
             <artifactId>simpleclient_common</artifactId>
             <version>0.6.0</version>
         </dependency>
-	</dependencies>
+    </dependencies>
 
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.springframework.boot</groupId>
-				<artifactId>spring-boot-maven-plugin</artifactId>
-			</plugin>
-			<plugin>
-				<artifactId>maven-checkstyle-plugin</artifactId>
-				<version>2.17</version>
-				<executions>
-					<execution>
-						<id>verify</id>
-						<phase>verify</phase>
-						<configuration>
-							<configLocation>style/rmq_checkstyle.xml</configLocation>
-							<encoding>UTF-8</encoding>
-							<consoleOutput>true</consoleOutput>
-							<failsOnError>true</failsOnError>
-							<includeTestSourceDirectory>false</includeTestSourceDirectory>
-						</configuration>
-						<goals>
-							<goal>check</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-				<version>0.4.11</version>
-				<configuration>
-					<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
-					<dockerDirectory>src/main/docker</dockerDirectory>
-					<resources>
-						<resource>
-							<targetPath>/</targetPath>
-							<directory>${project.build.directory}</directory>
-							<include>${project.build.finalName}.jar</include>
-						</resource>
-					</resources>
-				</configuration>
-			</plugin>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <version>2.17</version>
+                <executions>
+                    <execution>
+                        <id>verify</id>
+                        <phase>verify</phase>
+                        <configuration>
+                            <configLocation>style/rmq_checkstyle.xml</configLocation>
+                            <encoding>UTF-8</encoding>
+                            <consoleOutput>true</consoleOutput>
+                            <failsOnError>true</failsOnError>
+                            <includeTestSourceDirectory>false</includeTestSourceDirectory>
+                        </configuration>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>0.4.11</version>
+                <configuration>
+                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
+                    <dockerDirectory>src/main/docker</dockerDirectory>
+                    <resources>
+                        <resource>
+                            <targetPath>/</targetPath>
+                            <directory>${project.build.directory}</directory>
+                            <include>${project.build.finalName}.jar</include>
+                        </resource>
+                    </resources>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
@@ -140,6 +140,6 @@
             </plugin>
         </plugins>
 
-	</build>
+    </build>
 
 </project>
diff --git a/src/main/java/org/apache/rocketmq/exporter/collector/RMQMetricsCollector.java
b/src/main/java/org/apache/rocketmq/exporter/collector/RMQMetricsCollector.java
index 253e9f9..298b2fe 100644
--- a/src/main/java/org/apache/rocketmq/exporter/collector/RMQMetricsCollector.java
+++ b/src/main/java/org/apache/rocketmq/exporter/collector/RMQMetricsCollector.java
@@ -52,7 +52,7 @@ public class RMQMetricsCollector extends Collector {
     private ConcurrentHashMap<ConsumerTopicDiffMetric, Long> consumerDiff = new ConcurrentHashMap<>();
     //retry diff for consumer group
     private ConcurrentHashMap<ConsumerTopicDiffMetric, Long> consumerRetryDiff = new
ConcurrentHashMap<>();
-    //死信堆积 todo 检查是否存在这个数据 应该不存在
+    //dlq diff for consumer group
     private ConcurrentHashMap<ConsumerTopicDiffMetric, Long> consumerDLQDiff = new
ConcurrentHashMap<>();
     //consumer count
     private ConcurrentHashMap<ConsumerCountMetric, Integer> consumerCounts = new ConcurrentHashMap<>();
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 f1777ec..b3e7d5e 100644
--- a/src/main/java/org/apache/rocketmq/exporter/task/MetricsCollectTask.java
+++ b/src/main/java/org/apache/rocketmq/exporter/task/MetricsCollectTask.java
@@ -219,13 +219,14 @@ public class MetricsCollectTask {
                     MessageQueue q = consumeStatusEntry.getKey();
                     OffsetWrapper offset = consumeStatusEntry.getValue();
 
-                    //topic + consumer group 生产offset
+                    //topic + consumer group
                     totalBrokerOffset += totalBrokerOffset + offset.getBrokerOffset();
-                    //topic + consumer group 消费offset
+                    //topic + consumer group
                     totalConsumerOffset += offset.getConsumerOffset();
                 }
                 metricsService.getCollector().addGroupBrokerTotalOffsetMetric(topic, group,
totalBrokerOffset);
                 metricsService.getCollector().addGroupConsumerTotalOffsetMetric(topic, group,
totalBrokerOffset);
+
             }
         }
         log.info("consumer offset collection task finished...." + (System.currentTimeMillis()
- start));
@@ -276,7 +277,7 @@ public class MetricsCollectTask {
                 if (!StringUtils.isBlank(masterAddr)) {
                     BrokerStatsData bsd = null;
                     try {
-                        //topic发了多少条消息
+                        //how many messages has sent for the topic
                         bsd = mqAdminExt.viewBrokerStatsData(masterAddr, BrokerStatsManager.TOPIC_PUT_NUMS,
topic);
                         String brokerIP = clusterInfo.getBrokerAddrTable().get(bd.getBrokerName()).getBrokerAddrs().get(MixAll.MASTER_ID);
                         metricsService.getCollector().addTopicPutNumsMetric(
@@ -297,7 +298,7 @@ public class MetricsCollectTask {
                         log.error(String.format("TOPIC_PUT_NUMS-error, topic=%s, master broker=%s",
topic, masterAddr), ex1);
                     }
                     try {
-                        //topic总共发了多少字节
+                        //how many bytes has sent for the topic
                         bsd = mqAdminExt.viewBrokerStatsData(masterAddr, BrokerStatsManager.TOPIC_PUT_SIZE,
topic);
                         String brokerIP = clusterInfo.getBrokerAddrTable().get(bd.getBrokerName()).getBrokerAddrs().get(MixAll.MASTER_ID);
                         metricsService.getCollector().addTopicPutSizeMetric(
@@ -338,7 +339,7 @@ public class MetricsCollectTask {
                         String statsKey = String.format("%s@%s", topic, group);
                         BrokerStatsData bsd = null;
                         try {
-                            //消费者消费了多少条消息
+                            //how many messages the consumer has get for the topic
                             bsd = mqAdminExt.viewBrokerStatsData(masterAddr, BrokerStatsManager.GROUP_GET_NUMS,
statsKey);
                             metricsService.getCollector().addGroupGetNumsMetric(
                                     topic,
@@ -354,7 +355,7 @@ public class MetricsCollectTask {
                             log.error(String.format("GROUP_GET_NUMS-error, topic=%s, group=%s,master
broker=%s", topic, group, masterAddr), ex);
                         }
                         try {
-                            //消费者消费了多少字节
+                            //how many bytes the consumer has get for the topic
                             bsd = mqAdminExt.viewBrokerStatsData(masterAddr, BrokerStatsManager.GROUP_GET_SIZE,
statsKey);
                             metricsService.getCollector().addGroupGetSizeMetric(
                                     topic,
@@ -370,7 +371,7 @@ public class MetricsCollectTask {
                             log.error(String.format("GROUP_GET_SIZE-error, topic=%s, group=%s,
master broker=%s", topic, group, masterAddr), ex);
                         }
                         try {
-                            //消费者重新消费topic的次数
+                            ////how many re-send times the consumer did for the topic
                             bsd = mqAdminExt.viewBrokerStatsData(masterAddr, BrokerStatsManager.SNDBCK_PUT_NUMS,
statsKey);
                             metricsService.getCollector().addSendBackNumsMetric(
                                     topic,


Mime
View raw message