enh/TD-31977-monitor-qid-qid-format-set-dnodeid-when-first-start
This commit is contained in:
parent
f18926bf0d
commit
86c2944ed9
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
} SAuditRecord;
|
} SAuditRecord;
|
||||||
|
|
||||||
int32_t auditInit(const SAuditCfg *pCfg);
|
int32_t auditInit(const SAuditCfg *pCfg);
|
||||||
void auditOpen(int32_t dnodeId);
|
void auditSetDnodeId(int32_t dnodeId);
|
||||||
void auditCleanup();
|
void auditCleanup();
|
||||||
int32_t auditSend(SJson *pJson);
|
int32_t auditSend(SJson *pJson);
|
||||||
void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
||||||
|
|
|
@ -218,7 +218,7 @@ typedef struct {
|
||||||
} SDmNotifyHandle;
|
} SDmNotifyHandle;
|
||||||
|
|
||||||
int32_t monInit(const SMonCfg *pCfg);
|
int32_t monInit(const SMonCfg *pCfg);
|
||||||
void monOpen(int32_t dnodeId);
|
void monSetDnodeId(int32_t dnodeId);
|
||||||
void monInitVnode();
|
void monInitVnode();
|
||||||
void monCleanup();
|
void monCleanup();
|
||||||
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
|
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
|
#include "audit.h"
|
||||||
#include "dmInt.h"
|
#include "dmInt.h"
|
||||||
|
#include "monitor.h"
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
#include "tchecksum.h"
|
#include "tchecksum.h"
|
||||||
|
|
||||||
|
@ -27,6 +29,8 @@ static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
|
||||||
(void)taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
(void)taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
||||||
pMgmt->pData->dnodeId = pCfg->dnodeId;
|
pMgmt->pData->dnodeId = pCfg->dnodeId;
|
||||||
pMgmt->pData->clusterId = pCfg->clusterId;
|
pMgmt->pData->clusterId = pCfg->clusterId;
|
||||||
|
monSetDnodeId(pCfg->dnodeId);
|
||||||
|
auditSetDnodeId(pCfg->dnodeId);
|
||||||
code = dmWriteEps(pMgmt->pData);
|
code = dmWriteEps(pMgmt->pData);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
dInfo("failed to set local info, dnodeId:%d clusterId:%" PRId64 " reason:%s", pCfg->dnodeId, pCfg->clusterId,
|
dInfo("failed to set local info, dnodeId:%d clusterId:%" PRId64 " reason:%s", pCfg->dnodeId, pCfg->clusterId,
|
||||||
|
|
|
@ -101,8 +101,8 @@ static int32_t dmOpenNodes(SDnode *pDnode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auditOpen(dmGetDnodeId(&pDnode->data));
|
auditSetDnodeId(dmGetDnodeId(&pDnode->data));
|
||||||
monOpen(dmGetDnodeId(&pDnode->data));
|
monSetDnodeId(dmGetDnodeId(&pDnode->data));
|
||||||
|
|
||||||
dmSetStatus(pDnode, DND_STAT_RUNNING);
|
dmSetStatus(pDnode, DND_STAT_RUNNING);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -36,7 +36,7 @@ int32_t auditInit(const SAuditCfg *pCfg) {
|
||||||
return taosThreadMutexInit(&tsAudit.lock, NULL);
|
return taosThreadMutexInit(&tsAudit.lock, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void auditOpen(int32_t dnodeId) { tsAudit.dnodeId = dnodeId; }
|
void auditSetDnodeId(int32_t dnodeId) { tsAudit.dnodeId = dnodeId; }
|
||||||
|
|
||||||
static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) {
|
static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) {
|
||||||
if (record) {
|
if (record) {
|
||||||
|
|
|
@ -768,7 +768,7 @@ void monSendPromReport() {
|
||||||
if (pCont != NULL) {
|
if (pCont != NULL) {
|
||||||
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
||||||
char tmp[100] = {0};
|
char tmp[100] = {0};
|
||||||
(void)sprintf(tmp, "%" PRId64, tGenQid64(tsMonitor.dnodeId));
|
(void)sprintf(tmp, "0x%" PRIxLEAST64, tGenQid64(tsMonitor.dnodeId));
|
||||||
uDebug("report cont with QID:%s", tmp);
|
uDebug("report cont with QID:%s", tmp);
|
||||||
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag,
|
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, tsMonFwUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag,
|
||||||
tmp) != 0) {
|
tmp) != 0) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ int32_t monInit(const SMonCfg *pCfg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void monOpen(int32_t dnodeId) { tsMonitor.dnodeId = dnodeId; }
|
void monSetDnodeId(int32_t dnodeId) { tsMonitor.dnodeId = dnodeId; }
|
||||||
|
|
||||||
void monInitVnode() {
|
void monInitVnode() {
|
||||||
if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return;
|
if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return;
|
||||||
|
@ -602,7 +602,7 @@ void monSendReport(SMonInfo *pMonitor) {
|
||||||
if (pCont != NULL) {
|
if (pCont != NULL) {
|
||||||
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
||||||
char tmp[100] = {0};
|
char tmp[100] = {0};
|
||||||
(void)snprintf(tmp, 100, "%" PRId64, tGenQid64(tsMonitor.dnodeId));
|
(void)snprintf(tmp, 100, "0x%" PRIxLEAST64, tGenQid64(tsMonitor.dnodeId));
|
||||||
uDebug("report cont with QID:%s", tmp);
|
uDebug("report cont with QID:%s", tmp);
|
||||||
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, tsMonUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag,
|
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, tsMonUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag,
|
||||||
tmp) != 0) {
|
tmp) != 0) {
|
||||||
|
@ -624,7 +624,7 @@ void monSendReportBasic(SMonInfo *pMonitor) {
|
||||||
if (pCont != NULL) {
|
if (pCont != NULL) {
|
||||||
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
||||||
char tmp[100] = {0};
|
char tmp[100] = {0};
|
||||||
(void)sprintf(tmp, "%" PRId64, tGenQid64(tsMonitor.dnodeId));
|
(void)sprintf(tmp, "0x%" PRIxLEAST64, tGenQid64(tsMonitor.dnodeId));
|
||||||
uDebug("report cont basic with QID:%s", tmp);
|
uDebug("report cont basic with QID:%s", tmp);
|
||||||
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, tsMonFwBasicUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag,
|
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, tsMonFwBasicUri, tsMonitor.cfg.port, pCont, strlen(pCont), flag,
|
||||||
tmp) != 0) {
|
tmp) != 0) {
|
||||||
|
@ -679,7 +679,7 @@ void monSendContent(char *pCont, const char *uri) {
|
||||||
}
|
}
|
||||||
if (pCont != NULL) {
|
if (pCont != NULL) {
|
||||||
char tmp[100] = {0};
|
char tmp[100] = {0};
|
||||||
(void)sprintf(tmp, "%" PRId64, tGenQid64(tsMonitor.dnodeId));
|
(void)sprintf(tmp, "0x%" PRIxLEAST64, tGenQid64(tsMonitor.dnodeId));
|
||||||
uInfoL("report client cont with QID:%s", tmp);
|
uInfoL("report client cont with QID:%s", tmp);
|
||||||
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
||||||
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, uri, tsMonitor.cfg.port, pCont, strlen(pCont), flag, tmp) !=
|
if (taosSendHttpReportWithQID(tsMonitor.cfg.server, uri, tsMonitor.cfg.port, pCont, strlen(pCont), flag, tmp) !=
|
||||||
|
|
Loading…
Reference in New Issue