[monitor] 指标组采集字段类型由string改为byte
This commit is contained in:
@@ -181,7 +181,7 @@ public class MetricsCollect implements Runnable, Comparable<MetricsCollect> {
|
||||
String value = null;
|
||||
if (expression != null) {
|
||||
// 存在计算表达式 则计算值
|
||||
if ("number".equals(field.getType())) {
|
||||
if (CommonConstants.TYPE_NUMBER == field.getType()) {
|
||||
for (String variable : expression.getVariableNames()) {
|
||||
Double doubleValue = CommonUtil.parseDoubleStr(aliasFieldValueMap.get(variable));
|
||||
if (doubleValue != null) {
|
||||
|
||||
@@ -32,5 +32,5 @@ public class Configmap {
|
||||
* number,string,secret
|
||||
* 数字,非加密字符串,加密字符串
|
||||
*/
|
||||
private byte type;
|
||||
private byte type = 1;
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ public class Metrics {
|
||||
*/
|
||||
private String field;
|
||||
/**
|
||||
* 指标类型 number:数字 string:字符串
|
||||
* 指标类型 0-number:数字 1-string:字符串
|
||||
*/
|
||||
private String type;
|
||||
private byte type = 1;
|
||||
/**
|
||||
* 此字段是否为实例主键
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,22 @@ public interface CommonConstants {
|
||||
|
||||
|
||||
/**
|
||||
* null空值占位符
|
||||
* 字段参数类型: 数字
|
||||
*/
|
||||
byte TYPE_NUMBER = 0;
|
||||
|
||||
/**
|
||||
* 字段参数类型: 字符串
|
||||
*/
|
||||
byte TYPE_STRING = 1;
|
||||
|
||||
/**
|
||||
* 字段参数类型: 加密字符串
|
||||
*/
|
||||
byte TYPE_SECRET = 2;
|
||||
|
||||
/**
|
||||
* 采集指标值:null空值占位符
|
||||
*/
|
||||
String NULL_VALUE = " ";
|
||||
}
|
||||
|
||||
@@ -20,17 +20,17 @@ metrics:
|
||||
priority: 0
|
||||
# 指标组中的具体监控指标
|
||||
fields:
|
||||
# 指标信息 包括 field名称, type字段类型:number数字,string字符串,instance是否为实例主键 unit:指标单位
|
||||
# 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位
|
||||
- field: hostname
|
||||
type: instance
|
||||
type: 1
|
||||
instance: true
|
||||
- field: usage
|
||||
type: number
|
||||
type: 0
|
||||
unit: '%'
|
||||
- field: cores
|
||||
type: number
|
||||
type: 0
|
||||
- field: waitTime
|
||||
type: number
|
||||
type: 0
|
||||
unit: s
|
||||
# (非必须)监控指标别名,与上面的指标名映射。用于采集接口数据字段不直接是最终指标名称,需要此别名做映射转换
|
||||
aliasFields:
|
||||
@@ -82,16 +82,16 @@ metrics:
|
||||
priority: 1
|
||||
fields:
|
||||
- field: hostname
|
||||
type: string
|
||||
type: 1
|
||||
instance: true
|
||||
- field: total
|
||||
type: number
|
||||
type: 0
|
||||
unit: kb
|
||||
- field: usage
|
||||
type: number
|
||||
type: 0
|
||||
unit: '%'
|
||||
- field: speed
|
||||
type: number
|
||||
type: 0
|
||||
protocol: http
|
||||
http:
|
||||
host: ^_^host^_^
|
||||
|
||||
Reference in New Issue
Block a user