fix: monitor switch

This commit is contained in:
facetosea 2024-02-02 14:52:12 +08:00
parent 75539fb908
commit b552a16743
2 changed files with 4 additions and 2 deletions

View File

@ -24,6 +24,7 @@ const char* selectMonitorLabels[] = {"cluster_id", "sql_type", "username", "resu
static const char* defaultClusterID = ""; static const char* defaultClusterID = "";
void clusterSelectMonitorInit(const char* clusterKey) { void clusterSelectMonitorInit(const char* clusterKey) {
if (!tsEnableMonitor) return;
SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey); SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey);
SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp);
clusterMonitorInit(clusterKey, epSet, pAppInstInfo->pTransporter); 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) { void selectLog(int64_t rid, bool killed, int32_t code) {
if (!tsEnableMonitor) return;
SQL_RESULT_CODE result = SQL_RESULT_SUCCESS; SQL_RESULT_CODE result = SQL_RESULT_SUCCESS;
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
result = SQL_RESULT_FAILED; result = SQL_RESULT_FAILED;

View File

@ -42,7 +42,7 @@ static const char* getSlowQueryLableCostDesc(int64_t cost) {
} }
void clusterSlowQueryMonitorInit(const char* clusterKey) { void clusterSlowQueryMonitorInit(const char* clusterKey) {
if (!enableSlowQueryMonitor) return; if (!tsEnableMonitor || !enableSlowQueryMonitor) return;
SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey); SAppInstInfo* pAppInstInfo = getAppInstInfo(clusterKey);
SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp);
clusterMonitorInit(clusterKey, epSet, pAppInstInfo->pTransporter); 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) { 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; SQL_RESULT_CODE result = SQL_RESULT_SUCCESS;
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
result = SQL_RESULT_FAILED; result = SQL_RESULT_FAILED;