Documentation ¶
Index ¶
- Constants
- Variables
- func GetExtMetrics(db, table, where string, ctx context.Context) (map[string]*Metrics, error)
- func GetFunctionDescriptions() (*common.Result, error)
- func GetL4FlowLogMetrics() map[string]*Metrics
- func GetL4PacketMetrics() map[string]*Metrics
- func GetL7FlowLogMetrics() map[string]*Metrics
- func GetL7PacketMetrics() map[string]*Metrics
- func GetMetricsByDBTable(db string, table string, where string, ctx context.Context) (map[string]*Metrics, error)
- func GetMetricsByDBTableStatic(db string, table string, where string) (map[string]*Metrics, error)
- func GetMetricsDescriptions(db string, table string, where string, ctx context.Context) (*common.Result, error)
- func GetMetricsDescriptionsByDBTable(db string, table string, where string, ctx context.Context) ([]interface{}, error)
- func GetResourceEventMetrics() map[string]*Metrics
- func GetVtapAclMetrics() map[string]*Metrics
- func GetVtapAppEdgePortMetrics() map[string]*Metrics
- func GetVtapAppPortMetrics() map[string]*Metrics
- func GetVtapFlowEdgePortMetrics() map[string]*Metrics
- func GetVtapFlowPortMetrics() map[string]*Metrics
- func LoadMetrics(db string, table string, dbDescription map[string]interface{}) (loadMetrics map[string]*Metrics, err error)
- func MergeMetrics(db string, table string, loadMetrics map[string]*Metrics) error
- type Function
- type Metrics
Constants ¶
View Source
const ( METRICS_TYPE_UNKNOWN int = iota // 未被定义的指标量 METRICS_TYPE_COUNTER // 计数,例如字节数、请求数 METRICS_TYPE_GAUGE // 油标,例如活跃连接数、平均包长 METRICS_TYPE_DELAY // 时延,例如各类时延 METRICS_TYPE_PERCENTAGE // 百分比,例如异常比例、重传比例 METRICS_TYPE_QUOTIENT // 商值,例如平均包长 METRICS_TYPE_TAG // tag,例如ip METRICS_TYPE_ARRAY // 数组类型,不支持算子,select时需展开 )
指标量类型
View Source
const ( FUNCTION_TYPE_UNKNOWN int = iota // 未被定义的算子 FUNCTION_TYPE_AGG // 聚合类算子 例:sum、max、min FUNCTION_TYPE_RATE // 速率类算子 例:rate FUNCTION_TYPE_MATH // 算术类算子 例:+ - * / )
View Source
const ( L4_FLOW_LOG_CATEGORY_L3_TRAFFIC = "l3-traffic-flow-log" L4_FLOW_LOG_CATEGORY_L4_LATENCY = "l4-latency-flow-log" L4_FLOW_LOG_CATEGORY_L4_PERFORMANCE = "l4-performance-flow-log" L4_FLOW_LOG_CATEGORY_L4_TRAFFIC = "l4-traffic-flow-log" L4_FLOW_LOG_CATEGORY_L4_EXCEPTION = "l4-exception-flow-log" L4_FLOW_LOG_CATEGORY_L7_PERFORMANCE = "l7-performance-flow-log" L4_FLOW_LOG_CATEGORY_LOG_COUNT = "log-count-flow-log" L4_FLOW_LOG_CATEGORY_TRAFFIC_PROPERTY_PEER = "traffic-property-peer" )
View Source
const ( FLOW_LOG_TYPE_REQUEST = 0 FLOW_LOG_TYPE_RESPONSE = 1 FLOW_LOG_TYPE_SESSION = 2 FLOW_LOG_EXCEPTION_SERVER = 3 FLOW_LOG_EXCEPTION_CLIENT = 4 )
View Source
const ( FLOW_LOG_CLOSE_TYPE_TCP_SERVER_RST = 2 // 服务端重置 FLOW_LOG_CLOSE_TYPE_TIMEOUT = 3 // 连接超时 FLOW_LOG_CLOSE_TYPE_FORCED_REPORT = 5 // 周期上报 FLOW_LOG_CLOSE_TYPE_CLIENT_SYN_REPEAT = 7 // 建连-客户端syn结束 FLOW_LOG_CLOSE_TYPE_SERVER_HALF_CLOSE = 8 // 服务端半关 FLOW_LOG_CLOSE_TYPE_TCP_CLIENT_RST = 9 // 客户端重置 FLOW_LOG_CLOSE_TYPE_SERVER_SYNACK_REPEAT = 10 // 建连-服务端syn结束 FLOW_LOG_CLOSE_TYPE_CLIENT_HALF_CLOSE = 11 // 客户端半关 FLOW_LOG_CLOSE_TYPE_CLIENT_PORT_REUSE = 13 // 建连-客户端端口复用 FLOW_LOG_CLOSE_TYPE_SERVER_RST = 15 // 服务端直接重置 FLOW_LOG_CLOSE_TYPE_SERVER_QUEUE_LACK = 17 // 服务端队列溢出 FLOW_LOG_CLOSE_TYPE_CLIENT_ESTABLISH_RST = 18 // 客户端其他重置 FLOW_LOG_CLOSE_TYPE_SERVER_ESTABLISH_RST = 19 // 服务端其他重置 )
View Source
const FLOW_LOG_IS_NEW_FLOW = 1
View Source
const METRICS_OPERATOR_GTE = ">="
View Source
const METRICS_OPERATOR_LTE = "<="
Variables ¶
View Source
var DB_FIELD_CLIENT_ERROR = fmt.Sprintf( "if(response_status IN [%d],1,0)", FLOW_LOG_EXCEPTION_CLIENT, )
View Source
var DB_FIELD_CLIENT_ESTABLISH_FAIL = fmt.Sprintf( "if(close_type in %s,1,0)", FLOW_LOG_CLOSE_TYPE_ESTABLISH_EXCEPTION_CLIENT, )
View Source
var DB_FIELD_CLIENT_ESTABLISH_OTHER_RST = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_CLIENT_ESTABLISH_RST, )
View Source
var DB_FIELD_CLIENT_HALF_CLOSE_FLOW = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_CLIENT_HALF_CLOSE, )
View Source
var DB_FIELD_CLIENT_RST_FLOW = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_TCP_CLIENT_RST, )
View Source
var DB_FIELD_CLIENT_SOURCE_PORT_REUSE = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_CLIENT_PORT_REUSE, )
View Source
var DB_FIELD_CLIENT_SYN_REPEAT = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_CLIENT_SYN_REPEAT, )
View Source
var DB_FIELD_CLOSED_FLOW = fmt.Sprintf( "if(close_type!=%d,1,0)", FLOW_LOG_CLOSE_TYPE_FORCED_REPORT, )
View Source
var DB_FIELD_ERROR = fmt.Sprintf( "if(response_status IN [%d, %d],1,0)", FLOW_LOG_EXCEPTION_CLIENT, FLOW_LOG_EXCEPTION_SERVER, )
View Source
var DB_FIELD_NEW_FLOW = fmt.Sprintf( "if(is_new_flow=%d,1,0)", FLOW_LOG_IS_NEW_FLOW, )
View Source
var DB_FIELD_REQUEST = fmt.Sprintf( "if(type IN [%d, %d],1,0)", FLOW_LOG_TYPE_REQUEST, FLOW_LOG_TYPE_SESSION, )
View Source
var DB_FIELD_RESPONSE = fmt.Sprintf( "if(type IN [%d, %d],1,0)", FLOW_LOG_TYPE_RESPONSE, FLOW_LOG_TYPE_SESSION, )
View Source
var DB_FIELD_SERVER_ERROR = fmt.Sprintf( "if(response_status IN [%d],1,0)", FLOW_LOG_EXCEPTION_SERVER, )
View Source
var DB_FIELD_SERVER_ESTABLISH_FAIL = fmt.Sprintf( "if(close_type in %s,1,0)", FLOW_LOG_CLOSE_TYPE_ESTABLISH_EXCEPTION_SERVER, )
View Source
var DB_FIELD_SERVER_ESTABLISH_OTHER_RST = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_SERVER_ESTABLISH_RST, )
View Source
var DB_FIELD_SERVER_HALF_CLOSE_FLOW = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_SERVER_HALF_CLOSE, )
View Source
var DB_FIELD_SERVER_QUEUE_LACK = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_SERVER_QUEUE_LACK, )
View Source
var DB_FIELD_SERVER_RESET = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_SERVER_RST, )
View Source
var DB_FIELD_SERVER_RST_FLOW = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_TCP_SERVER_RST, )
View Source
var DB_FIELD_SERVER_SYN_ACK_REPEAT = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_SERVER_SYNACK_REPEAT, )
View Source
var DB_FIELD_SESSION_LENGTH = "if(request_length>0,request_length,0)+if(response_length>0,response_length,0)"
View Source
var DB_FIELD_TCP_ESTABLISH_FAIL = fmt.Sprintf( "if(close_type in %s,1,0)", FLOW_LOG_CLOSE_TYPE_ESTABLISH_EXCEPTION, )
View Source
var DB_FIELD_TCP_RST_FAIL = fmt.Sprintf( "if(close_type in %s,1,0)", FLOW_LOG_CLOSE_TYPE_RST, )
View Source
var DB_FIELD_TCP_TIMEOUT = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_TIMEOUT, )
View Source
var DB_FIELD_TCP_TRANSFER_FAIL = fmt.Sprintf( "if(close_type in %s,1,0)", FLOW_LOG_CLOSE_TYPE_EXCEPTION, )
View Source
var EXT_METRICS = map[string]*Metrics{}
View Source
var FLOW_LOG_CLOSE_TYPE_ESTABLISH_EXCEPTION, _ = json.Marshal([]int{
FLOW_LOG_CLOSE_TYPE_CLIENT_PORT_REUSE, FLOW_LOG_CLOSE_TYPE_CLIENT_SYN_REPEAT,
FLOW_LOG_CLOSE_TYPE_SERVER_SYNACK_REPEAT, FLOW_LOG_CLOSE_TYPE_SERVER_RST,
FLOW_LOG_CLOSE_TYPE_CLIENT_ESTABLISH_RST, FLOW_LOG_CLOSE_TYPE_SERVER_ESTABLISH_RST,
})
建连失败次数= FLOW_LOG_CLOSE_TYPE in [建连-客户端/服务端syn结束, 建连-客户端端口复用, 服务端直接重置, 客户端/服务端其他重置]
View Source
var FLOW_LOG_CLOSE_TYPE_ESTABLISH_EXCEPTION_CLIENT, _ = json.Marshal([]int{
FLOW_LOG_CLOSE_TYPE_CLIENT_PORT_REUSE, FLOW_LOG_CLOSE_TYPE_CLIENT_SYN_REPEAT,
FLOW_LOG_CLOSE_TYPE_CLIENT_ESTABLISH_RST,
})
建连失败次数-客户端
View Source
var FLOW_LOG_CLOSE_TYPE_ESTABLISH_EXCEPTION_SERVER, _ = json.Marshal([]int{
FLOW_LOG_CLOSE_TYPE_SERVER_SYNACK_REPEAT, FLOW_LOG_CLOSE_TYPE_SERVER_RST,
FLOW_LOG_CLOSE_TYPE_SERVER_ESTABLISH_RST,
})
建连失败次数-服务端
View Source
var FLOW_LOG_CLOSE_TYPE_EXCEPTION, _ = json.Marshal([]int{
FLOW_LOG_CLOSE_TYPE_TCP_SERVER_RST, FLOW_LOG_CLOSE_TYPE_TCP_CLIENT_RST,
FLOW_LOG_CLOSE_TYPE_SERVER_QUEUE_LACK, FLOW_LOG_CLOSE_TYPE_TIMEOUT,
FLOW_LOG_CLOSE_TYPE_SERVER_HALF_CLOSE, FLOW_LOG_CLOSE_TYPE_CLIENT_HALF_CLOSE,
})
传输失败次数 = FLOW_LOG_CLOSE_TYPE in [客户端/服务端重置, 服务端队列溢出, 客户端/服务端半关, 连接超时]
View Source
var FLOW_LOG_CLOSE_TYPE_RST, _ = json.Marshal([]int{
FLOW_LOG_CLOSE_TYPE_CLIENT_ESTABLISH_RST, FLOW_LOG_CLOSE_TYPE_SERVER_ESTABLISH_RST,
FLOW_LOG_CLOSE_TYPE_SERVER_RST, FLOW_LOG_CLOSE_TYPE_TCP_SERVER_RST, FLOW_LOG_CLOSE_TYPE_TCP_CLIENT_RST,
})
重置次数 = FLOW_LOG_CLOSE_TYPE in [客户端/服务端其他重置, 服务端直接重置, 客户端/服务端重置]
View Source
var L4_FLOW_LOG_METRICS = map[string]*Metrics{}
View Source
var L4_FLOW_LOG_METRICS_REPLACE = map[string]*Metrics{ "log_count": NewReplaceMetrics("1", ""), "byte": NewReplaceMetrics("byte_tx+byte_rx", ""), "packet": NewReplaceMetrics("packet_tx+packet_rx", ""), "l3_byte": NewReplaceMetrics("l3_byte_tx+l3_byte_rx", ""), "l4_byte": NewReplaceMetrics("l4_byte_tx+l4_byte_rx", ""), "bpp": NewReplaceMetrics("(byte_tx+byte_rx)/(packet_tx+packet_rx)", "(packet_tx+packet_rx)>0"), "bpp_tx": NewReplaceMetrics("byte_tx/packet_tx", "packet_tx>0"), "bpp_rx": NewReplaceMetrics("byte_rx/packet_rx", "packet_rx>0"), "retrans": NewReplaceMetrics("retrans_tx+retrans_rx", ""), "zero_win": NewReplaceMetrics("zero_win_tx+zero_win_rx", ""), "retrans_ratio": NewReplaceMetrics("(retrans_tx+retrans_rx)/(packet_tx+packet_rx)", "(packet_tx+packet_rx)>0"), "retrans_syn_ratio": NewReplaceMetrics("retrans_syn/syn_count", ""), "retrans_synack_ratio": NewReplaceMetrics("retrans_synack/synack_count", ""), "retrans_tx_ratio": NewReplaceMetrics("retrans_tx/packet_tx", "packet_tx>0"), "retrans_rx_ratio": NewReplaceMetrics("retrans_rx/packet_rx", "packet_rx>0"), "zero_win_ratio": NewReplaceMetrics("(zero_win_tx+zero_win_rx)/(packet_tx+packet_rx)", "(packet_tx+packet_rx)>0"), "zero_win_tx_ratio": NewReplaceMetrics("zero_win_tx/packet_tx", "packet_tx>0"), "zero_win_rx_ratio": NewReplaceMetrics("zero_win_rx/packet_rx", "packet_rx>0"), "new_flow": NewReplaceMetrics(DB_FIELD_NEW_FLOW, ""), "closed_flow": NewReplaceMetrics(DB_FIELD_CLOSED_FLOW, ""), "tcp_establish_fail": NewReplaceMetrics(DB_FIELD_TCP_ESTABLISH_FAIL, ""), "client_establish_fail": NewReplaceMetrics(DB_FIELD_CLIENT_ESTABLISH_FAIL, ""), "server_establish_fail": NewReplaceMetrics(DB_FIELD_SERVER_ESTABLISH_FAIL, ""), "tcp_establish_fail_ratio": NewReplaceMetrics(DB_FIELD_TCP_ESTABLISH_FAIL+"/"+DB_FIELD_CLOSED_FLOW, fmt.Sprintf("%s>0", DB_FIELD_CLOSED_FLOW)), "client_establish_fail_ratio": NewReplaceMetrics(DB_FIELD_CLIENT_ESTABLISH_FAIL+"/"+DB_FIELD_CLOSED_FLOW, fmt.Sprintf("%s>0", DB_FIELD_CLOSED_FLOW)), "server_establish_fail_ratio": NewReplaceMetrics(DB_FIELD_SERVER_ESTABLISH_FAIL+"/"+DB_FIELD_CLOSED_FLOW, fmt.Sprintf("%s>0", DB_FIELD_CLOSED_FLOW)), "tcp_transfer_fail": NewReplaceMetrics(DB_FIELD_TCP_TRANSFER_FAIL, ""), "tcp_transfer_fail_ratio": NewReplaceMetrics(DB_FIELD_TCP_TRANSFER_FAIL+"/"+DB_FIELD_CLOSED_FLOW, fmt.Sprintf("%s>0", DB_FIELD_CLOSED_FLOW)), "tcp_rst_fail": NewReplaceMetrics(DB_FIELD_TCP_RST_FAIL, ""), "tcp_rst_fail_ratio": NewReplaceMetrics(DB_FIELD_TCP_RST_FAIL+"/"+DB_FIELD_CLOSED_FLOW, fmt.Sprintf("%s>0", DB_FIELD_CLOSED_FLOW)), "client_source_port_reuse": NewReplaceMetrics(DB_FIELD_CLIENT_SOURCE_PORT_REUSE, ""), "client_syn_repeat": NewReplaceMetrics(DB_FIELD_CLIENT_SYN_REPEAT, ""), "client_establish_other_rst": NewReplaceMetrics(DB_FIELD_CLIENT_ESTABLISH_OTHER_RST, ""), "server_reset": NewReplaceMetrics(DB_FIELD_SERVER_RESET, ""), "server_syn_ack_repeat": NewReplaceMetrics(DB_FIELD_SERVER_SYN_ACK_REPEAT, ""), "server_establish_other_rst": NewReplaceMetrics(DB_FIELD_SERVER_ESTABLISH_OTHER_RST, ""), "client_rst_flow": NewReplaceMetrics(DB_FIELD_CLIENT_RST_FLOW, ""), "server_queue_lack": NewReplaceMetrics(DB_FIELD_SERVER_QUEUE_LACK, ""), "server_rst_flow": NewReplaceMetrics(DB_FIELD_SERVER_RST_FLOW, ""), "client_half_close_flow": NewReplaceMetrics(DB_FIELD_CLIENT_HALF_CLOSE_FLOW, ""), "server_half_close_flow": NewReplaceMetrics(DB_FIELD_SERVER_HALF_CLOSE_FLOW, ""), "tcp_timeout": NewReplaceMetrics(DB_FIELD_TCP_TIMEOUT, ""), "rtt_client": NewReplaceMetrics("rtt_client_sum/rtt_client_count", "").SetIsAgg(false), "rtt_server": NewReplaceMetrics("rtt_server_sum/rtt_server_count", "").SetIsAgg(false), "srt": NewReplaceMetrics("srt_sum/srt_count", "").SetIsAgg(false), "art": NewReplaceMetrics("art_sum/art_count", "").SetIsAgg(false), "cit": NewReplaceMetrics("cit_sum/cit_count", "").SetIsAgg(false), "rrt": NewReplaceMetrics("rrt_sum/rrt_count", "").SetIsAgg(false), "l7_error": NewReplaceMetrics("l7_client_error+l7_server_error", ""), "l7_error_ratio": NewReplaceMetrics("l7_error/l7_response", ""), "l7_client_error_ratio": NewReplaceMetrics("l7_client_error/l7_response", ""), "l7_server_error_ratio": NewReplaceMetrics("l7_server_error/l7_response", ""), "vpc_0": NewReplaceMetrics("l3_epc_id_0", "NOT (l3_epc_id_0 = -2)"), "subnet_0": NewReplaceMetrics("subnet_id_0", "NOT (subnet_id_0 = 0)"), "ip_0": NewReplaceMetrics("[toString(ip4_0), toString(subnet_id_0), toString(is_ipv4), toString(ip6_0)]", "NOT (((is_ipv4 = 1) OR (ip6_0 = toIPv6('::'))) AND ((is_ipv4 = 0) OR (ip4_0 = toIPv4('0.0.0.0'))))"), "pod_cluster_0": NewReplaceMetrics("pod_cluster_id_0", "NOT (pod_cluster_id_0 = 0)"), "pod_node_0": NewReplaceMetrics("pod_node_id_0", "NOT (pod_node_id_0 = 0)"), "pod_ns_0": NewReplaceMetrics("pod_ns_id_0", "NOT (pod_ns_id_0 = 0)"), "pod_group_0": NewReplaceMetrics("pod_group_id_0", "NOT (pod_group_id_0 = 0)"), "pod_0": NewReplaceMetrics("pod_id_0", "NOT (pod_id_0 = 0)"), "host_0": NewReplaceMetrics("host_id_0", "NOT (host_id_0 = 0)"), "chost_0": NewReplaceMetrics("[l3_device_id_0, l3_device_type_0]", "(NOT (l3_device_id_0 = 0)) AND (l3_device_type_0 = 1)"), "region_0": NewReplaceMetrics("region_id_0", "NOT (region_id_0 = 0)"), "az_0": NewReplaceMetrics("az_id_0", "NOT (az_id_0 = 0)"), "vpc_1": NewReplaceMetrics("l3_epc_id_1", "NOT (l3_epc_id_1 = -2)"), "subnet_1": NewReplaceMetrics("subnet_id_1", "NOT (subnet_id_1 = 0)"), "ip_1": NewReplaceMetrics("[toString(ip4_1), toString(subnet_id_1), toString(is_ipv4), toString(ip6_1)]", "NOT (((is_ipv4 = 1) OR (ip6_1 = toIPv6('::'))) AND ((is_ipv4 = 0) OR (ip4_1 = toIPv4('0.0.0.0'))))"), "pod_cluster_1": NewReplaceMetrics("pod_cluster_id_1", "NOT (pod_cluster_id_1 = 0)"), "pod_node_1": NewReplaceMetrics("pod_node_id_1", "NOT (pod_node_id_1 = 0)"), "pod_ns_1": NewReplaceMetrics("pod_ns_id_1", "NOT (pod_ns_id_1 = 0)"), "pod_group_1": NewReplaceMetrics("pod_group_id_1", "NOT (pod_group_id_1 = 0)"), "pod_1": NewReplaceMetrics("pod_id_1", "NOT (pod_id_1 = 0)"), "host_1": NewReplaceMetrics("host_id_1", "NOT (host_id_1 = 0)"), "chost_1": NewReplaceMetrics("[toString(l3_device_id_1), toString(l3_device_type_1)]", "(NOT (l3_device_id_1 = 0)) AND (l3_device_type_1 = 1)"), "region_1": NewReplaceMetrics("region_id_1", "NOT (region_id_1 = 0)"), "az_1": NewReplaceMetrics("az_id_1", "NOT (az_id_1 = 0)"), }
View Source
var L4_PACKET_METRICS = map[string]*Metrics{}
View Source
var L4_PACKET_METRICS_REPLACE = map[string]*Metrics{}
View Source
var L7_FLOW_LOG_METRICS = map[string]*Metrics{}
View Source
var L7_FLOW_LOG_METRICS_REPLACE = map[string]*Metrics{ "log_count": NewReplaceMetrics("1", ""), "request": NewReplaceMetrics(DB_FIELD_REQUEST, ""), "response": NewReplaceMetrics(DB_FIELD_RESPONSE, ""), "error": NewReplaceMetrics(DB_FIELD_ERROR, ""), "client_error": NewReplaceMetrics(DB_FIELD_CLIENT_ERROR, ""), "server_error": NewReplaceMetrics(DB_FIELD_SERVER_ERROR, ""), "error_ratio": NewReplaceMetrics(DB_FIELD_ERROR+"/"+DB_FIELD_RESPONSE, fmt.Sprintf("%s>0", DB_FIELD_RESPONSE)), "client_error_ratio": NewReplaceMetrics(DB_FIELD_CLIENT_ERROR+"/"+DB_FIELD_RESPONSE, fmt.Sprintf("%s>0", DB_FIELD_RESPONSE)), "server_error_ratio": NewReplaceMetrics(DB_FIELD_SERVER_ERROR+"/"+DB_FIELD_RESPONSE, fmt.Sprintf("%s>0", DB_FIELD_RESPONSE)), "session_length": NewReplaceMetrics(DB_FIELD_SESSION_LENGTH, "").SetIsAgg(false), }
View Source
var L7_PACKET_METRICS = map[string]*Metrics{}
View Source
var L7_PACKET_METRICS_REPLACE = map[string]*Metrics{}
View Source
var METRICS_ARRAY_NAME_MAP = map[string][]string{ "flow_log": []string{"metrics_names", "metrics_values"}, "ext_metrics": []string{"metrics_float_names", "metrics_float_values"}, "deepflow_system": []string{"metrics_float_names", "metrics_float_values"}, }
View Source
var METRICS_FUNCTIONS = []string{ view.FUNCTION_AVG, view.FUNCTION_SUM, view.FUNCTION_MAX, view.FUNCTION_MIN, view.FUNCTION_PCTL, view.FUNCTION_PCTL_EXACT, view.FUNCTION_SPREAD, view.FUNCTION_RSPREAD, view.FUNCTION_STDDEV, view.FUNCTION_APDEX, view.FUNCTION_UNIQ, view.FUNCTION_UNIQ_EXACT, view.FUNCTION_PERCENTAG, view.FUNCTION_PERSECOND, view.FUNCTION_HISTOGRAM, view.FUNCTION_LAST, }
View Source
var METRICS_FUNCTIONS_MAP = map[string]*Function{ view.FUNCTION_SUM: NewFunction(view.FUNCTION_SUM, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER}, "$unit", 0), view.FUNCTION_AVG: NewFunction(view.FUNCTION_AVG, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 0), view.FUNCTION_MAX: NewFunction(view.FUNCTION_MAX, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 0), view.FUNCTION_MIN: NewFunction(view.FUNCTION_MIN, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 0), view.FUNCTION_STDDEV: NewFunction(view.FUNCTION_STDDEV, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 0), view.FUNCTION_SPREAD: NewFunction(view.FUNCTION_SPREAD, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 0), view.FUNCTION_RSPREAD: NewFunction(view.FUNCTION_RSPREAD, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "", 0), view.FUNCTION_APDEX: NewFunction(view.FUNCTION_APDEX, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_DELAY}, "%", 1), view.FUNCTION_PCTL: NewFunction(view.FUNCTION_PCTL, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 1), view.FUNCTION_PCTL_EXACT: NewFunction(view.FUNCTION_PCTL_EXACT, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "$unit", 1), view.FUNCTION_UNIQ: NewFunction(view.FUNCTION_UNIQ, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 0), view.FUNCTION_UNIQ_EXACT: NewFunction(view.FUNCTION_UNIQ_EXACT, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 0), view.FUNCTION_PERCENTAG: NewFunction(view.FUNCTION_PERCENTAG, FUNCTION_TYPE_MATH, nil, "%", 0), view.FUNCTION_PERSECOND: NewFunction(view.FUNCTION_PERSECOND, FUNCTION_TYPE_MATH, nil, "$unit/s", 0), view.FUNCTION_HISTOGRAM: NewFunction(view.FUNCTION_HISTOGRAM, FUNCTION_TYPE_MATH, nil, "", 1), view.FUNCTION_LAST: NewFunction(view.FUNCTION_LAST, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT}, "", 0), }
View Source
var METRICS_OPERATORS = []string{METRICS_OPERATOR_GTE, METRICS_OPERATOR_LTE}
View Source
var METRICS_TYPE_NAME_MAP = map[string]int{ "counter": METRICS_TYPE_COUNTER, "gauge": METRICS_TYPE_GAUGE, "delay": METRICS_TYPE_DELAY, "percentage": METRICS_TYPE_PERCENTAGE, "quotient": METRICS_TYPE_QUOTIENT, "tag": METRICS_TYPE_TAG, }
View Source
var METRICS_TYPE_UNLAY_FUNCTIONS = map[int][]string{ METRICS_TYPE_COUNTER: []string{view.FUNCTION_SUM}, METRICS_TYPE_GAUGE: []string{}, METRICS_TYPE_DELAY: []string{view.FUNCTION_AVG, view.FUNCTION_MAX, view.FUNCTION_MIN, view.FUNCTION_LAST}, METRICS_TYPE_PERCENTAGE: []string{}, METRICS_TYPE_QUOTIENT: []string{}, METRICS_TYPE_TAG: []string{view.FUNCTION_UNIQ, view.FUNCTION_UNIQ_EXACT}, }
指标量类型支持不用拆层的算子的集合
View Source
var RESOURCE_EVENT_METRICS = map[string]*Metrics{}
View Source
var RESOURCE_EVENT_METRICS_REPLACE = map[string]*Metrics{ "log_count": NewReplaceMetrics("1", ""), }
View Source
var VTAP_ACL_METRICS = map[string]*Metrics{}
View Source
var VTAP_ACL_METRICS_REPLACE = map[string]*Metrics{ "l3_byte": NewReplaceMetrics("l3_byte_tx+l3_byte_rx", ""), "l4_byte": NewReplaceMetrics("l4_byte_tx+l4_byte_rx", ""), }
View Source
var VTAP_APP_EDGE_PORT_METRICS = map[string]*Metrics{}
View Source
var VTAP_APP_EDGE_PORT_METRICS_REPLACE = map[string]*Metrics{ "rrt": NewReplaceMetrics("rrt_sum/rrt_count", ""), "error_ratio": NewReplaceMetrics("error/response", ""), "client_error_ratio": NewReplaceMetrics("client_error/response", ""), "server_error_ratio": NewReplaceMetrics("server_error/response", ""), }
View Source
var VTAP_APP_PORT_METRICS = map[string]*Metrics{}
View Source
var VTAP_APP_PORT_METRICS_REPLACE = map[string]*Metrics{ "rrt": NewReplaceMetrics("rrt_sum/rrt_count", ""), "error_ratio": NewReplaceMetrics("error/response", ""), "client_error_ratio": NewReplaceMetrics("client_error/response", ""), "server_error_ratio": NewReplaceMetrics("server_error/response", ""), }
View Source
var VTAP_FLOW_EDGE_PORT_METRICS = map[string]*Metrics{}
View Source
var VTAP_FLOW_EDGE_PORT_METRICS_REPLACE = map[string]*Metrics{ "l3_byte": NewReplaceMetrics("l3_byte_tx+l3_byte_rx", ""), "l4_byte": NewReplaceMetrics("l4_byte_tx+l4_byte_rx", ""), "bpp": NewReplaceMetrics("byte/packet", ""), "bpp_tx": NewReplaceMetrics("byte_tx/packet_tx", ""), "bpp_rx": NewReplaceMetrics("byte_rx/packet_rx", ""), "rtt": NewReplaceMetrics("rtt_sum/rtt_count", ""), "rtt_client": NewReplaceMetrics("rtt_client_sum/rtt_client_count", ""), "rtt_server": NewReplaceMetrics("rtt_server_sum/rtt_server_count", ""), "srt": NewReplaceMetrics("srt_sum/srt_count", ""), "art": NewReplaceMetrics("art_sum/art_count", ""), "rrt": NewReplaceMetrics("rrt_sum/rrt_count", ""), "cit": NewReplaceMetrics("cit_sum/cit_count", ""), "retrans_syn_ratio": NewReplaceMetrics("retrans_syn/syn_count", ""), "retrans_synack_ratio": NewReplaceMetrics("retrans_synack/synack_count", ""), "retrans_ratio": NewReplaceMetrics("retrans/packet", ""), "retrans_tx_ratio": NewReplaceMetrics("retrans_tx/packet_tx", ""), "retrans_rx_ratio": NewReplaceMetrics("retrans_rx/packet_rx", ""), "zero_win_ratio": NewReplaceMetrics("zero_win/packet", ""), "zero_win_tx_ratio": NewReplaceMetrics("zero_win_tx/packet_tx", ""), "zero_win_rx_ratio": NewReplaceMetrics("zero_win_rx/packet_rx", ""), "tcp_establish_fail_ratio": NewReplaceMetrics("tcp_establish_fail/closed_flow", ""), "client_establish_fail_ratio": NewReplaceMetrics("client_establish_fail/closed_flow", ""), "server_establish_fail_ratio": NewReplaceMetrics("server_establish_fail/closed_flow", ""), "tcp_transfer_fail_ratio": NewReplaceMetrics("tcp_transfer_fail/closed_flow", ""), "tcp_rst_fail_ratio": NewReplaceMetrics("tcp_rst_fail/closed_flow", ""), "l7_error_ratio": NewReplaceMetrics("l7_error/l7_response", ""), "l7_client_error_ratio": NewReplaceMetrics("l7_client_error/l7_response", ""), "l7_server_error_ratio": NewReplaceMetrics("l7_server_error/l7_response", ""), "vpc_0": NewReplaceMetrics("l3_epc_id_0", "NOT (l3_epc_id_0 = -2)"), "subnet_0": NewReplaceMetrics("subnet_id_0", "NOT (subnet_id_0 = 0)"), "ip_0": NewReplaceMetrics("[toString(ip4_0), toString(subnet_id_0), toString(is_ipv4), toString(ip6_0)]", "NOT (((is_ipv4 = 1) OR (ip6_0 = toIPv6('::'))) AND ((is_ipv4 = 0) OR (ip4_0 = toIPv4('0.0.0.0'))))"), "pod_cluster_0": NewReplaceMetrics("pod_cluster_id_0", "NOT (pod_cluster_id_0 = 0)"), "pod_node_0": NewReplaceMetrics("pod_node_id_0", "NOT (pod_node_id_0 = 0)"), "pod_ns_0": NewReplaceMetrics("pod_ns_id_0", "NOT (pod_ns_id_0 = 0)"), "pod_group_0": NewReplaceMetrics("pod_group_id_0", "NOT (pod_group_id_0 = 0)"), "pod_0": NewReplaceMetrics("pod_id_0", "NOT (pod_id_0 = 0)"), "host_0": NewReplaceMetrics("host_id_0", "NOT (host_id_0 = 0)"), "chost_0": NewReplaceMetrics("[l3_device_id_0, l3_device_type_0]", "(NOT (l3_device_id_0 = 0)) AND (l3_device_type_0 = 1)"), "region_0": NewReplaceMetrics("region_id_0", "NOT (region_id_0 = 0)"), "az_0": NewReplaceMetrics("az_id_0", "NOT (az_id_0 = 0)"), "vpc_1": NewReplaceMetrics("l3_epc_id_1", "NOT (l3_epc_id_1 = -2)"), "subnet_1": NewReplaceMetrics("subnet_id_1", "NOT (subnet_id_1 = 0)"), "ip_1": NewReplaceMetrics("[toString(ip4_1), toString(subnet_id_1), toString(is_ipv4), toString(ip6_1)]", "NOT (((is_ipv4 = 1) OR (ip6_1 = toIPv6('::'))) AND ((is_ipv4 = 0) OR (ip4_1 = toIPv4('0.0.0.0'))))"), "pod_cluster_1": NewReplaceMetrics("pod_cluster_id_1", "NOT (pod_cluster_id_1 = 0)"), "pod_node_1": NewReplaceMetrics("pod_node_id_1", "NOT (pod_node_id_1 = 0)"), "pod_ns_1": NewReplaceMetrics("pod_ns_id_1", "NOT (pod_ns_id_1 = 0)"), "pod_group_1": NewReplaceMetrics("pod_group_id_1", "NOT (pod_group_id_1 = 0)"), "pod_1": NewReplaceMetrics("pod_id_1", "NOT (pod_id_1 = 0)"), "host_1": NewReplaceMetrics("host_id_1", "NOT (host_id_1 = 0)"), "chost_1": NewReplaceMetrics("[toString(l3_device_id_1), toString(l3_device_type_1)]", "(NOT (l3_device_id_1 = 0)) AND (l3_device_type_1 = 1)"), "region_1": NewReplaceMetrics("region_id_1", "NOT (region_id_1 = 0)"), "az_1": NewReplaceMetrics("az_id_1", "NOT (az_id_1 = 0)"), }
View Source
var VTAP_FLOW_PORT_METRICS = map[string]*Metrics{}
View Source
var VTAP_FLOW_PORT_METRICS_REPLACE = map[string]*Metrics{ "l3_byte": NewReplaceMetrics("l3_byte_tx+l3_byte_rx", ""), "l4_byte": NewReplaceMetrics("l4_byte_tx+l4_byte_rx", ""), "bpp": NewReplaceMetrics("byte/packet", ""), "bpp_tx": NewReplaceMetrics("byte_tx/packet_tx", ""), "bpp_rx": NewReplaceMetrics("byte_rx/packet_rx", ""), "rtt": NewReplaceMetrics("rtt_sum/rtt_count", ""), "rtt_client": NewReplaceMetrics("rtt_client_sum/rtt_client_count", ""), "rtt_server": NewReplaceMetrics("rtt_server_sum/rtt_server_count", ""), "srt": NewReplaceMetrics("srt_sum/srt_count", ""), "art": NewReplaceMetrics("art_sum/art_count", ""), "rrt": NewReplaceMetrics("rrt_sum/rrt_count", ""), "cit": NewReplaceMetrics("cit_sum/cit_count", ""), "retrans_syn_ratio": NewReplaceMetrics("retrans_syn/syn_count", ""), "retrans_synack_ratio": NewReplaceMetrics("retrans_synack/synack_count", ""), "retrans_ratio": NewReplaceMetrics("retrans/packet", ""), "retrans_tx_ratio": NewReplaceMetrics("retrans_tx/packet_tx", ""), "retrans_rx_ratio": NewReplaceMetrics("retrans_rx/packet_rx", ""), "zero_win_ratio": NewReplaceMetrics("zero_win/packet", ""), "zero_win_tx_ratio": NewReplaceMetrics("zero_win_tx/packet_tx", ""), "zero_win_rx_ratio": NewReplaceMetrics("zero_win_rx/packet_rx", ""), "tcp_establish_fail_ratio": NewReplaceMetrics("tcp_establish_fail/closed_flow", ""), "client_establish_fail_ratio": NewReplaceMetrics("client_establish_fail/closed_flow", ""), "server_establish_fail_ratio": NewReplaceMetrics("server_establish_fail/closed_flow", ""), "tcp_transfer_fail_ratio": NewReplaceMetrics("tcp_transfer_fail/closed_flow", ""), "tcp_rst_fail_ratio": NewReplaceMetrics("tcp_rst_fail/closed_flow", ""), "l7_error_ratio": NewReplaceMetrics("l7_error/l7_response", ""), "l7_client_error_ratio": NewReplaceMetrics("l7_client_error/l7_response", ""), "l7_server_error_ratio": NewReplaceMetrics("l7_server_error/l7_response", ""), "vpc": NewReplaceMetrics("l3_epc_id", "NOT (l3_epc_id = -2)"), "subnet": NewReplaceMetrics("subnet_id", "NOT (subnet_id = 0)"), "ip": NewReplaceMetrics("[toString(ip4), toString(subnet_id), toString(is_ipv4), toString(ip6)]", "NOT (((is_ipv4 = 1) OR (ip6 = toIPv6('::'))) AND ((is_ipv4 = 0) OR (ip4 = toIPv4('0.0.0.0'))))"), "pod_cluster": NewReplaceMetrics("pod_cluster_id", "NOT (pod_cluster_id = 0)"), "pod_node": NewReplaceMetrics("pod_node_id", "NOT (pod_node_id = 0)"), "pod_ns": NewReplaceMetrics("pod_ns_id", "NOT (pod_ns_id = 0)"), "pod_group": NewReplaceMetrics("pod_group_id", "NOT (pod_group_id = 0)"), "pod": NewReplaceMetrics("pod_id", "NOT (pod_id = 0)"), "host": NewReplaceMetrics("host_id", "NOT (host_id = 0)"), "chost": NewReplaceMetrics("[l3_device_id, l3_device_type]", "(NOT (l3_device_id = 0)) AND (l3_device_type = 1)"), "region": NewReplaceMetrics("region_id", "NOT (region_id = 0)"), "az": NewReplaceMetrics("az_id", "NOT (az_id = 0)"), }
Functions ¶
func GetExtMetrics ¶
func GetFunctionDescriptions ¶
func GetL4FlowLogMetrics ¶
func GetL4PacketMetrics ¶
func GetL7FlowLogMetrics ¶
func GetL7PacketMetrics ¶
func GetMetricsByDBTable ¶
func GetMetricsDescriptions ¶
func GetResourceEventMetrics ¶
func GetVtapAclMetrics ¶
func GetVtapAppPortMetrics ¶
func GetVtapFlowPortMetrics ¶
func LoadMetrics ¶
Types ¶
type Function ¶
type Metrics ¶
type Metrics struct { Index int // 索引 DBField string // 数据库字段 DisplayName string // 描述 Unit string // 单位 Type int // 指标量类型 Category string // 类别 Condition string // 聚合过滤 IsAgg bool // 是否为聚合指标量 Permissions []bool // 指标量的权限控制 Table string // 所属表 Description string // 描述 }
func GetMetrics ¶
func NewMetrics ¶
func NewReplaceMetrics ¶
Click to show internal directories.
Click to hide internal directories.