Skip to content

Commit 32b0bfd

Browse files
committed
1 功能完善
支持rocketmq 4.7.1 broker数据统计支持addr(一台机器可以部署多个broker)。 支持broker存储数据远程迁移,校验。 客户端启动抓取配置报错日志完善 增加生产消费micrometer统计 支持broker主从同步数据监控预警 服务器链接支持链接池 消费失败的消息,邮件提醒支持一键跳过 审核列表支持分页展示 topic名等支持点击复制 bootstrap升级为3.4.1 增加纯go客户端接入wiki 增加广播模式重置偏移量wiki 2 bug修复 fix统计获取生产者组为空的bug fix收集任务异常终止的bug。 fix广播消费者重复监控的bug fix本地更新broker的bug fix趋势图时间展示不全的bug fix消费者创建失败导致数据不完全的bug fix broker监控未按时执行的bug fix趋势图单位显示bug fix消息过长撑爆td的bug
1 parent b5e7bbb commit 32b0bfd

File tree

184 files changed

+12950
-7741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+12950
-7741
lines changed

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ pom.xml.versionsBackup
1414
.project
1515
.classpath
1616
.settings
17-
.metadata
18-
.cache
17+
.metadata
18+
.cache
1919

2020
!**/msg-type/*.class
2121

2222
# ignore idea files
2323
.idea
24-
*.iml
24+
*.iml

mq-client-common-open/pom.xml

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
<parent>
77
<groupId>com.sohu.tv</groupId>
88
<artifactId>mq</artifactId>
9-
<version>4.6.5</version>
9+
<version>4.7.1</version>
1010
</parent>
1111

1212
<artifactId>mq-client-common-open</artifactId>
1313
<packaging>jar</packaging>
14+
15+
<properties>
16+
<micrometer.version>1.3.11</micrometer.version>
17+
</properties>
1418

1519
<dependencies>
1620
<dependency>
@@ -34,6 +38,12 @@
3438
<artifactId>hystrix-core</artifactId>
3539
<optional>true</optional>
3640
</dependency>
41+
<dependency>
42+
<groupId>io.micrometer</groupId>
43+
<artifactId>micrometer-core</artifactId>
44+
<version>${micrometer.version}</version>
45+
<optional>true</optional>
46+
</dependency>
3747
</dependencies>
3848

3949
<build>

mq-client-common-open/src/main/java/com/sohu/tv/mq/common/AbstractConfig.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.net.HttpURLConnection;
44
import java.util.ArrayList;
5-
import java.util.List;
5+
import java.util.List;
66

77
import org.apache.commons.lang3.StringUtils;
88
import org.apache.rocketmq.client.ClientConfig;
@@ -126,7 +126,8 @@ protected void init() {
126126
logger.warn("please register your {}:{} topic:{} in MQCloud first, times:{}",
127127
role() == 1 ? "producer" : "consumer", group, topic, times++);
128128
} else {
129-
logger.warn("fetch cluster info err:{}, times:{}", clusterInfoDTOResult.getMessage(), times++);
129+
logger.warn("fetch topic:{} group:{} cluster info err:{}, times:{}", getTopic(), group,
130+
clusterInfoDTOResult.getMessage(), times++);
130131
}
131132
try {
132133
Thread.sleep(1000);
@@ -235,7 +236,7 @@ protected void initTrace() {
235236
traceRocketMQProducer.getProducer().setSendMsgTimeout(5000);
236237
traceRocketMQProducer.getProducer().setMaxMessageSize(traceDispatcher.getMaxMsgSize() - 10 * 1000);
237238
traceRocketMQProducer.setMqCloudDomain(mqCloudDomain);
238-
traceRocketMQProducer.setInstanceName(getGroup());
239+
traceRocketMQProducer.setInstanceName(getGroup());
239240
// 启动trace producer
240241
traceRocketMQProducer.start();
241242
// 赋给TraceDispatcher
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.sohu.tv.mq.common;
2+
3+
/**
4+
* 消费异常
5+
*
6+
* @author yongfeigao
7+
* @date 2020年12月21日
8+
*/
9+
public class ConsumeException extends Exception {
10+
private static final long serialVersionUID = 3662764764579878687L;
11+
12+
public ConsumeException() {
13+
super();
14+
}
15+
16+
public ConsumeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
17+
super(message, cause, enableSuppression, writableStackTrace);
18+
}
19+
20+
public ConsumeException(String message, Throwable cause) {
21+
super(message, cause);
22+
}
23+
24+
public ConsumeException(String message) {
25+
super(message);
26+
}
27+
28+
public ConsumeException(Throwable cause) {
29+
super(cause);
30+
}
31+
}

mq-client-common-open/src/main/java/com/sohu/tv/mq/common/SohuSendMessageHook.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
*/
1919
public class SohuSendMessageHook implements SendMessageHook {
2020
private final Logger logger = LoggerFactory.getLogger(this.getClass());
21-
21+
2222
// 统计助手
2323
private StatsHelper statsHelper;
2424

2525
public SohuSendMessageHook(DefaultMQProducer producer) {
2626
statsHelper = new StatsHelper();
27+
// 获取生产者group
28+
statsHelper.setProducer(producer.getProducerGroup());
2729
// 最大耗时,延后500毫秒
2830
statsHelper.init(producer.getSendMsgTimeout() + 500);
2931
// 客户端id
3032
statsHelper.setClientId(buildMQClientId(producer));
31-
// 获取生产者group
32-
statsHelper.setProducer(producer.getProducerGroup());
3333
}
3434

3535
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.sohu.tv.mq.metric;
2+
3+
import java.io.Serializable;
4+
/**
5+
* mq指标
6+
*
7+
* @author yongfeigao
8+
* @date 2020年12月22日
9+
*/
10+
public class MQMetrics implements Serializable {
11+
private static final long serialVersionUID = 738296259571004441L;
12+
// 最大耗时
13+
private int maxTime;
14+
// 总耗时
15+
private long totalTime;
16+
// 调用次数
17+
private int totalCount;
18+
// 异常次数
19+
private int exceptionCount;
20+
// 生产或消费组
21+
private String group;
22+
23+
public int getMaxTime() {
24+
return maxTime;
25+
}
26+
27+
public MQMetrics setMaxTime(int maxTime) {
28+
if (maxTime > this.maxTime) {
29+
this.maxTime = maxTime;
30+
}
31+
return this;
32+
}
33+
34+
public long getTotalTime() {
35+
return totalTime;
36+
}
37+
38+
public void setTotalTime(long totalTime) {
39+
this.totalTime = totalTime;
40+
}
41+
42+
public MQMetrics addTotalTime(long totalTime) {
43+
this.totalTime += totalTime;
44+
return this;
45+
}
46+
47+
public int getTotalCount() {
48+
return totalCount;
49+
}
50+
51+
public void setTotalCount(int totalCount) {
52+
this.totalCount = totalCount;
53+
}
54+
55+
public MQMetrics addTotalCount(int totalCount) {
56+
this.totalCount += totalCount;
57+
return this;
58+
}
59+
60+
public int getExceptionCount() {
61+
return exceptionCount;
62+
}
63+
64+
public void setExceptionCount(int exceptionCount) {
65+
this.exceptionCount = exceptionCount;
66+
}
67+
68+
public MQMetrics addExceptionCount(int exceptionCount) {
69+
this.exceptionCount += exceptionCount;
70+
return this;
71+
}
72+
73+
public String getGroup() {
74+
return group;
75+
}
76+
77+
public void setGroup(String group) {
78+
this.group = group;
79+
}
80+
81+
@Override
82+
public String toString() {
83+
return "MQMetrics [maxTime=" + maxTime + ", totalTime=" + totalTime + ", totalCount=" + totalCount
84+
+ ", exceptionCount=" + exceptionCount + ", group=" + group + "]";
85+
}
86+
}

0 commit comments

Comments
 (0)