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

[TD-6452]<feature>: taoskeeper add request metrics

上级 9aad6bd3
......@@ -243,9 +243,19 @@ SStatisInfo dnodeGetStatisInfo() {
#ifdef HTTP_EMBEDDED
info.httpReqNum = httpGetReqCount();
#endif
info.queryReqNum = atomic_exchange_32(&tsQueryReqNum, 0);
info.submitReqNum = atomic_exchange_32(&tsSubmitReqNum, 0);
info.queryReqNum = atomic_load_32(&tsQueryReqNum);
info.submitReqNum = atomic_load_32(&tsSubmitReqNum);
}
return info;
}
void dnodeClearStatisInfo() {
if (dnodeGetRunStatus() == TSDB_RUN_STATUS_RUNING) {
#ifdef HTTP_EMBEDDED
httpClearReqCount();
#endif
atomic_exchange_32(&tsQueryReqNum, 0);
atomic_exchange_32(&tsSubmitReqNum, 0);
}
}
......@@ -30,6 +30,7 @@ typedef struct {
} SStatisInfo;
SStatisInfo dnodeGetStatisInfo();
void dnodeClearStatisInfo();
bool dnodeIsFirstDeploy();
bool dnodeIsMasterEp(char *ep);
......
......@@ -23,6 +23,7 @@ extern "C" {
#include <stdint.h>
int32_t httpGetReqCount();
int32_t httpClearReqCount();
int32_t httpInitSystem();
int32_t httpStartSystem();
void httpStopSystem();
......
......@@ -120,4 +120,5 @@ void httpCleanUpSystem() {
tsHttpServer.status = HTTP_SERVER_CLOSED;
}
int32_t httpGetReqCount() { return atomic_exchange_32(&tsHttpServer.requestNum, 0); }
int32_t httpGetReqCount() { return atomic_load_32(&tsHttpServer.requestNum); }
int32_t httpClearReqCount() { return atomic_exchange_32(&tsHttpServer.requestNum, 0); }
......@@ -415,8 +415,7 @@ static int32_t monBuildBandSql(char *sql) {
}
static int32_t monBuildReqSql(char *sql) {
//SStatisInfo info = dnodeGetStatisInfo();
SStatisInfo info = {0};
SStatisInfo info = dnodeGetStatisInfo();
return sprintf(sql, ", %d, %d, %d)", info.httpReqNum, info.queryReqNum, info.submitReqNum);
}
......@@ -708,6 +707,7 @@ static int32_t monBuildDnodeReqRateSql(char *sql) {
return sprintf(sql, ", %d, %f, %d, %f, %d, %f", info.httpReqNum, httpReqRate,
info.queryReqNum - monFetchQueryReqCnt(), queryReqRate,
info.submitReqNum - monFetchSubmitReqCnt(), submitReqRate);
dnodeClearStatisInfo();
}
static int32_t monBuildDnodeErrorsSql(char *sql) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册