mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
合并3.3.0分支
This commit is contained in:
@@ -87,10 +87,6 @@
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
@@ -133,5 +129,9 @@
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka_2.13</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>connect-runtime</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.MetricDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.pagination.PaginationSortDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 22/02/24
|
||||
*/
|
||||
@Data
|
||||
public class ClusterConnectorsOverviewDTO extends PaginationSortDTO {
|
||||
@NotNull(message = "latestMetricNames不允许为空")
|
||||
@ApiModelProperty("需要指标点的信息")
|
||||
private List<String> latestMetricNames;
|
||||
|
||||
@NotNull(message = "metricLines不允许为空")
|
||||
@ApiModelProperty("需要指标曲线的信息")
|
||||
private MetricDTO metricLines;
|
||||
|
||||
@ApiModelProperty("需要排序的指标名称列表,比较第一个不为空的metric")
|
||||
private List<String> sortMetricNameList;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.pagination.PaginationMulFuzzySearchDTO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 22/02/24
|
||||
*/
|
||||
@Data
|
||||
public class ClusterGroupsOverviewDTO extends PaginationMulFuzzySearchDTO {
|
||||
@ApiModelProperty("查找该Topic")
|
||||
private String topicName;
|
||||
|
||||
@ApiModelProperty("查找该Group")
|
||||
private String groupName;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.cluster;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 22/12/12
|
||||
*/
|
||||
@Data
|
||||
public class ClusterMirrorMakersOverviewDTO extends ClusterConnectorsOverviewDTO {
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.BaseDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ApiModel(description = "集群Connector")
|
||||
public class ClusterConnectorDTO extends BaseDTO {
|
||||
@NotNull(message = "connectClusterId不允许为空")
|
||||
@ApiModelProperty(value = "Connector集群ID", example = "1")
|
||||
protected Long connectClusterId;
|
||||
|
||||
@NotBlank(message = "name不允许为空串")
|
||||
@ApiModelProperty(value = "Connector名称", example = "know-streaming-connector")
|
||||
protected String connectorName;
|
||||
|
||||
public ClusterConnectorDTO(Long connectClusterId, String connectorName) {
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.BaseDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "集群Connector")
|
||||
public class ConnectClusterDTO extends BaseDTO {
|
||||
@ApiModelProperty(value = "Connect集群ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "Connect集群名称", example = "know-streaming")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "Connect集群URL", example = "http://127.0.0.1:8080")
|
||||
private String clusterUrl;
|
||||
|
||||
@ApiModelProperty(value = "Connect集群版本", example = "2.5.1")
|
||||
private String version;
|
||||
|
||||
@ApiModelProperty(value = "JMX配置", example = "")
|
||||
private String jmxProperties;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.ClusterConnectorDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "操作Connector")
|
||||
public class ConnectorActionDTO extends ClusterConnectorDTO {
|
||||
@NotBlank(message = "action不允许为空串")
|
||||
@ApiModelProperty(value = "Connector名称", example = "stop|restart|resume")
|
||||
private String action;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.ClusterConnectorDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ApiModel(description = "创建Connector")
|
||||
public class ConnectorCreateDTO extends ClusterConnectorDTO {
|
||||
@NotNull(message = "configs不允许为空")
|
||||
@ApiModelProperty(value = "配置", example = "")
|
||||
protected Properties configs;
|
||||
|
||||
public ConnectorCreateDTO(Long connectClusterId, String connectorName, Properties configs) {
|
||||
super(connectClusterId, connectorName);
|
||||
this.configs = configs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.ClusterConnectorDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "删除Connector")
|
||||
public class ConnectorDeleteDTO extends ClusterConnectorDTO {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector.ConnectorActionDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-12-12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "操作MM2")
|
||||
public class MirrorMaker2ActionDTO extends ConnectorActionDTO {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector.ConnectorDeleteDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-12-12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "删除MM2")
|
||||
public class MirrorMaker2DeleteDTO extends ConnectorDeleteDTO {
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector.ConnectorCreateDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.connect.KafkaConnectConstant;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.clients.CommonClientConfigs;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-12-12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "创建MM2")
|
||||
public class MirrorMakerCreateDTO extends ConnectorCreateDTO {
|
||||
@NotNull(message = "sourceKafkaClusterId不允许为空")
|
||||
@ApiModelProperty(value = "源Kafka集群ID", example = "")
|
||||
private Long sourceKafkaClusterId;
|
||||
|
||||
@Valid
|
||||
@ApiModelProperty(value = "heartbeat-connector的信息", example = "")
|
||||
private Properties heartbeatConnectorConfigs;
|
||||
|
||||
@Valid
|
||||
@ApiModelProperty(value = "checkpoint-connector的信息", example = "")
|
||||
private Properties checkpointConnectorConfigs;
|
||||
|
||||
public void unifyData(Long sourceKafkaClusterId, String sourceBootstrapServers, Properties sourceKafkaProps,
|
||||
Long targetKafkaClusterId, String targetBootstrapServers, Properties targetKafkaProps) {
|
||||
if (sourceKafkaProps == null) {
|
||||
sourceKafkaProps = new Properties();
|
||||
}
|
||||
|
||||
if (targetKafkaProps == null) {
|
||||
targetKafkaProps = new Properties();
|
||||
}
|
||||
|
||||
this.unifyData(this.configs, sourceKafkaClusterId, sourceBootstrapServers, sourceKafkaProps, targetKafkaClusterId, targetBootstrapServers, targetKafkaProps);
|
||||
|
||||
if (heartbeatConnectorConfigs != null) {
|
||||
this.unifyData(this.heartbeatConnectorConfigs, sourceKafkaClusterId, sourceBootstrapServers, sourceKafkaProps, targetKafkaClusterId, targetBootstrapServers, targetKafkaProps);
|
||||
}
|
||||
|
||||
if (checkpointConnectorConfigs != null) {
|
||||
this.unifyData(this.checkpointConnectorConfigs, sourceKafkaClusterId, sourceBootstrapServers, sourceKafkaProps, targetKafkaClusterId, targetBootstrapServers, targetKafkaProps);
|
||||
}
|
||||
}
|
||||
|
||||
private void unifyData(Properties dataConfig,
|
||||
Long sourceKafkaClusterId, String sourceBootstrapServers, Properties sourceKafkaProps,
|
||||
Long targetKafkaClusterId, String targetBootstrapServers, Properties targetKafkaProps) {
|
||||
dataConfig.put(KafkaConnectConstant.MIRROR_MAKER_SOURCE_CLUSTER_ALIAS_FIELD_NAME, sourceKafkaClusterId);
|
||||
dataConfig.put(KafkaConnectConstant.MIRROR_MAKER_SOURCE_CLUSTER_FIELD_NAME + "." + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, sourceBootstrapServers);
|
||||
for (Object configKey: sourceKafkaProps.keySet()) {
|
||||
dataConfig.put(KafkaConnectConstant.MIRROR_MAKER_SOURCE_CLUSTER_FIELD_NAME + "." + configKey, sourceKafkaProps.getProperty((String) configKey));
|
||||
}
|
||||
|
||||
dataConfig.put(KafkaConnectConstant.MIRROR_MAKER_TARGET_CLUSTER_ALIAS_FIELD_NAME, targetKafkaClusterId);
|
||||
dataConfig.put(KafkaConnectConstant.MIRROR_MAKER_TARGET_CLUSTER_FIELD_NAME + "." + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, targetBootstrapServers);
|
||||
for (Object configKey: targetKafkaProps.keySet()) {
|
||||
dataConfig.put(KafkaConnectConstant.MIRROR_MAKER_TARGET_CLUSTER_FIELD_NAME + "." + configKey, targetKafkaProps.getProperty((String) configKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.connect.task;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.connector.ConnectorActionDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "操作Task")
|
||||
public class TaskActionDTO extends ConnectorActionDTO {
|
||||
@NotNull(message = "taskId不允许为NULL")
|
||||
@ApiModelProperty(value = "taskId", example = "123")
|
||||
private Long taskId;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.ha.mirror;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.BaseDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/4/23
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description="Topic镜像信息")
|
||||
public class MirrorTopicCreateDTO extends BaseDTO {
|
||||
@Min(value = 0, message = "sourceClusterPhyId不允许为空,且最小值为0")
|
||||
@ApiModelProperty(value = "源集群ID", example = "3")
|
||||
private Long sourceClusterPhyId;
|
||||
|
||||
@Min(value = 0, message = "destClusterPhyId不允许为空,且最小值为0")
|
||||
@ApiModelProperty(value = "目标集群ID", example = "3")
|
||||
private Long destClusterPhyId;
|
||||
|
||||
@NotBlank(message = "topicName不允许为空串")
|
||||
@ApiModelProperty(value = "Topic名称", example = "mirrorTopic")
|
||||
private String topicName;
|
||||
|
||||
@NotNull(message = "syncData不允许为空")
|
||||
@ApiModelProperty(value = "同步数据", example = "true")
|
||||
private Boolean syncData;
|
||||
|
||||
@NotNull(message = "syncConfig不允许为空")
|
||||
@ApiModelProperty(value = "同步配置", example = "false")
|
||||
private Boolean syncConfig;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.ha.mirror;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.BaseDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/4/23
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description="Topic镜像信息")
|
||||
public class MirrorTopicDeleteDTO extends BaseDTO {
|
||||
@Min(value = 0, message = "sourceClusterPhyId不允许为空,且最小值为0")
|
||||
@ApiModelProperty(value = "源集群ID", example = "3")
|
||||
private Long sourceClusterPhyId;
|
||||
|
||||
@Min(value = 0, message = "destClusterPhyId不允许为空,且最小值为0")
|
||||
@ApiModelProperty(value = "目标集群ID", example = "3")
|
||||
private Long destClusterPhyId;
|
||||
|
||||
@NotBlank(message = "topicName不允许为空串")
|
||||
@ApiModelProperty(value = "Topic名称", example = "mirrorTopic")
|
||||
private String topicName;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.MetricDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author didi
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "Connect集群指标查询信息")
|
||||
public class MetricsConnectClustersDTO extends MetricDTO {
|
||||
@ApiModelProperty("Connect集群ID")
|
||||
private List<Long> connectClusterIdList;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.ClusterConnectorDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.MetricDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author didi
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "Connector指标查询信息")
|
||||
public class MetricsConnectorsDTO extends MetricDTO {
|
||||
@ApiModelProperty("Connector列表")
|
||||
private List<ClusterConnectorDTO> connectorNameList;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.connect.ClusterConnectorDTO;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.dto.metrices.MetricDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author didi
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "MirrorMaker指标查询信息")
|
||||
public class MetricsMirrorMakersDTO extends MetricDTO {
|
||||
@ApiModelProperty("MirrorMaker的SourceConnect列表")
|
||||
private List<ClusterConnectorDTO> connectorNameList;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.xiaojukeji.know.streaming.km.common.bean.entity;
|
||||
/**
|
||||
* @author didi
|
||||
*/
|
||||
public interface EntifyIdInterface {
|
||||
public interface EntityIdInterface {
|
||||
/**
|
||||
* 获取id
|
||||
* @return
|
||||
@@ -3,7 +3,6 @@ package com.xiaojukeji.know.streaming.km.common.bean.entity.broker;
|
||||
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.common.IpPortData;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.config.JmxConfig;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.broker.BrokerPO;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.ConvertUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -66,13 +65,13 @@ public class Broker implements Serializable {
|
||||
*/
|
||||
private Map<String, IpPortData> endpointMap;
|
||||
|
||||
public static Broker buildFrom(Long clusterPhyId, Node node, Long startTimestamp, JmxConfig jmxConfig) {
|
||||
public static Broker buildFrom(Long clusterPhyId, Node node, Long startTimestamp) {
|
||||
Broker metadata = new Broker();
|
||||
metadata.setClusterPhyId(clusterPhyId);
|
||||
metadata.setBrokerId(node.id());
|
||||
metadata.setHost(node.host());
|
||||
metadata.setPort(node.port());
|
||||
metadata.setJmxPort(jmxConfig != null ? jmxConfig.getJmxPort() : -1);
|
||||
metadata.setJmxPort(-1);
|
||||
metadata.setStartTimestamp(startTimestamp);
|
||||
metadata.setRack(node.rack());
|
||||
metadata.setStatus(1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.EntifyIdInterface;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.EntityIdInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -10,7 +10,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClusterPhy implements Comparable<ClusterPhy>, EntifyIdInterface {
|
||||
public class ClusterPhy implements Comparable<ClusterPhy>, EntityIdInterface {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
||||
@@ -18,5 +18,7 @@ public class ClusterPhysState {
|
||||
|
||||
private Integer downCount;
|
||||
|
||||
private Integer unknownCount;
|
||||
|
||||
private Integer total;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ import java.util.Properties;
|
||||
*/
|
||||
@ApiModel(description = "ZK配置")
|
||||
public class ZKConfig implements Serializable {
|
||||
@ApiModelProperty(value="ZK的jmx配置")
|
||||
private JmxConfig jmxConfig;
|
||||
|
||||
@ApiModelProperty(value="ZK是否开启secure", example = "false")
|
||||
private Boolean openSecure = false;
|
||||
|
||||
@@ -28,14 +25,6 @@ public class ZKConfig implements Serializable {
|
||||
@ApiModelProperty(value="ZK的Request超时时间")
|
||||
private Properties otherProps = new Properties();
|
||||
|
||||
public JmxConfig getJmxConfig() {
|
||||
return jmxConfig == null? new JmxConfig(): jmxConfig;
|
||||
}
|
||||
|
||||
public void setJmxConfig(JmxConfig jmxConfig) {
|
||||
this.jmxConfig = jmxConfig;
|
||||
}
|
||||
|
||||
public Boolean getOpenSecure() {
|
||||
return openSecure != null && openSecure;
|
||||
}
|
||||
@@ -53,7 +42,7 @@ public class ZKConfig implements Serializable {
|
||||
}
|
||||
|
||||
public Integer getRequestTimeoutUnitMs() {
|
||||
return requestTimeoutUnitMs == null? Constant.DEFAULT_REQUEST_TIMEOUT_UNIT_MS: requestTimeoutUnitMs;
|
||||
return requestTimeoutUnitMs == null? Constant.DEFAULT_SESSION_TIMEOUT_UNIT_MS: requestTimeoutUnitMs;
|
||||
}
|
||||
|
||||
public void setRequestTimeoutUnitMs(Integer requestTimeoutUnitMs) {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.config.metric;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.EntityIdInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConnectCluster implements Serializable, Comparable<ConnectCluster>, EntityIdInterface {
|
||||
/**
|
||||
* 集群ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 集群名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 集群使用的消费组
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 集群使用的消费组状态,也表示集群状态
|
||||
* @see com.xiaojukeji.know.streaming.km.common.enums.group.GroupStateEnum
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* worker中显示的leader url信息
|
||||
*/
|
||||
private String memberLeaderUrl;
|
||||
|
||||
/**
|
||||
* 版本信息
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* jmx配置
|
||||
* @see com.xiaojukeji.know.streaming.km.common.bean.entity.config.JmxConfig
|
||||
*/
|
||||
private String jmxProperties;
|
||||
|
||||
/**
|
||||
* Kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* 集群地址
|
||||
*/
|
||||
private String clusterUrl;
|
||||
|
||||
@Override
|
||||
public int compareTo(ConnectCluster connectCluster) {
|
||||
return this.id.compareTo(connectCluster.getId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.group.GroupStateEnum;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ConnectClusterMetadata implements Serializable {
|
||||
/**
|
||||
* Kafka集群名字
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* 集群使用的消费组
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 集群使用的消费组状态,也表示集群状态
|
||||
*/
|
||||
private GroupStateEnum state;
|
||||
|
||||
/**
|
||||
* worker中显示的leader url信息
|
||||
*/
|
||||
private String memberLeaderUrl;
|
||||
|
||||
public ConnectClusterMetadata(Long kafkaClusterPhyId, String groupName, GroupStateEnum state, String memberLeaderUrl) {
|
||||
this.kafkaClusterPhyId = kafkaClusterPhyId;
|
||||
this.groupName = groupName;
|
||||
this.state = state;
|
||||
this.memberLeaderUrl = memberLeaderUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect;
|
||||
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.CommonUtils;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ConnectWorker implements Serializable {
|
||||
|
||||
protected static final ILog LOGGER = LogFactory.getLog(ConnectWorker.class);
|
||||
|
||||
/**
|
||||
* Kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* 集群ID
|
||||
*/
|
||||
private Long connectClusterId;
|
||||
|
||||
/**
|
||||
* 成员ID
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 主机
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* Jmx端口
|
||||
*/
|
||||
private Integer jmxPort;
|
||||
|
||||
/**
|
||||
* URL
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* leader的URL
|
||||
*/
|
||||
private String leaderUrl;
|
||||
|
||||
/**
|
||||
* 1:是leader,0:不是leader
|
||||
*/
|
||||
private Integer leader;
|
||||
|
||||
/**
|
||||
* worker地址
|
||||
*/
|
||||
private String workerId;
|
||||
|
||||
public ConnectWorker(Long kafkaClusterPhyId,
|
||||
Long connectClusterId,
|
||||
String memberId,
|
||||
String host,
|
||||
Integer jmxPort,
|
||||
String url,
|
||||
String leaderUrl,
|
||||
Integer leader) {
|
||||
this.kafkaClusterPhyId = kafkaClusterPhyId;
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.memberId = memberId;
|
||||
this.host = host;
|
||||
this.jmxPort = jmxPort;
|
||||
this.url = url;
|
||||
this.leaderUrl = leaderUrl;
|
||||
this.leader = leader;
|
||||
String workerId = CommonUtils.getWorkerId(url);
|
||||
if (workerId == null) {
|
||||
workerId = memberId;
|
||||
LOGGER.error("class=ConnectWorker||connectClusterId={}||memberId={}||url={}||msg=analysis url fail"
|
||||
, connectClusterId, memberId, url);
|
||||
}
|
||||
this.workerId = workerId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class WorkerConnector implements Serializable {
|
||||
/**
|
||||
* connect集群ID
|
||||
*/
|
||||
private Long connectClusterId;
|
||||
|
||||
/**
|
||||
* kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* connector名称
|
||||
*/
|
||||
private String connectorName;
|
||||
|
||||
private String workerMemberId;
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private Integer taskId;
|
||||
|
||||
/**
|
||||
* worker信息
|
||||
*/
|
||||
private String workerId;
|
||||
|
||||
/**
|
||||
* 错误原因
|
||||
*/
|
||||
private String trace;
|
||||
|
||||
public WorkerConnector(Long kafkaClusterPhyId, Long connectClusterId, String connectorName, String workerMemberId, Integer taskId, String state, String workerId, String trace) {
|
||||
this.kafkaClusterPhyId = kafkaClusterPhyId;
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.workerMemberId = workerMemberId;
|
||||
this.taskId = taskId;
|
||||
this.state = state;
|
||||
this.workerId = workerId;
|
||||
this.trace = trace;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConfigInfo;
|
||||
|
||||
|
||||
/**
|
||||
* @see ConfigInfo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectConfigInfo {
|
||||
private ConnectConfigKeyInfo definition;
|
||||
|
||||
private ConnectConfigValueInfo value;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.config;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConfigInfo;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConfigInfos;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.xiaojukeji.know.streaming.km.common.constant.Constant.CONNECTOR_CONFIG_ACTION_RELOAD_NAME;
|
||||
import static com.xiaojukeji.know.streaming.km.common.constant.Constant.CONNECTOR_CONFIG_ERRORS_TOLERANCE_NAME;
|
||||
|
||||
/**
|
||||
* @see ConfigInfos
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectConfigInfos {
|
||||
|
||||
private static final Map<String, List<String>> recommendValuesMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
recommendValuesMap.put(CONNECTOR_CONFIG_ACTION_RELOAD_NAME, Arrays.asList("none", "restart"));
|
||||
recommendValuesMap.put(CONNECTOR_CONFIG_ERRORS_TOLERANCE_NAME, Arrays.asList("none", "all"));
|
||||
}
|
||||
private String name;
|
||||
|
||||
private int errorCount;
|
||||
|
||||
private List<String> groups;
|
||||
|
||||
private List<ConnectConfigInfo> configs;
|
||||
|
||||
public ConnectConfigInfos(ConfigInfos configInfos) {
|
||||
this.name = configInfos.name();
|
||||
this.errorCount = configInfos.errorCount();
|
||||
this.groups = configInfos.groups();
|
||||
|
||||
this.configs = new ArrayList<>();
|
||||
for (ConfigInfo configInfo: configInfos.values()) {
|
||||
ConnectConfigKeyInfo definition = new ConnectConfigKeyInfo();
|
||||
definition.setName(configInfo.configKey().name());
|
||||
definition.setType(configInfo.configKey().type());
|
||||
definition.setRequired(configInfo.configKey().required());
|
||||
definition.setDefaultValue(configInfo.configKey().defaultValue());
|
||||
definition.setImportance(configInfo.configKey().importance());
|
||||
definition.setDocumentation(configInfo.configKey().documentation());
|
||||
definition.setGroup(configInfo.configKey().group());
|
||||
definition.setOrderInGroup(configInfo.configKey().orderInGroup());
|
||||
definition.setWidth(configInfo.configKey().width());
|
||||
definition.setDisplayName(configInfo.configKey().displayName());
|
||||
definition.setDependents(configInfo.configKey().dependents());
|
||||
|
||||
ConnectConfigValueInfo value = new ConnectConfigValueInfo();
|
||||
value.setName(configInfo.configValue().name());
|
||||
value.setValue(configInfo.configValue().value());
|
||||
value.setRecommendedValues(recommendValuesMap.getOrDefault(configInfo.configValue().name(), configInfo.configValue().recommendedValues()));
|
||||
value.setErrors(configInfo.configValue().errors());
|
||||
value.setVisible(configInfo.configValue().visible());
|
||||
|
||||
ConnectConfigInfo connectConfigInfo = new ConnectConfigInfo();
|
||||
connectConfigInfo.setDefinition(definition);
|
||||
connectConfigInfo.setValue(value);
|
||||
|
||||
this.configs.add(connectConfigInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConfigKeyInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @see ConfigKeyInfo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectConfigKeyInfo {
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
private boolean required;
|
||||
|
||||
private String defaultValue;
|
||||
|
||||
private String importance;
|
||||
|
||||
private String documentation;
|
||||
|
||||
private String group;
|
||||
|
||||
private int orderInGroup;
|
||||
|
||||
private String width;
|
||||
|
||||
private String displayName;
|
||||
|
||||
private List<String> dependents;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.config;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConfigValueInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @see ConfigValueInfo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectConfigValueInfo {
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
private List<String> recommendedValues;
|
||||
|
||||
private List<String> errors;
|
||||
|
||||
private boolean visible;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.connector;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo;
|
||||
|
||||
/**
|
||||
* @see ConnectorStateInfo.AbstractState
|
||||
*/
|
||||
@Data
|
||||
public abstract class KSAbstractConnectState {
|
||||
private String state;
|
||||
|
||||
private String trace;
|
||||
|
||||
@JSONField(name="worker_id")
|
||||
@JsonProperty("worker_id")
|
||||
private String workerId;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.connector;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class KSConnector implements Serializable {
|
||||
/**
|
||||
* Kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* connect集群ID
|
||||
*/
|
||||
private Long connectClusterId;
|
||||
|
||||
/**
|
||||
* connector名称
|
||||
*/
|
||||
private String connectorName;
|
||||
|
||||
/**
|
||||
* connector类名
|
||||
*/
|
||||
private String connectorClassName;
|
||||
|
||||
/**
|
||||
* connector类型
|
||||
*/
|
||||
private String connectorType;
|
||||
|
||||
/**
|
||||
* 访问过的Topic列表
|
||||
*/
|
||||
private String topics;
|
||||
|
||||
/**
|
||||
* task数
|
||||
*/
|
||||
private Integer taskCount;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 心跳检测connector名称
|
||||
*/
|
||||
private String heartbeatConnectorName;
|
||||
|
||||
/**
|
||||
* 进度确认connector名称
|
||||
*/
|
||||
private String checkpointConnectorName;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.connector;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorType;
|
||||
import org.apache.kafka.connect.util.ConnectorTaskId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* copy from:
|
||||
* @see org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo
|
||||
*/
|
||||
@Data
|
||||
public class KSConnectorInfo implements Serializable {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String name;
|
||||
|
||||
private Map<String, String> config;
|
||||
|
||||
private List<ConnectorTaskId> tasks;
|
||||
|
||||
private ConnectorType type;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.connector;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo;
|
||||
|
||||
/**
|
||||
* @see ConnectorStateInfo.ConnectorState
|
||||
*/
|
||||
@Data
|
||||
public class KSConnectorState extends KSAbstractConnectState {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.connector;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @see ConnectorStateInfo
|
||||
*/
|
||||
@Data
|
||||
public class KSConnectorStateInfo {
|
||||
private String name;
|
||||
|
||||
private KSConnectorState connector;
|
||||
|
||||
private List<KSTaskState> tasks;
|
||||
|
||||
private ConnectorType type;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.connect.connector;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo;
|
||||
|
||||
/**
|
||||
* @see ConnectorStateInfo.TaskState
|
||||
*/
|
||||
@Data
|
||||
public class KSTaskState extends KSAbstractConnectState {
|
||||
private int id;
|
||||
}
|
||||
@@ -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.connect.plugin;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 22/10/17
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "Connect插件信息")
|
||||
@NoArgsConstructor
|
||||
public class ConnectPluginBasic implements Serializable {
|
||||
/**
|
||||
* Json序列化时对应的字段
|
||||
*/
|
||||
@JSONField(name="class")
|
||||
@JsonProperty("class")
|
||||
private String className;
|
||||
|
||||
private String type;
|
||||
|
||||
private String version;
|
||||
|
||||
private String helpDocLink;
|
||||
|
||||
public ConnectPluginBasic(String className, String type, String version, String helpDocLink) {
|
||||
this.className = className;
|
||||
this.type = type;
|
||||
this.version = version;
|
||||
this.helpDocLink = helpDocLink;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.group;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.kafka.KSGroupDescription;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.group.GroupStateEnum;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.group.GroupTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.kafka.clients.admin.ConsumerGroupDescription;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -61,14 +61,14 @@ public class Group {
|
||||
*/
|
||||
private int coordinatorId;
|
||||
|
||||
public Group(Long clusterPhyId, String groupName, ConsumerGroupDescription groupDescription) {
|
||||
public Group(Long clusterPhyId, String groupName, KSGroupDescription groupDescription) {
|
||||
this.clusterPhyId = clusterPhyId;
|
||||
this.type = groupDescription.isSimpleConsumerGroup()? GroupTypeEnum.CONSUMER: GroupTypeEnum.CONNECTOR;
|
||||
this.type = GroupTypeEnum.getTypeByProtocolType(groupDescription.protocolType());
|
||||
this.name = groupName;
|
||||
this.state = GroupStateEnum.getByRawState(groupDescription.state());
|
||||
this.memberCount = groupDescription.members() == null? 0: groupDescription.members().size();
|
||||
this.memberCount = groupDescription.members() == null ? 0 : groupDescription.members().size();
|
||||
this.topicMembers = new ArrayList<>();
|
||||
this.partitionAssignor = groupDescription.partitionAssignor();
|
||||
this.coordinatorId = groupDescription.coordinator() == null? Constant.INVALID_CODE: groupDescription.coordinator().id();
|
||||
this.coordinatorId = groupDescription.coordinator() == null ? Constant.INVALID_CODE : groupDescription.coordinator().id();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.ha;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.ha.HaResTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HaActiveStandbyRelation extends BasePO {
|
||||
private Long activeClusterPhyId;
|
||||
|
||||
private Long standbyClusterPhyId;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
private String resName;
|
||||
|
||||
/**
|
||||
* 资源类型,0:集群,1:镜像Topic,2:主备Topic
|
||||
* @see HaResTypeEnum
|
||||
*/
|
||||
private Integer resType;
|
||||
}
|
||||
@@ -14,16 +14,16 @@ import java.util.stream.Collectors;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class HealthCheckAggResult {
|
||||
private HealthCheckNameEnum checkNameEnum;
|
||||
protected HealthCheckNameEnum checkNameEnum;
|
||||
|
||||
private List<HealthCheckResultPO> poList;
|
||||
protected List<HealthCheckResultPO> poList;
|
||||
|
||||
private Boolean passed;
|
||||
protected Boolean passed;
|
||||
|
||||
public HealthCheckAggResult(HealthCheckNameEnum checkNameEnum, List<HealthCheckResultPO> poList) {
|
||||
this.checkNameEnum = checkNameEnum;
|
||||
this.poList = poList;
|
||||
if (!ValidateUtils.isEmptyList(poList) && poList.stream().filter(elem -> elem.getPassed() <= 0).count() <= 0) {
|
||||
if (ValidateUtils.isEmptyList(poList) || poList.stream().filter(elem -> elem.getPassed() <= 0).count() <= 0) {
|
||||
passed = true;
|
||||
} else {
|
||||
passed = false;
|
||||
@@ -45,24 +45,12 @@ public class HealthCheckAggResult {
|
||||
return (int) (poList.stream().filter(elem -> elem.getPassed() > 0).count());
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前检查的健康分
|
||||
* 比如:计算集群Broker健康检查中的某一项的健康分
|
||||
*/
|
||||
public Integer calRawHealthScore() {
|
||||
if (poList == null || poList.isEmpty()) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
return 100 * this.getPassedCount() / this.getTotalCount();
|
||||
}
|
||||
|
||||
public List<String> getNotPassedResNameList() {
|
||||
if (poList == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return poList.stream().filter(elem -> elem.getPassed() <= 0).map(elem -> elem.getResName()).collect(Collectors.toList());
|
||||
return poList.stream().filter(elem -> elem.getPassed() <= 0 && !ValidateUtils.isBlank(elem.getResName())).map(elem -> elem.getResName()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
|
||||
@@ -3,87 +3,20 @@ package com.xiaojukeji.know.streaming.km.common.bean.entity.health;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.config.healthcheck.BaseClusterHealthConfig;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.health.HealthCheckResultPO;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.health.HealthCheckNameEnum;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.ValidateUtils;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class HealthScoreResult {
|
||||
private HealthCheckNameEnum checkNameEnum;
|
||||
|
||||
public class HealthScoreResult extends HealthCheckAggResult {
|
||||
private BaseClusterHealthConfig baseConfig;
|
||||
|
||||
private List<HealthCheckResultPO> poList;
|
||||
|
||||
private Boolean passed;
|
||||
|
||||
public HealthScoreResult(HealthCheckNameEnum checkNameEnum,
|
||||
BaseClusterHealthConfig baseConfig,
|
||||
List<HealthCheckResultPO> poList) {
|
||||
this.checkNameEnum = checkNameEnum;
|
||||
super(checkNameEnum, poList);
|
||||
this.baseConfig = baseConfig;
|
||||
this.poList = poList;
|
||||
if (!ValidateUtils.isEmptyList(poList) && poList.stream().filter(elem -> elem.getPassed() <= 0).count() <= 0) {
|
||||
passed = true;
|
||||
} else {
|
||||
passed = false;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getTotalCount() {
|
||||
if (poList == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return poList.size();
|
||||
}
|
||||
|
||||
public Integer getPassedCount() {
|
||||
if (poList == null) {
|
||||
return 0;
|
||||
}
|
||||
return (int) (poList.stream().filter(elem -> elem.getPassed() > 0).count());
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算当前检查的健康分
|
||||
* 比如:计算集群Broker健康检查中的某一项的健康分
|
||||
*/
|
||||
public Integer calRawHealthScore() {
|
||||
if (poList == null || poList.isEmpty()) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
return 100 * this.getPassedCount() / this.getTotalCount();
|
||||
}
|
||||
|
||||
public List<String> getNotPassedResNameList() {
|
||||
if (poList == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return poList.stream().filter(elem -> elem.getPassed() <= 0 && !ValidateUtils.isBlank(elem.getResName())).map(elem -> elem.getResName()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
if (ValidateUtils.isEmptyList(poList)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return poList.get(0).getCreateTime();
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
if (ValidateUtils.isEmptyList(poList)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return poList.get(0).getUpdateTime();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
import org.apache.kafka.common.KafkaFuture;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class KSDescribeGroupsResult {
|
||||
private final Map<String, KafkaFuture<KSGroupDescription>> futures;
|
||||
|
||||
public KSDescribeGroupsResult(final Map<String, KafkaFuture<KSGroupDescription>> futures) {
|
||||
this.futures = futures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map from group id to futures which yield group descriptions.
|
||||
*/
|
||||
public Map<String, KafkaFuture<KSGroupDescription>> describedGroups() {
|
||||
return futures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a future which yields all ConsumerGroupDescription objects, if all the describes succeed.
|
||||
*/
|
||||
public KafkaFuture<Map<String, KSGroupDescription>> all() {
|
||||
return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture[0])).thenApply(
|
||||
new KafkaFuture.BaseFunction<Void, Map<String, KSGroupDescription>>() {
|
||||
@Override
|
||||
public Map<String, KSGroupDescription> apply(Void v) {
|
||||
try {
|
||||
Map<String, KSGroupDescription> descriptions = new HashMap<>(futures.size());
|
||||
for (Map.Entry<String, KafkaFuture<KSGroupDescription>> entry : futures.entrySet()) {
|
||||
descriptions.put(entry.getKey(), entry.getValue().get());
|
||||
}
|
||||
return descriptions;
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
// This should be unreachable, since the KafkaFuture#allOf already ensured
|
||||
// that all of the futures completed successfully.
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
import org.apache.kafka.common.ConsumerGroupState;
|
||||
import org.apache.kafka.common.Node;
|
||||
import org.apache.kafka.common.acl.AclOperation;
|
||||
import org.apache.kafka.common.utils.Utils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class KSGroupDescription {
|
||||
private final String groupId;
|
||||
private final String protocolType;
|
||||
private final Collection<KSMemberDescription> members;
|
||||
private final String partitionAssignor;
|
||||
private final ConsumerGroupState state;
|
||||
private final Node coordinator;
|
||||
private final Set<AclOperation> authorizedOperations;
|
||||
|
||||
public KSGroupDescription(String groupId,
|
||||
String protocolType,
|
||||
Collection<KSMemberDescription> members,
|
||||
String partitionAssignor,
|
||||
ConsumerGroupState state,
|
||||
Node coordinator) {
|
||||
this(groupId, protocolType, members, partitionAssignor, state, coordinator, Collections.emptySet());
|
||||
}
|
||||
|
||||
public KSGroupDescription(String groupId,
|
||||
String protocolType,
|
||||
Collection<KSMemberDescription> members,
|
||||
String partitionAssignor,
|
||||
ConsumerGroupState state,
|
||||
Node coordinator,
|
||||
Set<AclOperation> authorizedOperations) {
|
||||
this.groupId = groupId == null ? "" : groupId;
|
||||
this.protocolType = protocolType;
|
||||
this.members = members == null ? Collections.emptyList() :
|
||||
Collections.unmodifiableList(new ArrayList<>(members));
|
||||
this.partitionAssignor = partitionAssignor == null ? "" : partitionAssignor;
|
||||
this.state = state;
|
||||
this.coordinator = coordinator;
|
||||
this.authorizedOperations = authorizedOperations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final KSGroupDescription that = (KSGroupDescription) o;
|
||||
return protocolType == that.protocolType &&
|
||||
Objects.equals(groupId, that.groupId) &&
|
||||
Objects.equals(members, that.members) &&
|
||||
Objects.equals(partitionAssignor, that.partitionAssignor) &&
|
||||
state == that.state &&
|
||||
Objects.equals(coordinator, that.coordinator) &&
|
||||
Objects.equals(authorizedOperations, that.authorizedOperations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(groupId, protocolType, members, partitionAssignor, state, coordinator, authorizedOperations);
|
||||
}
|
||||
|
||||
/**
|
||||
* The id of the consumer group.
|
||||
*/
|
||||
public String groupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* If consumer group is simple or not.
|
||||
*/
|
||||
public String protocolType() {
|
||||
return protocolType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of the members of the consumer group.
|
||||
*/
|
||||
public Collection<KSMemberDescription> members() {
|
||||
return members;
|
||||
}
|
||||
|
||||
/**
|
||||
* The consumer group partition assignor.
|
||||
*/
|
||||
public String partitionAssignor() {
|
||||
return partitionAssignor;
|
||||
}
|
||||
|
||||
/**
|
||||
* The consumer group state, or UNKNOWN if the state is too new for us to parse.
|
||||
*/
|
||||
public ConsumerGroupState state() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* The consumer group coordinator, or null if the coordinator is not known.
|
||||
*/
|
||||
public Node coordinator() {
|
||||
return coordinator;
|
||||
}
|
||||
|
||||
/**
|
||||
* authorizedOperations for this group, or null if that information is not known.
|
||||
*/
|
||||
public Set<AclOperation> authorizedOperations() {
|
||||
return authorizedOperations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(groupId=" + groupId +
|
||||
", protocolType=" + protocolType +
|
||||
", members=" + Utils.join(members, ",") +
|
||||
", partitionAssignor=" + partitionAssignor +
|
||||
", state=" + state +
|
||||
", coordinator=" + coordinator +
|
||||
", authorizedOperations=" + authorizedOperations +
|
||||
")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
import org.apache.kafka.clients.admin.ConsumerGroupListing;
|
||||
import org.apache.kafka.common.KafkaFuture;
|
||||
import org.apache.kafka.common.internals.KafkaFutureImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class KSListGroupsResult {
|
||||
private final KafkaFutureImpl<Collection<ConsumerGroupListing>> all;
|
||||
private final KafkaFutureImpl<Collection<ConsumerGroupListing>> valid;
|
||||
private final KafkaFutureImpl<Collection<Throwable>> errors;
|
||||
|
||||
public KSListGroupsResult(KafkaFutureImpl<Collection<Object>> future) {
|
||||
this.all = new KafkaFutureImpl<>();
|
||||
this.valid = new KafkaFutureImpl<>();
|
||||
this.errors = new KafkaFutureImpl<>();
|
||||
future.thenApply(new KafkaFuture.BaseFunction<Collection<Object>, Void>() {
|
||||
@Override
|
||||
public Void apply(Collection<Object> results) {
|
||||
ArrayList<Throwable> curErrors = new ArrayList<>();
|
||||
ArrayList<ConsumerGroupListing> curValid = new ArrayList<>();
|
||||
for (Object resultObject : results) {
|
||||
if (resultObject instanceof Throwable) {
|
||||
curErrors.add((Throwable) resultObject);
|
||||
} else {
|
||||
curValid.add((ConsumerGroupListing) resultObject);
|
||||
}
|
||||
}
|
||||
if (!curErrors.isEmpty()) {
|
||||
all.completeExceptionally(curErrors.get(0));
|
||||
} else {
|
||||
all.complete(curValid);
|
||||
}
|
||||
valid.complete(curValid);
|
||||
errors.complete(curErrors);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a future that yields either an exception, or the full set of consumer group
|
||||
* listings.
|
||||
*
|
||||
* In the event of a failure, the future yields nothing but the first exception which
|
||||
* occurred.
|
||||
*/
|
||||
public KafkaFuture<Collection<ConsumerGroupListing>> all() {
|
||||
return all;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a future which yields just the valid listings.
|
||||
*
|
||||
* This future never fails with an error, no matter what happens. Errors are completely
|
||||
* ignored. If nothing can be fetched, an empty collection is yielded.
|
||||
* If there is an error, but some results can be returned, this future will yield
|
||||
* those partial results. When using this future, it is a good idea to also check
|
||||
* the errors future so that errors can be displayed and handled.
|
||||
*/
|
||||
public KafkaFuture<Collection<ConsumerGroupListing>> valid() {
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a future which yields just the errors which occurred.
|
||||
*
|
||||
* If this future yields a non-empty collection, it is very likely that elements are
|
||||
* missing from the valid() set.
|
||||
*
|
||||
* This future itself never fails with an error. In the event of an error, this future
|
||||
* will successfully yield a collection containing at least one exception.
|
||||
*/
|
||||
public KafkaFuture<Collection<Throwable>> errors() {
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
public class KSMemberBaseAssignment {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.kafka.connect.runtime.distributed.ConnectProtocol;
|
||||
|
||||
|
||||
@Getter
|
||||
public class KSMemberConnectAssignment extends KSMemberBaseAssignment {
|
||||
private final ConnectProtocol.Assignment assignment;
|
||||
|
||||
private final ConnectProtocol.WorkerState workerState;
|
||||
|
||||
public KSMemberConnectAssignment(ConnectProtocol.Assignment assignment, ConnectProtocol.WorkerState workerState) {
|
||||
this.assignment = assignment;
|
||||
this.workerState = workerState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KSMemberConnectAssignment{" +
|
||||
"assignment=" + assignment +
|
||||
", workerState=" + workerState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
import org.apache.kafka.common.TopicPartition;
|
||||
import org.apache.kafka.common.utils.Utils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class KSMemberConsumerAssignment extends KSMemberBaseAssignment {
|
||||
private final Set<TopicPartition> topicPartitions;
|
||||
|
||||
/**
|
||||
* Creates an instance with the specified parameters.
|
||||
*
|
||||
* @param topicPartitions List of topic partitions
|
||||
*/
|
||||
public KSMemberConsumerAssignment(Set<TopicPartition> topicPartitions) {
|
||||
this.topicPartitions = topicPartitions == null ? Collections.<TopicPartition>emptySet() :
|
||||
Collections.unmodifiableSet(new HashSet<>(topicPartitions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
KSMemberConsumerAssignment that = (KSMemberConsumerAssignment) o;
|
||||
|
||||
return Objects.equals(topicPartitions, that.topicPartitions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return topicPartitions != null ? topicPartitions.hashCode() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The topic partitions assigned to a group member.
|
||||
*/
|
||||
public Set<TopicPartition> topicPartitions() {
|
||||
return topicPartitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(topicPartitions=" + Utils.join(topicPartitions, ",") + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.kafka;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public class KSMemberDescription {
|
||||
private final String memberId;
|
||||
private final Optional<String> groupInstanceId;
|
||||
private final String clientId;
|
||||
private final String host;
|
||||
private final KSMemberBaseAssignment assignment;
|
||||
|
||||
public KSMemberDescription(String memberId,
|
||||
Optional<String> groupInstanceId,
|
||||
String clientId,
|
||||
String host,
|
||||
KSMemberBaseAssignment assignment) {
|
||||
this.memberId = memberId == null ? "" : memberId;
|
||||
this.groupInstanceId = groupInstanceId;
|
||||
this.clientId = clientId == null ? "" : clientId;
|
||||
this.host = host == null ? "" : host;
|
||||
this.assignment = assignment == null ?
|
||||
new KSMemberBaseAssignment() : assignment;
|
||||
}
|
||||
|
||||
public KSMemberDescription(String memberId,
|
||||
String clientId,
|
||||
String host,
|
||||
KSMemberBaseAssignment assignment) {
|
||||
this(memberId, Optional.empty(), clientId, host, assignment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
KSMemberDescription that = (KSMemberDescription) o;
|
||||
return memberId.equals(that.memberId) &&
|
||||
groupInstanceId.equals(that.groupInstanceId) &&
|
||||
clientId.equals(that.clientId) &&
|
||||
host.equals(that.host) &&
|
||||
assignment.equals(that.assignment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(memberId, groupInstanceId, clientId, host, assignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* The consumer id of the group member.
|
||||
*/
|
||||
public String consumerId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The instance id of the group member.
|
||||
*/
|
||||
public Optional<String> groupInstanceId() {
|
||||
return groupInstanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The client id of the group member.
|
||||
*/
|
||||
public String clientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The host where the group member is running.
|
||||
*/
|
||||
public String host() {
|
||||
return host;
|
||||
}
|
||||
|
||||
/**
|
||||
* The assignment of the group member.
|
||||
*/
|
||||
public KSMemberBaseAssignment assignment() {
|
||||
return assignment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(memberId=" + memberId +
|
||||
", groupInstanceId=" + groupInstanceId.orElse("null") +
|
||||
", clientId=" + clientId +
|
||||
", host=" + host +
|
||||
", assignment=" + assignment + ")";
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public abstract class BaseMetrics implements Serializable {
|
||||
return metrics.get(key);
|
||||
}
|
||||
|
||||
public BaseMetrics(Long clusterPhyId){
|
||||
protected BaseMetrics(Long clusterPhyId) {
|
||||
this.clusterPhyId = clusterPhyId;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.BaseMetrics;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/6/17
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class ConnectClusterMetrics extends BaseMetrics {
|
||||
private Long connectClusterId;
|
||||
|
||||
public ConnectClusterMetrics(Long clusterPhyId, Long connectClusterId){
|
||||
super(clusterPhyId);
|
||||
this.connectClusterId = connectClusterId;
|
||||
}
|
||||
|
||||
public static ConnectClusterMetrics initWithMetric(Long connectClusterId, String metric, Float value) {
|
||||
ConnectClusterMetrics brokerMetrics = new ConnectClusterMetrics(connectClusterId, connectClusterId);
|
||||
brokerMetrics.putMetric(metric, value);
|
||||
return brokerMetrics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unique() {
|
||||
return "KCC@" + clusterPhyId + "@" + connectClusterId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.BaseMetrics;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/2
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ConnectWorkerMetrics extends BaseMetrics {
|
||||
|
||||
private Long connectClusterId;
|
||||
|
||||
private String workerId;
|
||||
|
||||
public static ConnectWorkerMetrics initWithMetric(Long connectClusterId, String workerId, String metric, Float value) {
|
||||
ConnectWorkerMetrics connectWorkerMetrics = new ConnectWorkerMetrics();
|
||||
connectWorkerMetrics.setConnectClusterId(connectClusterId);
|
||||
connectWorkerMetrics.setWorkerId(workerId);
|
||||
connectWorkerMetrics.putMetric(metric, value);
|
||||
return connectWorkerMetrics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unique() {
|
||||
return "KCC@" + clusterPhyId + "@" + connectClusterId + "@" + workerId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.BaseMetrics;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/6/17
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ConnectorMetrics extends BaseMetrics {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String connectorName;
|
||||
|
||||
private String connectorNameAndClusterId;
|
||||
|
||||
public ConnectorMetrics(Long connectClusterId, String connectorName) {
|
||||
super(null);
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.connectorNameAndClusterId = connectorName + "#" + connectClusterId;
|
||||
}
|
||||
|
||||
public static ConnectorMetrics initWithMetric(Long connectClusterId, String connectorName, String metricName, Float value) {
|
||||
ConnectorMetrics metrics = new ConnectorMetrics(connectClusterId, connectorName);
|
||||
metrics.putMetric(metricName, value);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unique() {
|
||||
return "KCOR@" + connectClusterId + "@" + connectorName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.BaseMetrics;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/4
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ConnectorTaskMetrics extends BaseMetrics {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String connectorName;
|
||||
|
||||
private Integer taskId;
|
||||
|
||||
public ConnectorTaskMetrics(Long connectClusterId, String connectorName, Integer taskId) {
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public static ConnectorTaskMetrics initWithMetric(Long connectClusterId, String connectorName, Integer taskId, String metricName, Float value) {
|
||||
ConnectorTaskMetrics metrics = new ConnectorTaskMetrics(connectClusterId, connectorName, taskId);
|
||||
metrics.putMetric(metricName,value);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unique() {
|
||||
return "KCOR@" + connectClusterId + "@" + connectorName + "@" + taskId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.BaseMetrics;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 20/6/17
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class MirrorMakerMetrics extends BaseMetrics {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String connectorName;
|
||||
|
||||
private String connectorNameAndClusterId;
|
||||
|
||||
public MirrorMakerMetrics(Long connectClusterId, String connectorName) {
|
||||
super(null);
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.connectorNameAndClusterId = connectorName + "#" + connectClusterId;
|
||||
}
|
||||
|
||||
public MirrorMakerMetrics(Long clusterPhyId, Long connectClusterId, String connectorName) {
|
||||
super(clusterPhyId);
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.connectorNameAndClusterId = connectorName + "#" + connectClusterId;
|
||||
}
|
||||
|
||||
public static MirrorMakerMetrics initWithMetric(Long connectClusterId, String connectorName, String metricName, Float value) {
|
||||
MirrorMakerMetrics metrics = new MirrorMakerMetrics(connectClusterId, connectorName);
|
||||
metrics.putMetric(metricName, value);
|
||||
return metrics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String unique() {
|
||||
return "KCOR@" + connectClusterId + "@" + connectorName;
|
||||
}
|
||||
}
|
||||
@@ -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,50 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.offset;
|
||||
|
||||
import org.apache.kafka.clients.admin.OffsetSpec;
|
||||
|
||||
/**
|
||||
* @see OffsetSpec
|
||||
*/
|
||||
public class KSOffsetSpec {
|
||||
public static class KSEarliestSpec extends KSOffsetSpec { }
|
||||
|
||||
public static class KSLatestSpec extends KSOffsetSpec { }
|
||||
|
||||
public static class KSTimestampSpec extends KSOffsetSpec {
|
||||
private final long timestamp;
|
||||
|
||||
public KSTimestampSpec(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public long timestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to retrieve the latest offset of a partition
|
||||
*/
|
||||
public static KSOffsetSpec latest() {
|
||||
return new KSOffsetSpec.KSLatestSpec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to retrieve the earliest offset of a partition
|
||||
*/
|
||||
public static KSOffsetSpec earliest() {
|
||||
return new KSOffsetSpec.KSEarliestSpec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to retrieve the earliest offset whose timestamp is greater than
|
||||
* or equal to the given timestamp in the corresponding partition
|
||||
* @param timestamp in milliseconds
|
||||
*/
|
||||
public static KSOffsetSpec forTimestamp(long timestamp) {
|
||||
return new KSOffsetSpec.KSTimestampSpec(timestamp);
|
||||
}
|
||||
|
||||
private KSOffsetSpec() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.VersionItemParam;
|
||||
|
||||
/**
|
||||
* @author wyc
|
||||
* @date 2022/11/9
|
||||
*/
|
||||
public class ClusterParam extends VersionItemParam {
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.VersionItemParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -8,6 +7,6 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClusterPhyParam extends VersionItemParam {
|
||||
public class ClusterPhyParam extends ClusterParam {
|
||||
protected Long clusterPhyId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/9
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectClusterParam extends ClusterParam{
|
||||
protected Long connectClusterId;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster.ConnectClusterParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/8
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectorParam extends ConnectClusterParam {
|
||||
|
||||
private String connectorName;
|
||||
|
||||
private String connectorType;
|
||||
|
||||
public ConnectorParam(Long connectClusterId, String connectorName, String connectorType) {
|
||||
super(connectClusterId);
|
||||
this.connectorName = connectorName;
|
||||
this.connectorType = connectorType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.connect.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.connect.mm2.MirrorMakerTopic;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster.ConnectClusterParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MirrorMakerParam extends ConnectClusterParam {
|
||||
|
||||
private String mirrorMakerName;
|
||||
|
||||
private String connectorType;
|
||||
|
||||
List<MirrorMakerTopic> mirrorMakerTopicList;
|
||||
|
||||
public MirrorMakerParam(Long connectClusterId, String connectorType, String mirrorMakerName, List<MirrorMakerTopic> mirrorMakerTopicList) {
|
||||
super(connectClusterId);
|
||||
this.mirrorMakerName = mirrorMakerName;
|
||||
this.connectorType = connectorType;
|
||||
this.mirrorMakerTopicList = mirrorMakerTopicList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.metric.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.metric.MetricParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/1
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectClusterMetricParam extends MetricParam {
|
||||
|
||||
private Long connectClusterId;
|
||||
|
||||
private String metric;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.metric.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.metric.MetricParam;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.connect.ConnectorTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/2
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ConnectorMetricParam extends MetricParam {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String connectorName;
|
||||
|
||||
private String metricName;
|
||||
|
||||
private ConnectorTypeEnum connectorType;
|
||||
|
||||
public ConnectorMetricParam(Long connectClusterId, String connectorName, String metricName, ConnectorTypeEnum connectorType) {
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.metricName = metricName;
|
||||
this.connectorType = connectorType;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,23 +1,39 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.partition;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.topic.TopicParam;
|
||||
import lombok.Data;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.offset.KSOffsetSpec;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster.ClusterPhyParam;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.Triple;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.kafka.clients.admin.OffsetSpec;
|
||||
import org.apache.kafka.common.TopicPartition;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@NoArgsConstructor
|
||||
public class PartitionOffsetParam extends TopicParam {
|
||||
private Map<TopicPartition, OffsetSpec> topicPartitionOffsets;
|
||||
public class PartitionOffsetParam extends ClusterPhyParam {
|
||||
private List<Triple<String, KSOffsetSpec, List<TopicPartition>>> offsetSpecList;
|
||||
|
||||
private Long timestamp;
|
||||
public PartitionOffsetParam(Long clusterPhyId, String topicName, KSOffsetSpec ksOffsetSpec, List<TopicPartition> partitionList) {
|
||||
super(clusterPhyId);
|
||||
this.offsetSpecList = Collections.singletonList(new Triple<>(topicName, ksOffsetSpec, partitionList));
|
||||
}
|
||||
|
||||
public PartitionOffsetParam(Long clusterPhyId, String topicName, Map<TopicPartition, OffsetSpec> topicPartitionOffsets, Long timestamp) {
|
||||
super(clusterPhyId, topicName);
|
||||
this.topicPartitionOffsets = topicPartitionOffsets;
|
||||
this.timestamp = timestamp;
|
||||
public PartitionOffsetParam(Long clusterPhyId, String topicName, List<KSOffsetSpec> specList, List<TopicPartition> partitionList) {
|
||||
super(clusterPhyId);
|
||||
this.offsetSpecList = new ArrayList<>();
|
||||
specList.forEach(elem -> offsetSpecList.add(new Triple<>(topicName, elem, partitionList)));
|
||||
}
|
||||
|
||||
public PartitionOffsetParam(Long clusterPhyId, KSOffsetSpec offsetSpec, List<TopicPartition> partitionList) {
|
||||
super(clusterPhyId);
|
||||
Map<String, List<TopicPartition>> tpMap = new HashMap<>();
|
||||
partitionList.forEach(elem -> {
|
||||
tpMap.putIfAbsent(elem.topic(), new ArrayList<>());
|
||||
tpMap.get(elem.topic()).add(elem);
|
||||
});
|
||||
|
||||
this.offsetSpecList = tpMap.entrySet().stream().map(elem -> new Triple<>(elem.getKey(), offsetSpec, elem.getValue())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.reassign;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.CommonUtils;
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.common.TopicPartition;
|
||||
|
||||
@@ -20,10 +19,4 @@ public class ReassignResult {
|
||||
|
||||
return state.isDone();
|
||||
}
|
||||
|
||||
public boolean checkPreferredReplicaElectionUnNeed(String reassignBrokerIds, String originalBrokerIds) {
|
||||
Integer targetLeader = CommonUtils.string2IntList(reassignBrokerIds).get(0);
|
||||
Integer originalLeader = CommonUtils.string2IntList(originalBrokerIds).get(0);
|
||||
return originalLeader.equals(targetLeader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,13 @@ public class Result<T> extends BaseResult {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> Result<T> buildFrom(Result ret) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(ret.getCode());
|
||||
result.setMessage(ret.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> Result<T> buildFrom(ValidateKafkaAddressErrorEnum errorEnum, String msg) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(errorEnum.getCode());
|
||||
|
||||
@@ -54,6 +54,8 @@ public enum ResultStatus {
|
||||
* 调用错误, [8000, 9000)
|
||||
*/
|
||||
KAFKA_OPERATE_FAILED(8010, "Kafka操作失败"),
|
||||
KAFKA_CONNECTOR_OPERATE_FAILED(8011, "KafkaConnect操作失败"),
|
||||
KAFKA_CONNECTOR_READ_FAILED(8012, "KafkaConnect读失败"),
|
||||
MYSQL_OPERATE_FAILED(8020, "MySQL操作失败"),
|
||||
ZK_OPERATE_FAILED(8030, "ZK操作失败"),
|
||||
ZK_FOUR_LETTER_CMD_FORBIDDEN(8031, "ZK四字命令被禁止"),
|
||||
|
||||
@@ -14,6 +14,11 @@ import java.io.Serializable;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TopicConfig implements Serializable {
|
||||
/**
|
||||
* 表主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 物理集群ID
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.version;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.connect.ConnectorTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/24
|
||||
*/
|
||||
@Data
|
||||
public class VersionConnectJmxInfo extends VersionJmxInfo{
|
||||
private ConnectorTypeEnum type;
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.xiaojukeji.know.streaming.km.common.bean.entity.version;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.version.VersionEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.zookeeper;
|
||||
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.Tuple;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.zookeeper.data.Stat;
|
||||
|
||||
@@ -23,8 +23,8 @@ import lombok.Data;
|
||||
public class MonitorCmdData extends BaseFourLetterWordCmdData {
|
||||
private String zkVersion;
|
||||
private Float zkAvgLatency;
|
||||
private Long zkMaxLatency;
|
||||
private Long zkMinLatency;
|
||||
private Float zkMaxLatency;
|
||||
private Float zkMinLatency;
|
||||
private Long zkPacketsReceived;
|
||||
private Long zkPacketsSent;
|
||||
private Long zkNumAliveConnections;
|
||||
|
||||
@@ -18,8 +18,8 @@ import lombok.Data;
|
||||
public class ServerCmdData extends BaseFourLetterWordCmdData {
|
||||
private String zkVersion;
|
||||
private Float zkAvgLatency;
|
||||
private Long zkMaxLatency;
|
||||
private Long zkMinLatency;
|
||||
private Float zkMaxLatency;
|
||||
private Float zkMinLatency;
|
||||
private Long zkPacketsReceived;
|
||||
private Long zkPacketsSent;
|
||||
private Long zkNumAliveConnections;
|
||||
|
||||
@@ -99,13 +99,13 @@ public class ConfigCmdDataParser implements FourLetterWordDataParser<ConfigCmdDa
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn(
|
||||
"class=ConfigCmdDataParser||method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
"method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
elem.getKey(), elem.getValue()
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=ConfigCmdDataParser||method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
"method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, elem.getKey(), elem.getValue(), e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xiaojukeji.know.streaming.km.common.bean.entity.zookeeper.fourletter
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.zookeeper.fourletterword.MonitorCmdData;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.ConvertUtil;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.zookeeper.FourLetterWordUtil;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -57,13 +58,13 @@ public class MonitorCmdDataParser implements FourLetterWordDataParser<MonitorCmd
|
||||
monitorCmdData.setZkVersion(elem.getValue().split("-")[0]);
|
||||
break;
|
||||
case "zk_avg_latency":
|
||||
monitorCmdData.setZkAvgLatency(Float.valueOf(elem.getValue()));
|
||||
monitorCmdData.setZkAvgLatency(ConvertUtil.string2Float(elem.getValue()));
|
||||
break;
|
||||
case "zk_max_latency":
|
||||
monitorCmdData.setZkMaxLatency(Long.valueOf(elem.getValue()));
|
||||
monitorCmdData.setZkMaxLatency(ConvertUtil.string2Float(elem.getValue()));
|
||||
break;
|
||||
case "zk_min_latency":
|
||||
monitorCmdData.setZkMinLatency(Long.valueOf(elem.getValue()));
|
||||
monitorCmdData.setZkMinLatency(ConvertUtil.string2Float(elem.getValue()));
|
||||
break;
|
||||
case "zk_packets_received":
|
||||
monitorCmdData.setZkPacketsReceived(Long.valueOf(elem.getValue()));
|
||||
@@ -98,15 +99,19 @@ public class MonitorCmdDataParser implements FourLetterWordDataParser<MonitorCmd
|
||||
case "zk_max_file_descriptor_count":
|
||||
monitorCmdData.setZkMaxFileDescriptorCount(Long.valueOf(elem.getValue()));
|
||||
break;
|
||||
case "Proposal sizes last/min/max":
|
||||
case "zk_fsync_threshold_exceed_count":
|
||||
// 忽略该指标的解析
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn(
|
||||
"class=MonitorCmdDataParser||method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
"method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
elem.getKey(), elem.getValue()
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=MonitorCmdDataParser||method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
"method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, elem.getKey(), elem.getValue(), e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xiaojukeji.know.streaming.km.common.bean.entity.zookeeper.fourletter
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.zookeeper.fourletterword.ServerCmdData;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.ConvertUtil;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.zookeeper.FourLetterWordUtil;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -53,9 +54,9 @@ public class ServerCmdDataParser implements FourLetterWordDataParser<ServerCmdDa
|
||||
break;
|
||||
case "Latency min/avg/max":
|
||||
String[] data = elem.getValue().split("/");
|
||||
serverCmdData.setZkMinLatency(Long.valueOf(data[0]));
|
||||
serverCmdData.setZkAvgLatency(Float.valueOf(data[1]));
|
||||
serverCmdData.setZkMaxLatency(Long.valueOf(data[2]));
|
||||
serverCmdData.setZkMinLatency(ConvertUtil.string2Float(data[0]));
|
||||
serverCmdData.setZkAvgLatency(ConvertUtil.string2Float(data[1]));
|
||||
serverCmdData.setZkMaxLatency(ConvertUtil.string2Float(data[2]));
|
||||
break;
|
||||
case "Received":
|
||||
serverCmdData.setZkPacketsReceived(Long.valueOf(elem.getValue()));
|
||||
@@ -78,15 +79,18 @@ public class ServerCmdDataParser implements FourLetterWordDataParser<ServerCmdDa
|
||||
case "Zxid":
|
||||
serverCmdData.setZkZxid(Long.parseUnsignedLong(elem.getValue().trim().substring(2), 16));
|
||||
break;
|
||||
case "Proposal sizes last/min/max":
|
||||
// zk的leader特有的数据,数据例子:Proposal sizes last/min/max||value=32/32/976165
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn(
|
||||
"class=ServerCmdDataParser||method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
"method=parseAndInitData||name={}||value={}||msg=data not parsed!",
|
||||
elem.getKey(), elem.getValue()
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"class=ServerCmdDataParser||method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
"method=parseAndInitData||clusterPhyId={}||host={}||port={}||name={}||value={}||errMsg=exception!",
|
||||
clusterPhyId, host, port, elem.getKey(), elem.getValue(), e
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.event.cluster.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.connect.ConnectCluster;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.operaterecord.OperationEnum;
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/7
|
||||
*/
|
||||
@Getter
|
||||
public class ConnectClusterLoadChangedEvent extends ApplicationEvent {
|
||||
|
||||
private ConnectCluster inDBConnectCluster;
|
||||
|
||||
private ConnectCluster inCacheConnectCluster;
|
||||
|
||||
private final OperationEnum operationEnum;
|
||||
|
||||
public ConnectClusterLoadChangedEvent(Object source, ConnectCluster inDBConnectCluster, ConnectCluster inCacheConnectCluster, OperationEnum operationEnum) {
|
||||
super(source);
|
||||
this.inDBConnectCluster = inDBConnectCluster;
|
||||
this.inCacheConnectCluster = inCacheConnectCluster;
|
||||
this.operationEnum = operationEnum;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class BrokerMetricEvent extends BaseMetricEvent{
|
||||
|
||||
private List<BrokerMetrics> brokerMetrics;
|
||||
private final List<BrokerMetrics> brokerMetrics;
|
||||
|
||||
public BrokerMetricEvent(Object source, List<BrokerMetrics> brokerMetrics) {
|
||||
super( source );
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class ClusterMetricEvent extends BaseMetricEvent{
|
||||
|
||||
private List<ClusterMetrics> clusterMetrics;
|
||||
private final List<ClusterMetrics> clusterMetrics;
|
||||
|
||||
public ClusterMetricEvent(Object source, List<ClusterMetrics> clusterMetrics) {
|
||||
super( source );
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class GroupMetricEvent extends BaseMetricEvent{
|
||||
|
||||
private List<GroupMetrics> groupMetrics;
|
||||
private final List<GroupMetrics> groupMetrics;
|
||||
|
||||
public GroupMetricEvent(Object source, List<GroupMetrics> groupMetrics) {
|
||||
super( source );
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class PartitionMetricEvent extends BaseMetricEvent{
|
||||
|
||||
private List<PartitionMetrics> partitionMetrics;
|
||||
private final List<PartitionMetrics> partitionMetrics;
|
||||
|
||||
public PartitionMetricEvent(Object source, List<PartitionMetrics> partitionMetrics) {
|
||||
super( source );
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.event.metric;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.ReplicationMetrics;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author didi
|
||||
*/
|
||||
@Getter
|
||||
public class ReplicaMetricEvent extends BaseMetricEvent{
|
||||
|
||||
private List<ReplicationMetrics> replicationMetrics;
|
||||
|
||||
public ReplicaMetricEvent(Object source, List<ReplicationMetrics> replicationMetrics) {
|
||||
super( source );
|
||||
this.replicationMetrics = replicationMetrics;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class TopicMetricEvent extends BaseMetricEvent{
|
||||
|
||||
private List<TopicMetrics> topicMetrics;
|
||||
private final List<TopicMetrics> topicMetrics;
|
||||
|
||||
public TopicMetricEvent(Object source, List<TopicMetrics> topicMetrics) {
|
||||
super( source );
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
@Getter
|
||||
public class ZookeeperMetricEvent extends BaseMetricEvent {
|
||||
|
||||
private List<ZookeeperMetrics> zookeeperMetrics;
|
||||
private final List<ZookeeperMetrics> zookeeperMetrics;
|
||||
|
||||
public ZookeeperMetricEvent(Object source, List<ZookeeperMetrics> zookeeperMetrics) {
|
||||
super( source );
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.event.metric.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect.ConnectClusterMetrics;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.event.metric.BaseMetricEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/7
|
||||
*/
|
||||
@Getter
|
||||
public class ConnectClusterMetricEvent extends BaseMetricEvent {
|
||||
private List<ConnectClusterMetrics> connectClusterMetrics;
|
||||
|
||||
public ConnectClusterMetricEvent(Object source, List<ConnectClusterMetrics> connectClusterMetrics) {
|
||||
super(source);
|
||||
this.connectClusterMetrics = connectClusterMetrics;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.event.metric.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect.ConnectorMetrics;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.event.metric.BaseMetricEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wyb
|
||||
* @date 2022/11/7
|
||||
*/
|
||||
@Getter
|
||||
public class ConnectorMetricEvent extends BaseMetricEvent {
|
||||
private List<ConnectorMetrics> connectorMetricsList;
|
||||
|
||||
public ConnectorMetricEvent(Object source, List<ConnectorMetrics> connectorMetricsList) {
|
||||
super(source);
|
||||
this.connectorMetricsList = connectorMetricsList;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.connect;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName(Constant.MYSQL_KC_TABLE_NAME_PREFIX + "connect_cluster")
|
||||
public class ConnectClusterPO extends BasePO {
|
||||
/**
|
||||
* Kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* 集群名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 集群使用的消费组
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 集群使用的消费组状态,也表示集群状态
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 集群地址
|
||||
*/
|
||||
private String clusterUrl;
|
||||
|
||||
/**
|
||||
* worker中显示的leader url信息
|
||||
*/
|
||||
private String memberLeaderUrl;
|
||||
|
||||
/**
|
||||
* 版本信息
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* jmx配置
|
||||
* @see com.xiaojukeji.know.streaming.km.common.bean.entity.config.JmxConfig
|
||||
*/
|
||||
private String jmxProperties;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.connect;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName(Constant.MYSQL_KC_TABLE_NAME_PREFIX + "worker")
|
||||
public class ConnectWorkerPO extends BasePO {
|
||||
/**
|
||||
* Kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* 集群ID
|
||||
*/
|
||||
private Long connectClusterId;
|
||||
|
||||
/**
|
||||
* 成员ID
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 主机
|
||||
*/
|
||||
private String host;
|
||||
|
||||
/**
|
||||
* Jmx端口
|
||||
*/
|
||||
private Integer jmxPort;
|
||||
|
||||
/**
|
||||
* URL
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* leader的URL
|
||||
*/
|
||||
private String leaderUrl;
|
||||
|
||||
/**
|
||||
* 1:是leader,0:不是leader
|
||||
*/
|
||||
private Integer leader;
|
||||
|
||||
/**
|
||||
* worker地址
|
||||
*/
|
||||
private String workerId;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.connect;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName(Constant.MYSQL_KC_TABLE_NAME_PREFIX + "connector")
|
||||
public class ConnectorPO extends BasePO {
|
||||
/**
|
||||
* Kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* connect集群ID
|
||||
*/
|
||||
private Long connectClusterId;
|
||||
|
||||
/**
|
||||
* connector名称
|
||||
*/
|
||||
private String connectorName;
|
||||
|
||||
/**
|
||||
* connector类名
|
||||
*/
|
||||
private String connectorClassName;
|
||||
|
||||
/**
|
||||
* connector类型
|
||||
*/
|
||||
private String connectorType;
|
||||
|
||||
/**
|
||||
* 访问过的Topic列表
|
||||
*/
|
||||
private String topics;
|
||||
|
||||
/**
|
||||
* task数
|
||||
*/
|
||||
private Integer taskCount;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 心跳检测connector
|
||||
*/
|
||||
private String heartbeatConnectorName;
|
||||
|
||||
/**
|
||||
* 进度确认connector
|
||||
*/
|
||||
private String checkpointConnectorName;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.connect;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName(Constant.MYSQL_KC_TABLE_NAME_PREFIX + "worker_connector")
|
||||
public class WorkerConnectorPO extends BasePO {
|
||||
/**
|
||||
* connect集群ID
|
||||
*/
|
||||
private Long connectClusterId;
|
||||
|
||||
/**
|
||||
* kafka集群ID
|
||||
*/
|
||||
private Long kafkaClusterPhyId;
|
||||
|
||||
/**
|
||||
* connector名称
|
||||
*/
|
||||
private String connectorName;
|
||||
|
||||
/**
|
||||
* worker成员ID
|
||||
*/
|
||||
private String workerMemberId;
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private Integer taskId;
|
||||
|
||||
/**
|
||||
* task状态
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* worker信息
|
||||
*/
|
||||
private String workerId;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.ha;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName(Constant.MYSQL_HA_TABLE_NAME_PREFIX + "active_standby_relation")
|
||||
public class HaActiveStandbyRelationPO extends BasePO {
|
||||
private Long activeClusterPhyId;
|
||||
|
||||
private Long standbyClusterPhyId;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
private String resName;
|
||||
|
||||
/**
|
||||
* 资源类型,0:集群,1:镜像Topic,2:主备Topic
|
||||
*/
|
||||
private Integer resType;
|
||||
|
||||
public HaActiveStandbyRelationPO(Long activeClusterPhyId, Long standbyClusterPhyId, String resName, Integer resType) {
|
||||
this.activeClusterPhyId = activeClusterPhyId;
|
||||
this.standbyClusterPhyId = standbyClusterPhyId;
|
||||
this.resName = resName;
|
||||
this.resType = resType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.metrice.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.metrice.BaseMetricESPO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import static com.xiaojukeji.know.streaming.km.common.utils.CommonUtils.monitorTimestamp2min;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectClusterMetricPO extends BaseMetricESPO {
|
||||
private Long connectClusterId;
|
||||
|
||||
public ConnectClusterMetricPO(Long kafkaClusterPhyId, Long connectClusterId){
|
||||
super(kafkaClusterPhyId);
|
||||
this.connectClusterId = connectClusterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return "KCC@" + clusterPhyId + "@" + connectClusterId + "@" + monitorTimestamp2min(timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoutingValue() {
|
||||
return String.valueOf(connectClusterId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.metrice.connect;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.metrice.BaseMetricESPO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import static com.xiaojukeji.know.streaming.km.common.utils.CommonUtils.monitorTimestamp2min;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ConnectorMetricPO extends BaseMetricESPO {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String connectorName;
|
||||
|
||||
/**
|
||||
* 用于es内部排序
|
||||
*/
|
||||
private String connectorNameAndClusterId;
|
||||
|
||||
public ConnectorMetricPO(Long kafkaClusterPhyId, Long connectClusterId, String connectorName){
|
||||
super(kafkaClusterPhyId);
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.connectorNameAndClusterId = connectorName + "#" + connectClusterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return "KCOR@" + clusterPhyId + "@" + connectClusterId + "@" + connectorName + "@" + monitorTimestamp2min(timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoutingValue() {
|
||||
return String.valueOf(connectClusterId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.po.metrice.mm2;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.metrice.BaseMetricESPO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import static com.xiaojukeji.know.streaming.km.common.utils.CommonUtils.monitorTimestamp2min;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MirrorMakerMetricPO extends BaseMetricESPO {
|
||||
private Long connectClusterId;
|
||||
|
||||
private String connectorName;
|
||||
|
||||
/**
|
||||
* 用于es内部排序
|
||||
*/
|
||||
private String connectorNameAndClusterId;
|
||||
|
||||
public MirrorMakerMetricPO(Long kafkaClusterPhyId, Long connectClusterId, String connectorName){
|
||||
super(kafkaClusterPhyId);
|
||||
this.connectClusterId = connectClusterId;
|
||||
this.connectorName = connectorName;
|
||||
this.connectorNameAndClusterId = connectorName + "#" + connectClusterId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return "KCOR@" + clusterPhyId + "@" + connectClusterId + "@" + connectorName + "@" + monitorTimestamp2min(timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoutingValue() {
|
||||
return String.valueOf(connectClusterId);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import com.xiaojukeji.know.streaming.km.common.bean.po.BasePO;
|
||||
import com.xiaojukeji.know.streaming.km.common.constant.Constant;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
@TableName(Constant.MYSQL_TABLE_NAME_PREFIX + "partition")
|
||||
public class PartitionPO extends BasePO {
|
||||
@@ -37,4 +39,31 @@ public class PartitionPO extends BasePO {
|
||||
* AR
|
||||
*/
|
||||
private String assignReplicas;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PartitionPO po = (PartitionPO) o;
|
||||
return Objects.equals(clusterPhyId, po.clusterPhyId)
|
||||
&& Objects.equals(topicName, po.topicName)
|
||||
&& Objects.equals(partitionId, po.partitionId)
|
||||
&& Objects.equals(leaderBrokerId, po.leaderBrokerId)
|
||||
&& Objects.equals(inSyncReplicas, po.inSyncReplicas)
|
||||
&& Objects.equals(assignReplicas, po.assignReplicas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), clusterPhyId, topicName, partitionId, leaderBrokerId, inSyncReplicas, assignReplicas);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user