提交 b34ea72a 编写于 作者: S Shengliang Guan

feat[cluster]: send monitor information in multi-process mode

上级 41058425
...@@ -143,7 +143,7 @@ typedef struct { ...@@ -143,7 +143,7 @@ typedef struct {
SMonVgroupInfo vgroup; SMonVgroupInfo vgroup;
SMonGrantInfo grant; SMonGrantInfo grant;
SMonSysInfo sys; SMonSysInfo sys;
SMonLogs logs; SMonLogs log;
} SMonMmInfo; } SMonMmInfo;
int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo); int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo);
...@@ -158,7 +158,7 @@ typedef struct { ...@@ -158,7 +158,7 @@ typedef struct {
SMonDiskInfo tfs; SMonDiskInfo tfs;
SVnodesStat vstat; SVnodesStat vstat;
SMonSysInfo sys; SMonSysInfo sys;
SMonLogs logs; SMonLogs log;
} SMonVmInfo; } SMonVmInfo;
int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo); int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo);
...@@ -167,7 +167,7 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo); ...@@ -167,7 +167,7 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo);
typedef struct { typedef struct {
SMonSysInfo sys; SMonSysInfo sys;
SMonLogs logs; SMonLogs log;
} SMonQmInfo; } SMonQmInfo;
int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo); int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo);
...@@ -176,7 +176,7 @@ void tFreeSMonQmInfo(SMonQmInfo *pInfo); ...@@ -176,7 +176,7 @@ void tFreeSMonQmInfo(SMonQmInfo *pInfo);
typedef struct { typedef struct {
SMonSysInfo sys; SMonSysInfo sys;
SMonLogs logs; SMonLogs log;
} SMonSmInfo; } SMonSmInfo;
int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo); int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo);
...@@ -184,7 +184,7 @@ int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo); ...@@ -184,7 +184,7 @@ int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo);
void tFreeSMonSmInfo(SMonSmInfo *pInfo); void tFreeSMonSmInfo(SMonSmInfo *pInfo);
typedef struct { typedef struct {
SMonSysInfo sys; SMonSysInfo sys;
SMonLogs logs; SMonLogs log;
} SMonBmInfo; } SMonBmInfo;
int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo); int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) { void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
dmGetMonitorSysInfo(&bmInfo->sys); dmGetMonitorSysInfo(&bmInfo->sys);
monGetLogs(&bmInfo->logs); monGetLogs(&bmInfo->log);
} }
} }
......
...@@ -119,9 +119,9 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) { ...@@ -119,9 +119,9 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
return -1; return -1;
} }
SSingleWorkerCfg scfg = {.min = 1, .max = 1, .name = "dnode-status", .fp = (FItem)dmProcessQueue, .param = pMgmt}; SSingleWorkerCfg scfg = {.min = 1, .max = 1, .name = "dnode-monitor", .fp = (FItem)dmProcessQueue, .param = pMgmt};
if (tSingleWorkerInit(&pMgmt->statusWorker, &scfg) != 0) { if (tSingleWorkerInit(&pMgmt->monitorWorker, &scfg) != 0) {
dError("failed to start dnode status worker since %s", terrstr()); dError("failed to start dnode monitor worker since %s", terrstr());
return -1; return -1;
} }
...@@ -131,7 +131,7 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) { ...@@ -131,7 +131,7 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
void dmStopWorker(SDnodeMgmt *pMgmt) { void dmStopWorker(SDnodeMgmt *pMgmt) {
tSingleWorkerCleanup(&pMgmt->mgmtWorker); tSingleWorkerCleanup(&pMgmt->mgmtWorker);
tSingleWorkerCleanup(&pMgmt->statusWorker); tSingleWorkerCleanup(&pMgmt->monitorWorker);
if (pMgmt->threadId != NULL) { if (pMgmt->threadId != NULL) {
taosDestoryThread(pMgmt->threadId); taosDestoryThread(pMgmt->threadId);
...@@ -151,7 +151,7 @@ int32_t dmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) { ...@@ -151,7 +151,7 @@ int32_t dmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
int32_t dmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) { int32_t dmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SDnodeMgmt *pMgmt = pWrapper->pMgmt; SDnodeMgmt *pMgmt = pWrapper->pMgmt;
SSingleWorker *pWorker = &pMgmt->statusWorker; SSingleWorker *pWorker = &pMgmt->monitorWorker;
dTrace("msg:%p, put into worker %s", pMsg, pWorker->name); dTrace("msg:%p, put into worker %s", pMsg, pWorker->name);
taosWriteQitem(pWorker->queue, pMsg); taosWriteQitem(pWorker->queue, pMsg);
......
...@@ -32,7 +32,7 @@ typedef struct SDnodeMgmt { ...@@ -32,7 +32,7 @@ typedef struct SDnodeMgmt {
TdThread *threadId; TdThread *threadId;
SRWLatch latch; SRWLatch latch;
SSingleWorker mgmtWorker; SSingleWorker mgmtWorker;
SSingleWorker statusWorker; SSingleWorker monitorWorker;
SMsgCb msgCb; SMsgCb msgCb;
const char *path; const char *path;
SDnode *pDnode; SDnode *pDnode;
......
...@@ -21,7 +21,7 @@ void mmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonMmInfo *mmInfo) { ...@@ -21,7 +21,7 @@ void mmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonMmInfo *mmInfo) {
mndGetMonitorInfo(pMgmt->pMnode, &mmInfo->cluster, &mmInfo->vgroup, &mmInfo->grant); mndGetMonitorInfo(pMgmt->pMnode, &mmInfo->cluster, &mmInfo->vgroup, &mmInfo->grant);
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
dmGetMonitorSysInfo(&mmInfo->sys); dmGetMonitorSysInfo(&mmInfo->sys);
monGetLogs(&mmInfo->logs); monGetLogs(&mmInfo->log);
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) { void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
dmGetMonitorSysInfo(&qmInfo->sys); dmGetMonitorSysInfo(&qmInfo->sys);
monGetLogs(&qmInfo->logs); monGetLogs(&qmInfo->log);
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
void smGetMonitorInfo(SMgmtWrapper *pWrapper, SMonSmInfo *smInfo) { void smGetMonitorInfo(SMgmtWrapper *pWrapper, SMonSmInfo *smInfo) {
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
dmGetMonitorSysInfo(&smInfo->sys); dmGetMonitorSysInfo(&smInfo->sys);
monGetLogs(&smInfo->logs); monGetLogs(&smInfo->log);
} }
} }
......
...@@ -34,7 +34,7 @@ void vmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonVmInfo *vmInfo) { ...@@ -34,7 +34,7 @@ void vmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonVmInfo *vmInfo) {
if (pWrapper->procType == PROC_CHILD) { if (pWrapper->procType == PROC_CHILD) {
dmGetMonitorSysInfo(&vmInfo->sys); dmGetMonitorSysInfo(&vmInfo->sys);
monGetLogs(&vmInfo->logs); monGetLogs(&vmInfo->log);
} }
} }
......
...@@ -24,7 +24,7 @@ typedef struct { ...@@ -24,7 +24,7 @@ typedef struct {
int64_t curTime; int64_t curTime;
int64_t lastTime; int64_t lastTime;
SJson *pJson; SJson *pJson;
SMonLogs logs; SMonLogs log;
SMonDmInfo dmInfo; SMonDmInfo dmInfo;
SMonMmInfo mmInfo; SMonMmInfo mmInfo;
SMonVmInfo vmInfo; SMonVmInfo vmInfo;
......
...@@ -124,7 +124,7 @@ void monCleanup() { ...@@ -124,7 +124,7 @@ void monCleanup() {
static void monCleanupMonitorInfo(SMonInfo *pMonitor) { static void monCleanupMonitorInfo(SMonInfo *pMonitor) {
tsMonitor.lastTime = pMonitor->curTime; tsMonitor.lastTime = pMonitor->curTime;
taosArrayDestroy(pMonitor->logs.logs); taosArrayDestroy(pMonitor->log.logs);
tFreeSMonMmInfo(&pMonitor->mmInfo); tFreeSMonMmInfo(&pMonitor->mmInfo);
tFreeSMonVmInfo(&pMonitor->vmInfo); tFreeSMonVmInfo(&pMonitor->vmInfo);
tFreeSMonSmInfo(&pMonitor->smInfo); tFreeSMonSmInfo(&pMonitor->smInfo);
...@@ -141,7 +141,7 @@ static SMonInfo *monCreateMonitorInfo() { ...@@ -141,7 +141,7 @@ static SMonInfo *monCreateMonitorInfo() {
return NULL; return NULL;
} }
monGetLogs(&pMonitor->logs); monGetLogs(&pMonitor->log);
taosThreadMutexLock(&tsMonitor.lock); taosThreadMutexLock(&tsMonitor.lock);
memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo)); memcpy(&pMonitor->dmInfo, &tsMonitor.dmInfo, sizeof(SMonDmInfo));
...@@ -159,7 +159,7 @@ static SMonInfo *monCreateMonitorInfo() { ...@@ -159,7 +159,7 @@ static SMonInfo *monCreateMonitorInfo() {
taosThreadMutexUnlock(&tsMonitor.lock); taosThreadMutexUnlock(&tsMonitor.lock);
pMonitor->pJson = tjsonCreateObject(); pMonitor->pJson = tjsonCreateObject();
if (pMonitor->pJson == NULL || pMonitor->logs.logs == NULL) { if (pMonitor->pJson == NULL || pMonitor->log.logs == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
monCleanupMonitorInfo(pMonitor); monCleanupMonitorInfo(pMonitor);
return NULL; return NULL;
...@@ -447,12 +447,12 @@ static void monGenLogJson(SMonInfo *pMonitor) { ...@@ -447,12 +447,12 @@ static void monGenLogJson(SMonInfo *pMonitor) {
if (pLogsJson == NULL) return; if (pLogsJson == NULL) return;
SMonLogs *logs[6]; SMonLogs *logs[6];
logs[0] = &pMonitor->logs; logs[0] = &pMonitor->log;
logs[1] = &pMonitor->mmInfo.logs; logs[1] = &pMonitor->mmInfo.log;
logs[2] = &pMonitor->vmInfo.logs; logs[2] = &pMonitor->vmInfo.log;
logs[3] = &pMonitor->smInfo.logs; logs[3] = &pMonitor->smInfo.log;
logs[4] = &pMonitor->qmInfo.logs; logs[4] = &pMonitor->qmInfo.log;
logs[5] = &pMonitor->bmInfo.logs; logs[5] = &pMonitor->bmInfo.log;
int32_t numOfErrorLogs = 0; int32_t numOfErrorLogs = 0;
int32_t numOfInfoLogs = 0; int32_t numOfInfoLogs = 0;
...@@ -460,17 +460,17 @@ static void monGenLogJson(SMonInfo *pMonitor) { ...@@ -460,17 +460,17 @@ static void monGenLogJson(SMonInfo *pMonitor) {
int32_t numOfTraceLogs = 0; int32_t numOfTraceLogs = 0;
for (int32_t j = 0; j < 6; j++) { for (int32_t j = 0; j < 6; j++) {
SMonLogs *pLogs = logs[j]; SMonLogs *pLog = logs[j];
numOfErrorLogs += pLogs->numOfErrorLogs; numOfErrorLogs += pLog->numOfErrorLogs;
numOfInfoLogs += pLogs->numOfInfoLogs; numOfInfoLogs += pLog->numOfInfoLogs;
numOfDebugLogs += pLogs->numOfDebugLogs; numOfDebugLogs += pLog->numOfDebugLogs;
numOfTraceLogs += pLogs->numOfTraceLogs; numOfTraceLogs += pLog->numOfTraceLogs;
for (int32_t i = 0; i < taosArrayGetSize(pLogs->logs); ++i) { for (int32_t i = 0; i < taosArrayGetSize(pLog->logs); ++i) {
SJson *pLogJson = tjsonCreateObject(); SJson *pLogJson = tjsonCreateObject();
if (pLogJson == NULL) continue; if (pLogJson == NULL) continue;
SMonLogItem *pLogItem = taosArrayGet(pLogs->logs, i); SMonLogItem *pLogItem = taosArrayGet(pLog->logs, i);
char buf[40] = {0}; char buf[40] = {0};
taosFormatUtcTime(buf, sizeof(buf), pLogItem->ts, TSDB_TIME_PRECISION_MILLI); taosFormatUtcTime(buf, sizeof(buf), pLogItem->ts, TSDB_TIME_PRECISION_MILLI);
......
...@@ -226,7 +226,7 @@ int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) { ...@@ -226,7 +226,7 @@ int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
if (tEncodeSMonVgroupInfo(&encoder, &pInfo->vgroup) < 0) return -1; if (tEncodeSMonVgroupInfo(&encoder, &pInfo->vgroup) < 0) return -1;
if (tEncodeSMonGrantInfo(&encoder, &pInfo->grant) < 0) return -1; if (tEncodeSMonGrantInfo(&encoder, &pInfo->grant) < 0) return -1;
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1; if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
if (tEncodeSMonLogs(&encoder, &pInfo->logs) < 0) return -1; if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
...@@ -243,7 +243,7 @@ int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) { ...@@ -243,7 +243,7 @@ int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
if (tDecodeSMonVgroupInfo(&decoder, &pInfo->vgroup) < 0) return -1; if (tDecodeSMonVgroupInfo(&decoder, &pInfo->vgroup) < 0) return -1;
if (tDecodeSMonGrantInfo(&decoder, &pInfo->grant) < 0) return -1; if (tDecodeSMonGrantInfo(&decoder, &pInfo->grant) < 0) return -1;
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1; if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
if (tDecodeSMonLogs(&decoder, &pInfo->logs) < 0) return -1; if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
tEndDecode(&decoder); tEndDecode(&decoder);
tCoderClear(&decoder); tCoderClear(&decoder);
...@@ -251,8 +251,14 @@ int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) { ...@@ -251,8 +251,14 @@ int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
} }
void tFreeSMonMmInfo(SMonMmInfo *pInfo) { void tFreeSMonMmInfo(SMonMmInfo *pInfo) {
taosArrayDestroy(pInfo->logs.logs); taosArrayDestroy(pInfo->log.logs);
pInfo->logs.logs = NULL; taosArrayDestroy(pInfo->cluster.mnodes);
taosArrayDestroy(pInfo->cluster.dnodes);
taosArrayDestroy(pInfo->vgroup.vgroups);
pInfo->cluster.mnodes = NULL;
pInfo->cluster.dnodes = NULL;
pInfo->vgroup.vgroups = NULL;
pInfo->log.logs = NULL;
} }
int32_t tEncodeSMonDiskDesc(SCoder *encoder, const SMonDiskDesc *pDesc) { int32_t tEncodeSMonDiskDesc(SCoder *encoder, const SMonDiskDesc *pDesc) {
...@@ -331,7 +337,7 @@ int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) { ...@@ -331,7 +337,7 @@ int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
if (tEncodeSMonDiskInfo(&encoder, &pInfo->tfs) < 0) return -1; if (tEncodeSMonDiskInfo(&encoder, &pInfo->tfs) < 0) return -1;
if (tEncodeSVnodesStat(&encoder, &pInfo->vstat) < 0) return -1; if (tEncodeSVnodesStat(&encoder, &pInfo->vstat) < 0) return -1;
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1; if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
if (tEncodeSMonLogs(&encoder, &pInfo->logs) < 0) return -1; if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
...@@ -347,7 +353,7 @@ int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) { ...@@ -347,7 +353,7 @@ int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
if (tDecodeSMonDiskInfo(&decoder, &pInfo->tfs) < 0) return -1; if (tDecodeSMonDiskInfo(&decoder, &pInfo->tfs) < 0) return -1;
if (tDecodeSVnodesStat(&decoder, &pInfo->vstat) < 0) return -1; if (tDecodeSVnodesStat(&decoder, &pInfo->vstat) < 0) return -1;
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1; if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
if (tDecodeSMonLogs(&decoder, &pInfo->logs) < 0) return -1; if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
tEndDecode(&decoder); tEndDecode(&decoder);
tCoderClear(&decoder); tCoderClear(&decoder);
...@@ -355,8 +361,10 @@ int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) { ...@@ -355,8 +361,10 @@ int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
} }
void tFreeSMonVmInfo(SMonVmInfo *pInfo) { void tFreeSMonVmInfo(SMonVmInfo *pInfo) {
taosArrayDestroy(pInfo->logs.logs); taosArrayDestroy(pInfo->log.logs);
pInfo->logs.logs = NULL; taosArrayDestroy(pInfo->tfs.datadirs);
pInfo->log.logs = NULL;
pInfo->tfs.datadirs = NULL;
} }
int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) { int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
...@@ -365,7 +373,7 @@ int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) { ...@@ -365,7 +373,7 @@ int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
if (tStartEncode(&encoder) < 0) return -1; if (tStartEncode(&encoder) < 0) return -1;
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1; if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
if (tEncodeSMonLogs(&encoder, &pInfo->logs) < 0) return -1; if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
...@@ -379,7 +387,7 @@ int32_t tDeserializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) { ...@@ -379,7 +387,7 @@ int32_t tDeserializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
if (tStartDecode(&decoder) < 0) return -1; if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1; if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
if (tDecodeSMonLogs(&decoder, &pInfo->logs) < 0) return -1; if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
tEndDecode(&decoder); tEndDecode(&decoder);
tCoderClear(&decoder); tCoderClear(&decoder);
...@@ -387,8 +395,8 @@ int32_t tDeserializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) { ...@@ -387,8 +395,8 @@ int32_t tDeserializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
} }
void tFreeSMonQmInfo(SMonQmInfo *pInfo) { void tFreeSMonQmInfo(SMonQmInfo *pInfo) {
taosArrayDestroy(pInfo->logs.logs); taosArrayDestroy(pInfo->log.logs);
pInfo->logs.logs = NULL; pInfo->log.logs = NULL;
} }
int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) { int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
...@@ -397,7 +405,7 @@ int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) { ...@@ -397,7 +405,7 @@ int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
if (tStartEncode(&encoder) < 0) return -1; if (tStartEncode(&encoder) < 0) return -1;
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1; if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
if (tEncodeSMonLogs(&encoder, &pInfo->logs) < 0) return -1; if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
...@@ -411,7 +419,7 @@ int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) { ...@@ -411,7 +419,7 @@ int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
if (tStartDecode(&decoder) < 0) return -1; if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1; if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
if (tDecodeSMonLogs(&decoder, &pInfo->logs) < 0) return -1; if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
tEndDecode(&decoder); tEndDecode(&decoder);
tCoderClear(&decoder); tCoderClear(&decoder);
...@@ -419,8 +427,8 @@ int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) { ...@@ -419,8 +427,8 @@ int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
} }
void tFreeSMonSmInfo(SMonSmInfo *pInfo) { void tFreeSMonSmInfo(SMonSmInfo *pInfo) {
taosArrayDestroy(pInfo->logs.logs); taosArrayDestroy(pInfo->log.logs);
pInfo->logs.logs = NULL; pInfo->log.logs = NULL;
} }
int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) { int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
...@@ -429,7 +437,7 @@ int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) { ...@@ -429,7 +437,7 @@ int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
if (tStartEncode(&encoder) < 0) return -1; if (tStartEncode(&encoder) < 0) return -1;
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1; if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
if (tEncodeSMonLogs(&encoder, &pInfo->logs) < 0) return -1; if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
...@@ -443,7 +451,7 @@ int32_t tDeserializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) { ...@@ -443,7 +451,7 @@ int32_t tDeserializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
if (tStartDecode(&decoder) < 0) return -1; if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1; if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
if (tDecodeSMonLogs(&decoder, &pInfo->logs) < 0) return -1; if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
tEndDecode(&decoder); tEndDecode(&decoder);
tCoderClear(&decoder); tCoderClear(&decoder);
...@@ -451,8 +459,8 @@ int32_t tDeserializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) { ...@@ -451,8 +459,8 @@ int32_t tDeserializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
} }
void tFreeSMonBmInfo(SMonBmInfo *pInfo) { void tFreeSMonBmInfo(SMonBmInfo *pInfo) {
taosArrayDestroy(pInfo->logs.logs); taosArrayDestroy(pInfo->log.logs);
pInfo->logs.logs = NULL; pInfo->log.logs = NULL;
} }
int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo) { int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo) {
......
...@@ -248,25 +248,25 @@ TEST_F(MonitorTest, 01_Full) { ...@@ -248,25 +248,25 @@ TEST_F(MonitorTest, 01_Full) {
GetVgroupInfo(&mmInfo.vgroup); GetVgroupInfo(&mmInfo.vgroup);
GetGrantInfo(&mmInfo.grant); GetGrantInfo(&mmInfo.grant);
GetSysInfo(&mmInfo.sys); GetSysInfo(&mmInfo.sys);
GetLogInfo(&mmInfo.logs); GetLogInfo(&mmInfo.log);
SMonVmInfo vmInfo = {0}; SMonVmInfo vmInfo = {0};
GetDiskInfo(&vmInfo.tfs); GetDiskInfo(&vmInfo.tfs);
GetVnodeStat(&vmInfo.vstat); GetVnodeStat(&vmInfo.vstat);
GetSysInfo(&vmInfo.sys); GetSysInfo(&vmInfo.sys);
GetLogInfo(&vmInfo.logs); GetLogInfo(&vmInfo.log);
SMonQmInfo qmInfo = {0}; SMonQmInfo qmInfo = {0};
GetSysInfo(&qmInfo.sys); GetSysInfo(&qmInfo.sys);
GetLogInfo(&qmInfo.logs); GetLogInfo(&qmInfo.log);
SMonSmInfo smInfo = {0}; SMonSmInfo smInfo = {0};
GetSysInfo(&smInfo.sys); GetSysInfo(&smInfo.sys);
GetLogInfo(&smInfo.logs); GetLogInfo(&smInfo.log);
SMonBmInfo bmInfo = {0}; SMonBmInfo bmInfo = {0};
GetSysInfo(&bmInfo.sys); GetSysInfo(&bmInfo.sys);
GetLogInfo(&bmInfo.logs); GetLogInfo(&bmInfo.log);
monSetDmInfo(&dmInfo); monSetDmInfo(&dmInfo);
monSetMmInfo(&mmInfo); monSetMmInfo(&mmInfo);
......
...@@ -623,7 +623,7 @@ void taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, i ...@@ -623,7 +623,7 @@ void taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, i
static int64_t cur_wchars = 0; static int64_t cur_wchars = 0;
static int64_t cur_read_bytes = 0; static int64_t cur_read_bytes = 0;
static int64_t cur_write_bytes = 0; static int64_t cur_write_bytes = 0;
if (taosGetProcIO(&cur_rchars, &cur_wchars, &cur_read_bytes, &cur_write_bytes) != 0) { if (taosGetProcIO(&cur_rchars, &cur_wchars, &cur_read_bytes, &cur_write_bytes) == 0) {
*rchars = cur_rchars - last_rchars; *rchars = cur_rchars - last_rchars;
*wchars = cur_wchars - last_wchars; *wchars = cur_wchars - last_wchars;
*read_bytes = cur_read_bytes - last_read_bytes; *read_bytes = cur_read_bytes - last_read_bytes;
...@@ -696,7 +696,7 @@ void taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes) { ...@@ -696,7 +696,7 @@ void taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes) {
static int64_t cur_receive_bytes = 0; static int64_t cur_receive_bytes = 0;
static int64_t cur_transmit_bytes = 0; static int64_t cur_transmit_bytes = 0;
if (taosGetCardInfo(&cur_receive_bytes, &cur_transmit_bytes) != 0) { if (taosGetCardInfo(&cur_receive_bytes, &cur_transmit_bytes) == 0) {
*receive_bytes = cur_receive_bytes - last_receive_bytes; *receive_bytes = cur_receive_bytes - last_receive_bytes;
*transmit_bytes = cur_transmit_bytes - last_transmit_bytes; *transmit_bytes = cur_transmit_bytes - last_transmit_bytes;
last_receive_bytes = cur_receive_bytes; last_receive_bytes = cur_receive_bytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册