fix: get tscobj by rid
This commit is contained in:
parent
ab12d110c0
commit
6b7a5b2910
|
@ -430,7 +430,7 @@ int32_t clientParseSqlImpl(void* param, const char* dbName, const char* sql, boo
|
|||
|
||||
void clusterSlowQueryMonitorInit(const char* clusterKey);
|
||||
void clusterSlowQueryLog(const char* clusterKey, int32_t cost);
|
||||
void SlowQueryLog(int64_t connId, int32_t cost);
|
||||
void SlowQueryLog(int64_t rid, int32_t cost);
|
||||
|
||||
void clusterSelectMonitorInit(const char* clusterKey);
|
||||
void clusterSelectLog(const char* clusterKey);
|
||||
|
|
|
@ -114,7 +114,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
|
|||
taosPrintSlowLog("PID:%d, Conn:%u, QID:0x%" PRIx64 ", Start:%" PRId64 ", Duration:%" PRId64 "us, SQL:%s",
|
||||
taosGetPId(), pTscObj->connId, pRequest->requestId, pRequest->metric.start, duration,
|
||||
pRequest->sqlstr);
|
||||
SlowQueryLog(pTscObj->connId, duration);
|
||||
SlowQueryLog(pTscObj->id, duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ void clusterSelectLog(const char* clusterKey) {
|
|||
taosClusterCounterInc(clusterKey, selectMonitorName, selectMonitorLabelValues);
|
||||
}
|
||||
|
||||
void selectLog(int64_t connId) {
|
||||
STscObj* pTscObj = acquireTscObj(connId);
|
||||
void selectLog(int64_t rid) {
|
||||
STscObj* pTscObj = acquireTscObj(rid);
|
||||
if (pTscObj != NULL) {
|
||||
if(pTscObj->pAppInfo == NULL) {
|
||||
tscLog("selectLog, not found pAppInfo");
|
||||
}
|
||||
return clusterSelectLog(pTscObj->pAppInfo->instKey);
|
||||
} else {
|
||||
tscLog("selectLog, not found connect ID");
|
||||
tscLog("selectLog, not found rid");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,15 +59,15 @@ void clusterSlowQueryLog(const char* clusterKey, int32_t cost) {
|
|||
taosClusterCounterInc(clusterKey, slowQueryName, slowQueryLabelValues);
|
||||
}
|
||||
|
||||
void SlowQueryLog(int64_t connId, int32_t cost) {
|
||||
void SlowQueryLog(int64_t rid, int32_t cost) {
|
||||
if (!enableSlowQueryMonitor) return;
|
||||
STscObj* pTscObj = acquireTscObj(connId);
|
||||
STscObj* pTscObj = acquireTscObj(rid);
|
||||
if (pTscObj != NULL) {
|
||||
if(pTscObj->pAppInfo == NULL) {
|
||||
tscLog("SlowQueryLog, not found pAppInfo");
|
||||
}
|
||||
return clusterSlowQueryLog(pTscObj->pAppInfo->instKey, cost);
|
||||
} else {
|
||||
tscLog("SlowQueryLog, not found connect ID");
|
||||
tscLog("SlowQueryLog, not found rid");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,11 +68,11 @@ TEST(clientMonitorTest, sendTest) {
|
|||
ASSERT_TRUE(taos != NULL);
|
||||
printf("connect taosd sucessfully.\n");
|
||||
|
||||
int64_t connId = *(int64_t *)taos;
|
||||
SlowQueryLog(connId, 1000);
|
||||
int64_t rid = *(int64_t *)taos;
|
||||
SlowQueryLog(rid, 1000);
|
||||
int i = 0;
|
||||
while (i < 20) {
|
||||
SlowQueryLog(connId, i * 1000);
|
||||
SlowQueryLog(rid, i * 1000);
|
||||
taosMsleep(10);
|
||||
++i;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue