Documentation ¶
Index ¶
- Constants
- Variables
- func FormatMetricsToResult(db, table, where, queryCacheTTL, orgID string, useQueryCache bool, ...) (map[string]*Metrics, []interface{}, error)
- func GetAlarmEventMetrics() map[string]*Metrics
- func GetExtMetrics(db, table, where, queryCacheTTL, orgID string, useQueryCache bool, ...) (map[string]*Metrics, error)
- func GetFunctionDescriptions() (*common.Result, error)
- func GetInProcessMetrics() map[string]*Metrics
- func GetL4FlowLogMetrics() map[string]*Metrics
- func GetL4PacketMetrics() map[string]*Metrics
- func GetL7FlowLogMetrics() map[string]*Metrics
- func GetL7PacketMetrics() map[string]*Metrics
- func GetLogMetrics() map[string]*Metrics
- func GetMetricsByDBTableDynamic(db, table, where, queryCacheTTL, orgID string, useQueryCache bool, ...) (map[string]*Metrics, error)
- func GetMetricsByDBTableStatic(db string, table string) map[string]*Metrics
- func GetMetricsDescriptions(db, table, where, queryCacheTTL, orgID string, useQueryCache bool, ...) (*common.Result, error)
- func GetMetricsDescriptionsByDBTable(db, table string, allMetrics map[string]*Metrics) []interface{}
- func GetPrometheusAllTagTranslator(table, orgID string) (string, error)
- func GetPrometheusSingleTagTranslator(tag, table, orgID string) (string, string, error)
- func GetResourceEventMetrics() map[string]*Metrics
- func GetResourcePerfEventMetrics() map[string]*Metrics
- func GetSamplesMetrics() map[string]*Metrics
- func GetTagDBField(name, db, table, orgID string) (string, error)
- func GetTagTypeMetrics(tagDescriptions *common.Result, newAllMetrics map[string]*Metrics, ...) error
- 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
- func GetAggMetrics(field, db, table, orgID string) (*Metrics, bool)
- func GetMetrics(field, db, table, orgID string) (*Metrics, bool)
- func NewMetrics(index int, dbField string, displayname string, unit string, metricType int, ...) *Metrics
- func NewReplaceMetrics(dbField string, condition string) *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时需展开 METRICS_TYPE_OTHER // 只支持 count(_) METRICS_TYPE_BOUNDED_GAUGE // direction_score )
指标量类型
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_SERVER_SYN_MISS = 7 // 建连-服务端 SYN 缺失 FLOW_LOG_CLOSE_TYPE_SERVER_HALF_CLOSE = 8 // 服务端半关 FLOW_LOG_CLOSE_TYPE_TCP_CLIENT_RST = 9 // 客户端重置 FLOW_LOG_CLOSE_TYPE_CLIENT_ACK_MISS = 10 // 建连-客户端 ACK 缺失 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 COUNT_METRICS_NAME = "row"
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 ALARM_EVENT_METRICS = map[string]*Metrics{}
View Source
var ALARM_EVENT_METRICS_REPLACE = map[string]*Metrics{ "log_count": NewReplaceMetrics("1", ""), }
View Source
var DB_DESCRIPTIONS map[string]interface{}
View Source
var DB_FIELD_CLIENT_ACK_MISS = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_CLIENT_ACK_MISS, )
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_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_MISS = fmt.Sprintf( "if(close_type=%d,1,0)", FLOW_LOG_CLOSE_TYPE_SERVER_SYN_MISS, )
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_SERVER_SYN_MISS,
FLOW_LOG_CLOSE_TYPE_CLIENT_ACK_MISS, 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_ACK_MISS,
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_SYN_MISS, 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 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 IN_PROCESS_METRICS = map[string]*Metrics{}
View Source
var IN_PROCESS_METRICS_REPLACE = map[string]*Metrics{ "profile_value": NewReplaceMetrics("1", ""), }
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", "syn_count>0"), "retrans_synack_ratio": NewReplaceMetrics("retrans_synack/synack_count", "synack_count>0"), "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, DB_FIELD_CLOSED_FLOW+">0"), "client_establish_fail_ratio": NewReplaceMetrics(DB_FIELD_CLIENT_ESTABLISH_FAIL+"/"+DB_FIELD_CLOSED_FLOW, DB_FIELD_CLOSED_FLOW+">0"), "server_establish_fail_ratio": NewReplaceMetrics(DB_FIELD_SERVER_ESTABLISH_FAIL+"/"+DB_FIELD_CLOSED_FLOW, DB_FIELD_CLOSED_FLOW+">0"), "tcp_transfer_fail": NewReplaceMetrics(DB_FIELD_TCP_TRANSFER_FAIL, ""), "tcp_transfer_fail_ratio": NewReplaceMetrics(DB_FIELD_TCP_TRANSFER_FAIL+"/"+DB_FIELD_CLOSED_FLOW, DB_FIELD_CLOSED_FLOW+">0"), "tcp_rst_fail": NewReplaceMetrics(DB_FIELD_TCP_RST_FAIL, ""), "tcp_rst_fail_ratio": NewReplaceMetrics(DB_FIELD_TCP_RST_FAIL+"/"+DB_FIELD_CLOSED_FLOW, DB_FIELD_CLOSED_FLOW+">0"), "client_source_port_reuse": NewReplaceMetrics(DB_FIELD_CLIENT_SOURCE_PORT_REUSE, ""), "server_syn_miss": NewReplaceMetrics(DB_FIELD_SERVER_SYN_MISS, ""), "client_establish_other_rst": NewReplaceMetrics(DB_FIELD_CLIENT_ESTABLISH_OTHER_RST, ""), "server_reset": NewReplaceMetrics(DB_FIELD_SERVER_RESET, ""), "client_ack_miss": NewReplaceMetrics(DB_FIELD_CLIENT_ACK_MISS, ""), "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, ""), "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_response>0"), "l7_client_error_ratio": NewReplaceMetrics("l7_client_error/l7_response", "l7_response>0"), "l7_server_error_ratio": NewReplaceMetrics("l7_server_error/l7_response", "l7_response>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, DB_FIELD_RESPONSE+">0"), "client_error_ratio": NewReplaceMetrics(DB_FIELD_CLIENT_ERROR+"/"+DB_FIELD_RESPONSE, DB_FIELD_RESPONSE+">0"), "server_error_ratio": NewReplaceMetrics(DB_FIELD_SERVER_ERROR+"/"+DB_FIELD_RESPONSE, DB_FIELD_RESPONSE+">0"), "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 LOG_METRICS = map[string]*Metrics{}
View Source
var LOG_METRICS_REPLACE = map[string]*Metrics{ "log_count": NewReplaceMetrics("1", ""), }
View Source
var METRICS_ARRAY_NAME_MAP = map[string][]string{ "flow_log": []string{"metrics_names", "metrics_values"}, "application_log": []string{"metrics_names", "metrics_values"}, "ext_metrics": []string{"metrics_float_names", "metrics_float_values"}, common.DB_NAME_DEEPFLOW_ADMIN: []string{"metrics_float_names", "metrics_float_values"}, common.DB_NAME_DEEPFLOW_TENANT: []string{"metrics_float_names", "metrics_float_values"}, }
View Source
var METRICS_FUNCTIONS = []string{ view.FUNCTION_AVG, view.FUNCTION_AAVG, 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.FUNCTION_COUNT, view.FUNCTION_TOPK, view.FUNCTION_ANY, }
View Source
var METRICS_FUNCTIONS_MAP = map[string]*Function{ view.FUNCTION_COUNT: NewFunction(view.FUNCTION_COUNT, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_OTHER}, "$unit", 0, true, "Number"), view.FUNCTION_SUM: NewFunction(view.FUNCTION_SUM, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER}, "$unit", 0, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 0, true, "Number"), view.FUNCTION_AAVG: NewFunction(view.FUNCTION_AAVG, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER, METRICS_TYPE_GAUGE, METRICS_TYPE_DELAY, METRICS_TYPE_PERCENTAGE, METRICS_TYPE_QUOTIENT, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 0, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 0, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 0, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 0, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 0, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "", 0, true, "Number"), view.FUNCTION_APDEX: NewFunction(view.FUNCTION_APDEX, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_DELAY}, "%", 1, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 1, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "$unit", 1, true, "Number"), view.FUNCTION_UNIQ: NewFunction(view.FUNCTION_UNIQ, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 0, false, "Number"), view.FUNCTION_UNIQ_EXACT: NewFunction(view.FUNCTION_UNIQ_EXACT, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 0, false, "Number"), view.FUNCTION_PERCENTAG: NewFunction(view.FUNCTION_PERCENTAG, FUNCTION_TYPE_MATH, nil, "%", 0, true, "Number"), view.FUNCTION_PERSECOND: NewFunction(view.FUNCTION_PERSECOND, FUNCTION_TYPE_MATH, nil, "$unit/s", 0, true, "Number"), view.FUNCTION_HISTOGRAM: NewFunction(view.FUNCTION_HISTOGRAM, FUNCTION_TYPE_MATH, nil, "", 1, true, "Number"), 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, METRICS_TYPE_BOUNDED_GAUGE}, "", 0, true, "Number"), view.FUNCTION_TOPK: NewFunction(view.FUNCTION_TOPK, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 1, false, "String"), view.FUNCTION_ANY: NewFunction(view.FUNCTION_ANY, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 0, false, "String"), view.FUNCTION_DERIVATIVE: NewFunction(view.FUNCTION_DERIVATIVE, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_COUNTER}, "$unit", 0, true, "Number"), view.FUNCTION_COUNTDISTINCT: NewFunction(view.FUNCTION_COUNTDISTINCT, FUNCTION_TYPE_AGG, []int{METRICS_TYPE_TAG}, "$unit", 0, false, "Number"), }
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, "bounded_gauge": METRICS_TYPE_BOUNDED_GAUGE, "delay": METRICS_TYPE_DELAY, "percentage": METRICS_TYPE_PERCENTAGE, "quotient": METRICS_TYPE_QUOTIENT, "tag": METRICS_TYPE_TAG, "other": METRICS_TYPE_OTHER, }
View Source
var METRICS_TYPE_UNLAY_FUNCTIONS = map[int][]string{ METRICS_TYPE_COUNTER: []string{view.FUNCTION_SUM, view.FUNCTION_AVG}, METRICS_TYPE_GAUGE: []string{view.FUNCTION_AVG}, METRICS_TYPE_BOUNDED_GAUGE: []string{view.FUNCTION_AVG, view.FUNCTION_AAVG, view.FUNCTION_MAX, view.FUNCTION_MIN, view.FUNCTION_LAST, view.FUNCTION_PCTL, view.FUNCTION_PCTL_EXACT}, METRICS_TYPE_DELAY: []string{view.FUNCTION_AVG, view.FUNCTION_AAVG, view.FUNCTION_MAX, view.FUNCTION_MIN, view.FUNCTION_LAST, view.FUNCTION_PCTL, view.FUNCTION_PCTL_EXACT}, METRICS_TYPE_PERCENTAGE: []string{view.FUNCTION_AVG}, METRICS_TYPE_QUOTIENT: []string{view.FUNCTION_AVG}, METRICS_TYPE_TAG: []string{view.FUNCTION_UNIQ, view.FUNCTION_UNIQ_EXACT}, METRICS_TYPE_OTHER: []string{view.FUNCTION_COUNT}, }
指标量类型支持不用拆层的算子的集合
View Source
var PROMETHEUS_METRICS = map[string]*Metrics{}
View Source
var PROMETHEUS_METRICS_REPLACE = map[string]*Metrics{}
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 RESOURCE_PERF_EVENT_METRICS = map[string]*Metrics{}
View Source
var RESOURCE_PERF_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", ""), }
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", ""), }
Functions ¶
func FormatMetricsToResult ¶
func GetAlarmEventMetrics ¶
func GetExtMetrics ¶
func GetFunctionDescriptions ¶
func GetInProcessMetrics ¶
func GetL4FlowLogMetrics ¶
func GetL4PacketMetrics ¶
func GetL7FlowLogMetrics ¶
func GetL7PacketMetrics ¶
func GetLogMetrics ¶
func GetMetricsDescriptions ¶
func GetResourceEventMetrics ¶
func GetSamplesMetrics ¶
func GetTagDBField ¶
func GetTagTypeMetrics ¶
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 // 描述 TagType string // Tag type of metric's tag type }
func GetAggMetrics ¶
func GetMetrics ¶
func NewMetrics ¶
func NewReplaceMetrics ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.