From b552a16743405d61b76e6a7f3c20295e9177ff5a Mon Sep 17 00:00:00 2001 From: facetosea <25808407@qq.com> Date: Fri, 2 Feb 2024 14:52:12 +0800 Subject: [PATCH] fix: monitor switch --- source/client/src/clientSqlMonitor.c | 2 ++ source/client/src/slowQueryMonitor.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/client/src/clientSqlMonitor.c b/source/client/src/clientSqlMonitor.c index 2f8aa1db5d..911d589096 100644 --- a/source/client/src/clientSqlMonitor.c +++ b/source/client/src/clientSqlMonitor.c @@ -24,6 +24,7 @@ const char* selectMonitorLabels[] = {"cluster_id", "sql_type", "username", "resu static const char* defaultClusterID = ""; void clusterSelectMonitorInit(const char* clusterKey) { + if (!tsEnableMonitor) return; SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey); SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); clusterMonitorInit(clusterKey, epSet, pAppInstInfo->pTransporter); @@ -36,6 +37,7 @@ void clusterSelectLog(const char* clusterKey, const char* user, SQL_RESULT_CODE } void selectLog(int64_t rid, bool killed, int32_t code) { + if (!tsEnableMonitor) return; SQL_RESULT_CODE result = SQL_RESULT_SUCCESS; if (TSDB_CODE_SUCCESS != code) { result = SQL_RESULT_FAILED; diff --git a/source/client/src/slowQueryMonitor.c b/source/client/src/slowQueryMonitor.c index 0818aaeae4..98785205b9 100644 --- a/source/client/src/slowQueryMonitor.c +++ b/source/client/src/slowQueryMonitor.c @@ -42,7 +42,7 @@ static const char* getSlowQueryLableCostDesc(int64_t cost) { } void clusterSlowQueryMonitorInit(const char* clusterKey) { - if (!enableSlowQueryMonitor) return; + if (!tsEnableMonitor || !enableSlowQueryMonitor) return; SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey); SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); clusterMonitorInit(clusterKey, epSet, pAppInstInfo->pTransporter); @@ -55,7 +55,7 @@ void clusterSlowQueryLog(const char* clusterKey, const char* user, SQL_RESULT_CO } void SlowQueryLog(int64_t rid, bool killed, int32_t code, int32_t cost) { - if (!enableSlowQueryMonitor) return; + if (!tsEnableMonitor || !enableSlowQueryMonitor) return; SQL_RESULT_CODE result = SQL_RESULT_SUCCESS; if (TSDB_CODE_SUCCESS != code) { result = SQL_RESULT_FAILED;