[collector] 采集任务调度优化,kafka发送消息编码
This commit is contained in:
@@ -66,6 +66,12 @@ public class Job {
|
|||||||
*/
|
*/
|
||||||
private List<Configmap> configmap;
|
private List<Configmap> configmap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* collector使用 - 任务被时间轮开始调度的时间戳
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
private transient long dispatchTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* collector使用 - 任务版本,此字段不存储于etcd
|
* collector使用 - 任务版本,此字段不存储于etcd
|
||||||
*/
|
*/
|
||||||
@@ -88,7 +94,7 @@ public class Job {
|
|||||||
* collector使用 - 临时存储一次性任务指标组响应数据
|
* collector使用 - 临时存储一次性任务指标组响应数据
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private transient List<CollectRep.MetricsData> metricsDataTemps;
|
private transient List<CollectRep.MetricsData> responseDataTemp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* collector使用 - 构造初始化指标组执行视图
|
* collector使用 - 构造初始化指标组执行视图
|
||||||
@@ -100,14 +106,10 @@ public class Job {
|
|||||||
if (metric.getAliasFields() == null || metric.getAliasFields().isEmpty()) {
|
if (metric.getAliasFields() == null || metric.getAliasFields().isEmpty()) {
|
||||||
metric.setAliasFields(metric.getFields().stream().map(Metrics.Field::getField).collect(Collectors.toList()));
|
metric.setAliasFields(metric.getFields().stream().map(Metrics.Field::getField).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
// 设置默认的指标组执行优先级
|
// 设置默认的指标组执行优先级,不填则默认最后优先级
|
||||||
if (metric.getPriority() == null) {
|
if (metric.getPriority() == null) {
|
||||||
if (AVAILABILITY.equals(metric.getName())) {
|
|
||||||
metric.setPriority((byte)0);
|
|
||||||
} else {
|
|
||||||
metric.setPriority(Byte.MAX_VALUE);
|
metric.setPriority(Byte.MAX_VALUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect(Collectors.groupingBy(Metrics::getPriority));
|
.collect(Collectors.groupingBy(Metrics::getPriority));
|
||||||
// 构造指标组任务执行顺序链表
|
// 构造指标组任务执行顺序链表
|
||||||
@@ -167,9 +169,9 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addCollectMetricsData(CollectRep.MetricsData metricsData) {
|
public void addCollectMetricsData(CollectRep.MetricsData metricsData) {
|
||||||
if (metricsDataTemps == null) {
|
if (responseDataTemp == null) {
|
||||||
metricsDataTemps = new LinkedList<>();
|
responseDataTemp = new LinkedList<>();
|
||||||
}
|
}
|
||||||
metricsDataTemps.add(metricsData);
|
responseDataTemp.add(metricsData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监控采集的指标集合详情 eg: cpu | memory | health
|
* 监控采集的指标集合详情 eg: cpu | memory | health
|
||||||
@@ -68,6 +69,23 @@ public class Metrics {
|
|||||||
*/
|
*/
|
||||||
private JdbcProtocol jdbc;
|
private JdbcProtocol jdbc;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Metrics metrics = (Metrics) o;
|
||||||
|
return name.equals(metrics.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name);
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class Monitor {
|
|||||||
/**
|
/**
|
||||||
* 监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起
|
* 监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起", example = "1", accessMode = READ_WRITE, position = 6)
|
@ApiModelProperty(value = "监控状态 0:未监控,1:可用,2:不可用,3:不可达,4:挂起", accessMode = READ_WRITE, position = 6)
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Max(4)
|
@Max(4)
|
||||||
private byte status;
|
private byte status;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class Param {
|
|||||||
/**
|
/**
|
||||||
* 参数类型 0:数字 1:字符串 2:加密串
|
* 参数类型 0:数字 1:字符串 2:加密串
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "参数类型 0:数字 1:字符串 2:加密串", example = "0", accessMode = READ_WRITE, position = 4)
|
@ApiModelProperty(value = "参数类型 0:数字 1:字符串 2:加密串", accessMode = READ_WRITE, position = 4)
|
||||||
@Min(0)
|
@Min(0)
|
||||||
@Max(2)
|
@Max(2)
|
||||||
private byte type;
|
private byte type;
|
||||||
|
|||||||
Reference in New Issue
Block a user