提交 f96100b1 编写于 作者: G Ganlin Zhao

[TD-6452]<feature>: taoskeeper add HTTP status codes

上级 b585766f
......@@ -27,73 +27,6 @@ extern "C" {
monSaveDnodeLog(level, __VA_ARGS__); \
}
#define MON_MAX_HTTP_CODE 63
static const char *monHttpStatusCodeTable[MON_MAX_HTTP_CODE][2] = {
{"HTTP_CODE_CONTINUE", "100"},
{"HTTP_CODE_SWITCHING_PROTOCOL", "101"},
{"HTTP_CODE_PROCESSING", "102"},
{"HTTP_CODE_EARLY_HINTS", "103"},
{"HTTP_CODE_OK", "200"},
{"HTTP_CODE_CREATED", "201"},
{"HTTP_CODE_ACCEPTED", "202"},
{"HTTP_CODE_NON_AUTHORITATIVE_INFO", "203"},
{"HTTP_CODE_NO_CONTENT", "204"},
{"HTTP_CODE_RESET_CONTENT", "205"},
{"HTTP_CODE_PARTIAL_CONTENT", "206"},
{"HTTP_CODE_MULTI_STATUS", "207"},
{"HTTP_CODE_ALREADY_REPORTED", "208"},
{"HTTP_CODE_IM_USED", "226"},
{"HTTP_CODE_MULTIPLE_CHOICE", "300"},
{"HTTP_CODE_MOVED_PERMANENTLY", "301"},
{"HTTP_CODE_FOUND", "302"},
{"HTTP_CODE_SEE_OTHER", "303"},
{"HTTP_CODE_NOT_MODIFIED", "304"},
{"HTTP_CODE_USE_PROXY", "305"},
{"HTTP_CODE_UNUSED", "306"},
{"HTTP_CODE_TEMPORARY_REDIRECT", "307"},
{"HTTP_CODE_PERMANENT_REDIRECT", "308"},
{"HTTP_CODE_BAD_REQUEST", "400"},
{"HTTP_CODE_UNAUTHORIZED", "401"},
{"HTTP_CODE_PAYMENT_REQUIRED", "402"},
{"HTTP_CODE_FORBIDDEN", "403"},
{"HTTP_CODE_NOT_FOUND", "404"},
{"HTTP_CODE_METHOD_NOT_ALLOWED", "405"},
{"HTTP_CODE_NOT_ACCEPTABLE", "406"},
{"HTTP_CODE_PROXY_AUTH_REQUIRED", "407"},
{"HTTP_CODE_REQUEST_TIMEOUT", "408"},
{"HTTP_CODE_CONFLICT", "409"},
{"HTTP_CODE_GONE", "410"},
{"HTTP_CODE_LENGTH_REQUIRED", "411"},
{"HTTP_CODE_PRECONDITION_FAILED", "412"},
{"HTTP_CODE_PAYLOAD_TOO_LARGE", "413"},
{"HTTP_CODE_URI_TOO_LARGE", "414"},
{"HTTP_CODE_UNSUPPORTED_MEDIA_TYPE", "415"},
{"HTTP_CODE_RANGE_NOT_SATISFIABLE", "416"},
{"HTTP_CODE_EXPECTATION_FAILED", "417"},
{"HTTP_CODE_IM_A_TEAPOT", "418"},
{"HTTP_CODE_MISDIRECTED_REQUEST", "421"},
{"HTTP_CODE_UNPROCESSABLE_ENTITY", "422"},
{"HTTP_CODE_LOCKED", "423"},
{"HTTP_CODE_FAILED_DEPENDENCY", "424"},
{"HTTP_CODE_TOO_EARLY", "425"},
{"HTTP_CODE_UPGRADE_REQUIRED", "426"},
{"HTTP_CODE_PRECONDITION_REQUIRED", "428"},
{"HTTP_CODE_TOO_MANY_REQUESTS", "429"},
{"HTTP_CODE_REQ_HDR_FIELDS_TOO_LARGE","431"},
{"HTTP_CODE_UNAVAIL_4_LEGAL_REASONS", "451"},
{"HTTP_CODE_INTERNAL_SERVER_ERROR", "500"},
{"HTTP_CODE_NOT_IMPLEMENTED", "501"},
{"HTTP_CODE_BAD_GATEWAY", "502"},
{"HTTP_CODE_SERVICE_UNAVAILABLE", "503"},
{"HTTP_CODE_GATEWAY_TIMEOUT", "504"},
{"HTTP_CODE_HTTP_VER_NOT_SUPPORTED", "505"},
{"HTTP_CODE_VARIANT_ALSO_NEGOTIATES", "506"},
{"HTTP_CODE_INSUFFICIENT_STORAGE", "507"},
{"HTTP_CODE_LOOP_DETECTED", "508"},
{"HTTP_CODE_NOT_EXTENDED", "510"},
{"HTTP_CODE_NETWORK_AUTH_REQUIRED", "511"},
};
typedef struct {
char * acctId;
......
......@@ -45,6 +45,74 @@
#define MAX_TIMESERIES_LEN 30
#define CHECK_INTERVAL 1000
#define MON_MAX_HTTP_CODE 63
static const char *monHttpStatusCodeTable[MON_MAX_HTTP_CODE][2] = {
{"HTTP_CODE_CONTINUE", "100"},
{"HTTP_CODE_SWITCHING_PROTOCOL", "101"},
{"HTTP_CODE_PROCESSING", "102"},
{"HTTP_CODE_EARLY_HINTS", "103"},
{"HTTP_CODE_OK", "200"},
{"HTTP_CODE_CREATED", "201"},
{"HTTP_CODE_ACCEPTED", "202"},
{"HTTP_CODE_NON_AUTHORITATIVE_INFO", "203"},
{"HTTP_CODE_NO_CONTENT", "204"},
{"HTTP_CODE_RESET_CONTENT", "205"},
{"HTTP_CODE_PARTIAL_CONTENT", "206"},
{"HTTP_CODE_MULTI_STATUS", "207"},
{"HTTP_CODE_ALREADY_REPORTED", "208"},
{"HTTP_CODE_IM_USED", "226"},
{"HTTP_CODE_MULTIPLE_CHOICE", "300"},
{"HTTP_CODE_MOVED_PERMANENTLY", "301"},
{"HTTP_CODE_FOUND", "302"},
{"HTTP_CODE_SEE_OTHER", "303"},
{"HTTP_CODE_NOT_MODIFIED", "304"},
{"HTTP_CODE_USE_PROXY", "305"},
{"HTTP_CODE_UNUSED", "306"},
{"HTTP_CODE_TEMPORARY_REDIRECT", "307"},
{"HTTP_CODE_PERMANENT_REDIRECT", "308"},
{"HTTP_CODE_BAD_REQUEST", "400"},
{"HTTP_CODE_UNAUTHORIZED", "401"},
{"HTTP_CODE_PAYMENT_REQUIRED", "402"},
{"HTTP_CODE_FORBIDDEN", "403"},
{"HTTP_CODE_NOT_FOUND", "404"},
{"HTTP_CODE_METHOD_NOT_ALLOWED", "405"},
{"HTTP_CODE_NOT_ACCEPTABLE", "406"},
{"HTTP_CODE_PROXY_AUTH_REQUIRED", "407"},
{"HTTP_CODE_REQUEST_TIMEOUT", "408"},
{"HTTP_CODE_CONFLICT", "409"},
{"HTTP_CODE_GONE", "410"},
{"HTTP_CODE_LENGTH_REQUIRED", "411"},
{"HTTP_CODE_PRECONDITION_FAILED", "412"},
{"HTTP_CODE_PAYLOAD_TOO_LARGE", "413"},
{"HTTP_CODE_URI_TOO_LARGE", "414"},
{"HTTP_CODE_UNSUPPORTED_MEDIA_TYPE", "415"},
{"HTTP_CODE_RANGE_NOT_SATISFIABLE", "416"},
{"HTTP_CODE_EXPECTATION_FAILED", "417"},
{"HTTP_CODE_IM_A_TEAPOT", "418"},
{"HTTP_CODE_MISDIRECTED_REQUEST", "421"},
{"HTTP_CODE_UNPROCESSABLE_ENTITY", "422"},
{"HTTP_CODE_LOCKED", "423"},
{"HTTP_CODE_FAILED_DEPENDENCY", "424"},
{"HTTP_CODE_TOO_EARLY", "425"},
{"HTTP_CODE_UPGRADE_REQUIRED", "426"},
{"HTTP_CODE_PRECONDITION_REQUIRED", "428"},
{"HTTP_CODE_TOO_MANY_REQUESTS", "429"},
{"HTTP_CODE_REQ_HDR_FIELDS_TOO_LARGE","431"},
{"HTTP_CODE_UNAVAIL_4_LEGAL_REASONS", "451"},
{"HTTP_CODE_INTERNAL_SERVER_ERROR", "500"},
{"HTTP_CODE_NOT_IMPLEMENTED", "501"},
{"HTTP_CODE_BAD_GATEWAY", "502"},
{"HTTP_CODE_SERVICE_UNAVAILABLE", "503"},
{"HTTP_CODE_GATEWAY_TIMEOUT", "504"},
{"HTTP_CODE_HTTP_VER_NOT_SUPPORTED", "505"},
{"HTTP_CODE_VARIANT_ALSO_NEGOTIATES", "506"},
{"HTTP_CODE_INSUFFICIENT_STORAGE", "507"},
{"HTTP_CODE_LOOP_DETECTED", "508"},
{"HTTP_CODE_NOT_EXTENDED", "510"},
{"HTTP_CODE_NETWORK_AUTH_REQUIRED", "511"},
};
typedef enum {
MON_CMD_CREATE_DB,
MON_CMD_CREATE_TB_LOG,
......@@ -349,25 +417,20 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) {
} else if (cmd == MON_CMD_CREATE_MT_RESTFUL) {
snprintf(sql, SQL_LENGTH,
"create table if not exists %s.restful_info(ts timestamp"
", uptime float"
", cpu_engine float, cpu_system float, cpu_cores int"
", mem_engine float, mem_system float, mem_total float"
", disk_engine float, disk_used float, disk_total float"
", net_in float, net_out float"
", io_read float, io_write float"
", req_http int, req_http_rate float"
", req_select int, req_select_rate float"
", req_insert int, req_insert_success int, req_insert_rate float"
", req_insert_batch int, req_insert_batch_sucesss int, req_insert_batch_rate float"
", errors int"
", vnodes_num int"
", masters int"
", has_mnode bool"
", total_req float",
tsMonitorDbName);
for (int i = 0; i < MON_MAX_HTTP_CODE; ++i) {
snprintf(sql, SQL_LENGTH, ", %s(%s) int",
monHttpStatusCodeTable[i][0],
monHttpStatusCodeTable[i][1]);
}
snprintf(sql, SQL_LENGTH,
") tags (dnode_id int, dnode_ep binary(%d))",
tsMonitorDbName, TSDB_EP_LEN);
TSDB_EP_LEN);
} else if (cmd == MON_CMD_CREATE_TB_RESTFUL) {
snprintf(sql, SQL_LENGTH, "create table if not exists %s.restful_%d using %s.restful_info tags(%d, '%s')", tsMonitorDbName,
dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp);
}
sql[SQL_LENGTH] = 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册