Skip to content

Commit

Permalink
Merge pull request apache#16 from breezecoolyang/master
Browse files Browse the repository at this point in the history
Fix bug for the problem of code style and fix bug for some metrics
  • Loading branch information
hdchen authored May 21, 2020
2 parents 5d25982 + 2a24087 commit 910caff
Show file tree
Hide file tree
Showing 25 changed files with 639 additions and 158 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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.config;


Expand Down
Original file line number Diff line number Diff line change
@@ -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.config;

import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.model;

import org.apache.rocketmq.common.protocol.body.KVTable;
Expand Down Expand Up @@ -123,9 +139,16 @@ private void loadCommitLogDirCapacity(String commitLogDirCapacity) {

private void loadTps(PutTps putTps, String value) {
String[] arr = value.split(" ");
putTps.ten = Double.parseDouble(arr[0]);
putTps.sixty = Double.parseDouble(arr[1]);
putTps.sixHundred = Double.parseDouble(arr[2]);
if (arr.length >= 1) {
putTps.ten = Double.parseDouble(arr[0]);
}
if (arr.length >= 2) {
putTps.sixty = Double.parseDouble(arr[1]);
}
if (arr.length >= 3) {
putTps.sixHundred = Double.parseDouble(arr[2]);
}

}

private void loadPutMessageDistributeTime(String str) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.model.common;

public class TwoTuple<T1, T2> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public class BrokerMetric {
private String clusterName;
private String brokerIP;
private String brokerHost;
private String brokerName;

public BrokerMetric(String clusterName, String brokerIP, String brokerHost) {
public BrokerMetric(String clusterName, String brokerIP, String brokerName) {
this.clusterName = clusterName;
this.brokerIP = brokerIP;
this.brokerHost = brokerHost;
this.brokerName = brokerName;
}

public String getClusterName() {
Expand All @@ -43,12 +43,12 @@ public void setBrokerIP(String brokerIP) {
this.brokerIP = brokerIP;
}

public String getBrokerHost() {
return brokerHost;
public String getBrokerName() {
return brokerName;
}

public void setBrokerHost(String brokerHost) {
this.brokerHost = brokerHost;
public void setBrokerName(String brokerName) {
this.brokerName = brokerName;
}

@Override
Expand All @@ -72,6 +72,6 @@ public int hashCode() {

@Override
public String toString() {
return "ClusterName: " + clusterName + " brokerIP: " + brokerIP + " brokerHost: " + brokerHost;
return "ClusterName: " + clusterName + " brokerIP: " + brokerIP + " brokerHost: " + brokerName;
}
}
Original file line number Diff line number Diff line change
@@ -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.model.metrics;

public class ConsumerCountMetric {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
package org.apache.rocketmq.exporter.model.metrics;

public class ConsumerMetric {
private String clusterName;
private String brokerName;
private String topicName;
private String consumerGroupName;

public ConsumerMetric(String topicName, String consumerGroupName) {
public ConsumerMetric(String clusterName, String brokerName, String topicName, String consumerGroupName) {
this.clusterName = clusterName;
this.brokerName = brokerName;
this.topicName = topicName;
this.consumerGroupName = consumerGroupName;
}
Expand All @@ -41,27 +45,46 @@ public void setConsumerGroupName(String consumerGroupName) {
this.consumerGroupName = consumerGroupName;
}

public String getClusterName() {
return clusterName;
}

public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}

public String getBrokerName() {
return brokerName;
}

public void setBrokerName(String brokerName) {
this.brokerName = brokerName;
}

@Override
public boolean equals(Object obj) {
if (!(obj instanceof ConsumerMetric)) {
return false;
}
ConsumerMetric other = (ConsumerMetric) obj;

return other.topicName.equals(topicName) &&
other.consumerGroupName.equals(consumerGroupName);
return other.clusterName.equals(clusterName) && other.brokerName.equals(brokerName)
&& other.topicName.equals(topicName) && other.consumerGroupName.equals(consumerGroupName);
}

@Override
public int hashCode() {
int hash = 1;
hash = 37 * hash + clusterName.hashCode();
hash = 37 * hash + brokerName.hashCode();
hash = 37 * hash + topicName.hashCode();
hash = 37 * hash + consumerGroupName.hashCode();
return hash;
}

@Override
public String toString() {
return "topicName: " + topicName + " ConsumeGroupName: " + consumerGroupName;
return "clusterName: " + clusterName + "brokerName: " + brokerName
+ "topicName: " + topicName + " ConsumeGroupName: " + consumerGroupName;
}
}
Original file line number Diff line number Diff line change
@@ -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.model.metrics;

public class ConsumerTopicDiffMetric {
Expand All @@ -11,7 +27,7 @@ public ConsumerTopicDiffMetric(String group, String topic, String countOfOnlineC
private String group;
private String topic;
private String countOfOnlineConsumers;
private String msgModel;//0broadcast, 1:cluster
private String msgModel; //0:broadcast, 1:cluster

public String getGroup() {
return group;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
/*
* 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.model.metrics;

public class DLQTopicOffsetMetric {
private String clusterName;
private String brokerNames;
private String brokerName;
private String group;
private long lastUpdateTimestamp;

public DLQTopicOffsetMetric(String clusterName, String brokerNames, String group, long lastUpdateTimestamp) {
public DLQTopicOffsetMetric(String clusterName, String brokerName, String group, long lastUpdateTimestamp) {
this.clusterName = clusterName;
this.brokerNames = brokerNames;
this.brokerName = brokerName;
this.group = group;
this.lastUpdateTimestamp = lastUpdateTimestamp;
}
Expand All @@ -21,12 +37,12 @@ public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}

public String getBrokerNames() {
return brokerNames;
public String getBrokerName() {
return brokerName;
}

public void setBrokerNames(String brokerNames) {
this.brokerNames = brokerNames;
public void setBrokerName(String brokerName) {
this.brokerName = brokerName;
}

public String getGroup() {
Expand All @@ -52,7 +68,7 @@ public boolean equals(Object obj) {
}
DLQTopicOffsetMetric other = (DLQTopicOffsetMetric) obj;

return other.clusterName.equals(clusterName) &&
return other.clusterName.equals(clusterName) && other.brokerName.equals(brokerName) &&
other.group.equals(group);

}
Expand All @@ -61,12 +77,13 @@ public boolean equals(Object obj) {
public int hashCode() {
int hash = 1;
hash = 37 * hash + clusterName.hashCode();
hash = 37 * hash + brokerName.hashCode();
hash = 37 * hash + group.hashCode();
return hash;
}

@Override
public String toString() {
return "ClusterName: " + clusterName + " BrokerNames: " + brokerNames + " group: " + group;
return "ClusterName: " + clusterName + " BrokerNames: " + brokerName + " group: " + group;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/
package org.apache.rocketmq.exporter.model.metrics;

//每个topic最大位点
//max offset of topic
public class ProducerMetric {
private String clusterName;
private String brokerNames;
private String brokerName;
private String topicName;
private long lastUpdateTimestamp;

Expand All @@ -31,12 +31,12 @@ public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}

public String getBrokerNames() {
return brokerNames;
public String getBrokerName() {
return brokerName;
}

public void setBrokerNames(String brokerNames) {
this.brokerNames = brokerNames;
public void setBrokerName(String brokerName) {
this.brokerName = brokerName;
}

public String getTopicName() {
Expand All @@ -55,9 +55,9 @@ public void setLastUpdateTimestamp(long lastUpdateTimestamp) {
this.lastUpdateTimestamp = lastUpdateTimestamp;
}

public ProducerMetric(String clusterName, String brokerNames, String topicName, long lastUpdateTimestamp) {
public ProducerMetric(String clusterName, String brokerName, String topicName, long lastUpdateTimestamp) {
this.clusterName = clusterName;
this.brokerNames = brokerNames;
this.brokerName = brokerName;
this.topicName = topicName;
this.lastUpdateTimestamp = lastUpdateTimestamp;
}
Expand All @@ -69,20 +69,21 @@ public boolean equals(Object obj) {
}
ProducerMetric other = (ProducerMetric) obj;

return other.clusterName.equals(clusterName) &&
return other.clusterName.equals(clusterName) && other.brokerName.equals(brokerName) &&
other.topicName.equals(topicName);
}

@Override
public int hashCode() {
int hash = 1;
hash = 37 * hash + clusterName.hashCode();
hash = 37 * hash + brokerName.hashCode();
hash = 37 * hash + topicName.hashCode();
return hash;
}

@Override
public String toString() {
return "ClusterName: " + clusterName + " BrokerNames: " + brokerNames + " topicName: " + topicName;
return "ClusterName: " + clusterName + " BrokerName: " + brokerName + " topicName: " + topicName;
}
}
Loading

0 comments on commit 910caff

Please sign in to comment.