Skip to content

Commit

Permalink
Change the SendBackNums metric from TPS to a one-minute value
Browse files Browse the repository at this point in the history
  • Loading branch information
haozhijie committed Mar 12, 2021
1 parent 544b623 commit 20b6c39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class RMQMetricsCollector extends Collector {
//consumed message size(byte) for consumer-topic
private ConcurrentHashMap<ConsumerMetric, Double> groupGetSize = new ConcurrentHashMap<>();
//re-consumed message count for consumer-topic
private ConcurrentHashMap<ConsumerMetric, Double> sendBackNums = new ConcurrentHashMap<>();
private ConcurrentHashMap<ConsumerMetric, Long> sendBackNums = new ConcurrentHashMap<>();
// group latency time
private ConcurrentHashMap<ConsumerMetric, Long> groupLatencyByTime = new ConcurrentHashMap<>();

Expand Down Expand Up @@ -500,7 +500,7 @@ private void collectGroupNums(List<MetricFamilySamples> mfs) {
mfs.add(groupGetSizeGauge);

GaugeMetricFamily sendBackNumsGauge = new GaugeMetricFamily("rocketmq_send_back_nums", "SendBackNums", GROUP_NUMS_LABEL_NAMES);
for (Map.Entry<ConsumerMetric, Double> entry : sendBackNums.entrySet()) {
for (Map.Entry<ConsumerMetric, Long> entry : sendBackNums.entrySet()) {
loadGroupNumsMetric(sendBackNumsGauge, entry);
}
mfs.add(sendBackNumsGauge);
Expand Down Expand Up @@ -597,7 +597,7 @@ public void addGroupGetSizeMetric(String clusterName, String brokerName, String
groupGetSize.put(new ConsumerMetric(clusterName, brokerName, topic, group), value);
}

public void addSendBackNumsMetric(String clusterName, String brokerName, String topic, String group, double value) {
public void addSendBackNumsMetric(String clusterName, String brokerName, String topic, String group, long value) {
sendBackNums.put(new ConsumerMetric(clusterName, brokerName, topic, group), value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public void collectBrokerStatsTopic() {
bd.getBrokerName(),
topic,
group,
Utils.getFixedDouble(bsd.getStatsMinute().getTps()));
bsd.getStatsMinute().getSum());
} catch (MQClientException ex) {
if (ex.getResponseCode() == ResponseCode.SYSTEM_ERROR) {
log.error(String.format("SNDBCK_PUT_NUMS-error, topic=%s, group=%s, master broker=%s, %s", topic, group, masterAddr, ex.getErrorMessage()));
Expand Down

0 comments on commit 20b6c39

Please sign in to comment.