mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
[Feature]MM2管理-读写ES中的MM2指标(#894)
This commit is contained in:
@@ -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,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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user