fix/TD-31520-move-to-vnode-init-stage

This commit is contained in:
dmchen 2024-08-21 07:54:39 +00:00
parent bdabe66aab
commit 48055beb1f
4 changed files with 11 additions and 5 deletions

View File

@ -218,6 +218,7 @@ typedef struct {
} SDmNotifyHandle;
int32_t monInit(const SMonCfg *pCfg);
void monInitVnode();
void monCleanup();
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
int32_t monGetLogs(SMonLogs *logs);

View File

@ -14,6 +14,7 @@
*/
#include "cos.h"
#include "monitor.h"
#include "vnd.h"
static volatile int32_t VINIT = 0;
@ -26,6 +27,8 @@ int vnodeInit(int nthreads, StopDnodeFp stopDnodeFp) {
TAOS_CHECK_RETURN(vnodeAsyncOpen(nthreads));
TAOS_CHECK_RETURN(walInit(stopDnodeFp));
monInitVnode();
return 0;
}

View File

@ -1904,8 +1904,8 @@ _exit:
(void)atomic_add_fetch_64(&pVnode->statis.nInsertSuccess, pSubmitRsp->affectedRows);
(void)atomic_add_fetch_64(&pVnode->statis.nBatchInsert, 1);
if (tsEnableMonitor && pSubmitRsp->affectedRows > 0 && strlen(pOriginalMsg->info.conn.user) > 0 &&
tsInsertCounter != NULL) {
if (tsEnableMonitor && tsMonitorFqdn[0] != 0 && tsMonitorPort != 0 && pSubmitRsp->affectedRows > 0 &&
strlen(pOriginalMsg->info.conn.user) > 0 && tsInsertCounter != NULL) {
const char *sample_labels[] = {VNODE_METRIC_TAG_VALUE_INSERT_AFFECTED_ROWS,
pVnode->monitor.strClusterId,
pVnode->monitor.strDnodeId,

View File

@ -128,7 +128,11 @@ int32_t monInit(const SMonCfg *pCfg) {
monInitMonitorFW();
if (tsEnableMonitor && tsInsertCounter == NULL) {
return 0;
}
void monInitVnode() {
if (tsEnableMonitor && tsMonitorFqdn[0] != 0 && tsMonitorPort != 0 && tsInsertCounter == NULL) {
taos_counter_t *counter = NULL;
int32_t label_count = 7;
const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID,
@ -147,8 +151,6 @@ int32_t monInit(const SMonCfg *pCfg) {
} else {
uError("failed to set insert counter, already set");
}
return 0;
}
void monCleanup() {