mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Optimize]增加Connector运行状态指标 (#1110)
1、增加Connector运行状态指标; 2、将Connector指标上报普罗米修斯; 3、调整代码继承关系;
This commit is contained in:
@@ -16,6 +16,11 @@ public enum MonitorSinkTagEnum {
|
||||
CONSUMER_GROUP("consumerGroup"),
|
||||
|
||||
REPLICATION("replication"),
|
||||
|
||||
CONNECT_CLUSTER_ID("connectClusterId"),
|
||||
|
||||
CONNECT_CONNECTOR("connectConnector"),
|
||||
|
||||
;
|
||||
|
||||
private final String name;
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.xiaojukeji.know.streaming.km.monitor.component;
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.*;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.metrics.connect.ConnectorMetrics;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.event.metric.*;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.event.metric.connect.ConnectorMetricEvent;
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.FutureUtil;
|
||||
import com.xiaojukeji.know.streaming.km.monitor.common.MetricSinkPoint;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
@@ -59,6 +61,10 @@ public abstract class AbstractMonitorSinkService implements ApplicationListener<
|
||||
} else if(event instanceof ZookeeperMetricEvent) {
|
||||
ZookeeperMetricEvent zookeeperMetricEvent = (ZookeeperMetricEvent)event;
|
||||
sinkMetrics(zookeeperMetric2SinkPoint(zookeeperMetricEvent.getZookeeperMetrics()));
|
||||
|
||||
} else if (event instanceof ConnectorMetricEvent) {
|
||||
ConnectorMetricEvent connectorMetricEvent = (ConnectorMetricEvent)event;
|
||||
sinkMetrics(connectConnectorMetric2SinkPoint(connectorMetricEvent.getConnectorMetricsList()));
|
||||
}
|
||||
} );
|
||||
}
|
||||
@@ -170,6 +176,21 @@ public abstract class AbstractMonitorSinkService implements ApplicationListener<
|
||||
return pointList;
|
||||
}
|
||||
|
||||
private List<MetricSinkPoint> connectConnectorMetric2SinkPoint(List<ConnectorMetrics> connectorMetricsList){
|
||||
List<MetricSinkPoint> pointList = new ArrayList<>();
|
||||
|
||||
for(ConnectorMetrics metrics : connectorMetricsList){
|
||||
Map<String, Object> tagsMap = new HashMap<>();
|
||||
tagsMap.put(CLUSTER_ID.getName(), metrics.getClusterPhyId());
|
||||
tagsMap.put(CONNECT_CLUSTER_ID.getName(), metrics.getConnectClusterId());
|
||||
tagsMap.put(CONNECT_CONNECTOR.getName(), metrics.getConnectorName());
|
||||
|
||||
pointList.addAll(genSinkPoint("ConnectConnector", metrics.getMetrics(), metrics.getTimestamp(), tagsMap));
|
||||
}
|
||||
|
||||
return pointList;
|
||||
}
|
||||
|
||||
private List<MetricSinkPoint> genSinkPoint(String metricPre,
|
||||
Map<String, Float> metrics,
|
||||
long timeStamp,
|
||||
|
||||
Reference in New Issue
Block a user