mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Feature]MM2管理-采集MM2指标(#894)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.mm2;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/12/14
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MirrorMakerTopic {
|
||||
|
||||
/**
|
||||
* mm2集群别名
|
||||
*/
|
||||
private String clusterAlias;
|
||||
|
||||
/**
|
||||
* topic名称
|
||||
*/
|
||||
private String topicName;
|
||||
|
||||
/**
|
||||
* partition在connect上的分布 Map<PartitionId,WorkerId>
|
||||
*/
|
||||
private Map<Integer,String> partitionMap;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.BaseMetrics;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/12/16
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MirrorMakerTopicPartitionMetrics extends BaseMetrics {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String mirrorMakerName;
|
||||
|
||||
private String clusterAlias;
|
||||
|
||||
private String topicName;
|
||||
|
||||
private Integer partitionId;
|
||||
|
||||
private String workerId;
|
||||
|
||||
@Override
|
||||
public String unique() {
|
||||
return "KCOR@" + connectClusterId + "@" + mirrorMakerName + "@" + clusterAlias + "@" + workerId + "@" + topicName + "@" + partitionId;
|
||||
}
|
||||
|
||||
public static MirrorMakerTopicPartitionMetrics initWithMetric(Long connectClusterId, String mirrorMakerName, String clusterAlias, String topicName, Integer partitionId, String workerId, String metricName, Float value) {
|
||||
MirrorMakerTopicPartitionMetrics metrics = new MirrorMakerTopicPartitionMetrics(connectClusterId, mirrorMakerName, clusterAlias, topicName, partitionId, workerId);
|
||||
metrics.putMetric(metricName, value);
|
||||
return metrics;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.metric.connect.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.connect.mm2.MirrorMakerTopic;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.metric.MetricParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/12/15
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MirrorMakerMetricParam extends MetricParam {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String mirrorMakerName;
|
||||
|
||||
private List<MirrorMakerTopic> mirrorMakerTopicList;
|
||||
|
||||
private String metric;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.event.metric.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.mm2.MirrorMakerMetrics;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.event.metric.BaseMetricEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022/12/20
|
||||
*/
|
||||
@Getter
|
||||
public class MirrorMakerMetricEvent extends BaseMetricEvent {
|
||||
private final List<MirrorMakerMetrics> metricsList;
|
||||
|
||||
public MirrorMakerMetricEvent(Object source, List<MirrorMakerMetrics> metricsList) {
|
||||
super(source);
|
||||
this.metricsList = metricsList;
|
||||
}
|
||||
}
|
||||
@@ -144,6 +144,32 @@ public class JmxAttribute {
|
||||
|
||||
public static final String TOTAL_RETRIES = "total-retries";
|
||||
|
||||
/*********************************************************** mm2 ***********************************************************/
|
||||
|
||||
public static final String BYTE_COUNT = "byte-count";
|
||||
|
||||
public static final String BYTE_RATE = "byte-rate";
|
||||
|
||||
public static final String RECORD_AGE_MS = "record-age-ms";
|
||||
|
||||
public static final String RECORD_AGE_MS_AVG = "record-age-ms-avg";
|
||||
|
||||
public static final String RECORD_AGE_MS_MAX = "record-age-ms-max";
|
||||
|
||||
public static final String RECORD_AGE_MS_MIN = "record-age-ms-min";
|
||||
|
||||
public static final String RECORD_COUNT = "record-count";
|
||||
|
||||
public static final String RECORD_RATE = "record-rate";
|
||||
|
||||
public static final String REPLICATION_LATENCY_MS = "replication-latency-ms";
|
||||
|
||||
public static final String REPLICATION_LATENCY_MS_AVG = "replication-latency-ms-avg";
|
||||
|
||||
public static final String REPLICATION_LATENCY_MS_MAX = "replication-latency-ms-max";
|
||||
|
||||
public static final String REPLICATION_LATENCY_MS_MIN = "replication-latency-ms-min";
|
||||
|
||||
private JmxAttribute() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public class JmxName {
|
||||
|
||||
public static final String JMX_SERVER_APP_INFO ="kafka.server:type=app-info";
|
||||
|
||||
public static final String JMX_SERVER_TOPIC_MIRROR ="kafka.server:type=FetcherLagMetrics,name=ConsumerLag,clientId=*,topic=%s,partition=*";
|
||||
|
||||
/*********************************************************** controller ***********************************************************/
|
||||
public static final String JMX_CONTROLLER_ACTIVE_COUNT = "kafka.controller:type=KafkaController,name=ActiveControllerCount";
|
||||
|
||||
@@ -82,6 +84,10 @@ public class JmxName {
|
||||
|
||||
public static final String JMX_CONNECTOR_TASK_ERROR_METRICS = "kafka.connect:type=task-error-metrics,connector=%s,task=%s";
|
||||
|
||||
/*********************************************************** mm2 ***********************************************************/
|
||||
|
||||
public static final String JMX_MIRROR_MAKER_SOURCE = "kafka.connect.mirror:type=MirrorSourceConnector,target=%s,topic=%s,partition=%s";
|
||||
|
||||
|
||||
private JmxName() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user