提交 156c6cff 编写于 作者: G Ganlin Zhao

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

上级 bc2de56c
......@@ -242,9 +242,6 @@ SDnodeStatisInfo dnodeGetStatisInfo() {
if (dnodeGetRunStatus() == TSDB_RUN_STATUS_RUNING) {
#ifdef HTTP_EMBEDDED
info.httpReqNum = httpGetReqCount();
for (int i = 0; i < MAX_HTTP_STATUS_CODE_NUM; ++i) {
info.httpStatusCodeErrs[i] = httpGetStatusCodeCount(i);
}
#endif
info.queryReqNum = atomic_load_32(&tsQueryReqNum);
info.submitReqNum = atomic_load_32(&tsSubmitReqNum);
......@@ -257,11 +254,24 @@ void dnodeClearStatisInfo() {
if (dnodeGetRunStatus() == TSDB_RUN_STATUS_RUNING) {
#ifdef HTTP_EMBEDDED
httpClearReqCount();
for (int i = 0; i < MAX_HTTP_STATUS_CODE_NUM; ++i) {
httpClearStatusCodeCount(i);
}
#endif
atomic_exchange_32(&tsQueryReqNum, 0);
atomic_exchange_32(&tsSubmitReqNum, 0);
}
}
int32_t dnodeGetHttpStatusInfo(int32_t index) {
int32_t httpStatus = 0;
#ifdef HTTP_EMBEDDED
httpStatus = httpGetStatusCodeCount(index);
#endif
return httpStatus;
}
void dnodeClearHttpStatusInfo() {
#ifdef HTTP_EMBEDDED
for (int i = 0; i < MAX_HTTP_STATUS_CODE_NUM; ++i) {
httpClearStatusCodeCount(i);
}
#endif
}
......@@ -28,11 +28,12 @@ typedef struct {
int32_t queryReqNum;
int32_t submitReqNum;
int32_t httpReqNum;
int32_t httpStatusCodeErrs[MAX_HTTP_STATUS_CODE_NUM];
} SDnodeStatisInfo;
SDnodeStatisInfo dnodeGetStatisInfo();
void dnodeClearStatisInfo();
void dnodeClearStatisInfo();
int32_t dnodeGetHttpStatusInfo(int32_t index);
void dnodeClearHttpStatusInfo();
bool dnodeIsFirstDeploy();
bool dnodeIsMasterEp(char *ep);
......
......@@ -1208,13 +1208,12 @@ static void monSaveHttpReqInfo() {
char * sql = tsMonitor.sql;
int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.restful_%d values(%" PRId64, tsMonitorDbName, dnodeGetDnodeId(), ts);
SDnodeStatisInfo info = dnodeGetStatisInfo();
pos += snprintf(sql + pos, SQL_LENGTH, ", %d", info.httpReqNum);
for (int32_t i = 0; i < tListLen(monHttpStatusTable); ++i) {
int32_t status = info.httpStatusCodeErrs[i];
int32_t status = dnodeGetHttpStatusInfo(i);
pos += snprintf(sql + pos, SQL_LENGTH, ", %d", status);
}
pos += snprintf(sql + pos, SQL_LENGTH, ")");
dnodeClearHttpStatusInfo();
monError("sql:%s", sql);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册