add cluster id for monitor
This commit is contained in:
parent
514f9f6626
commit
52c1df5f78
|
@ -32,6 +32,8 @@ extern "C" {
|
|||
typedef struct {
|
||||
int32_t dnode_id;
|
||||
char dnode_ep[TSDB_EP_LEN];
|
||||
int64_t cluster_id;
|
||||
int32_t protocol;
|
||||
} SMonBasicInfo;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -477,6 +477,8 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pReq) {
|
|||
static void dndGetMonitorBasicInfo(SDnode *pDnode, SMonBasicInfo *pInfo) {
|
||||
pInfo->dnode_id = dndGetDnodeId(pDnode);
|
||||
tstrncpy(pInfo->dnode_ep, tsLocalEp, TSDB_EP_LEN);
|
||||
pInfo->cluster_id = dndGetClusterId(pDnode);
|
||||
pInfo->protocol = 1;
|
||||
}
|
||||
|
||||
static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
|
||||
|
|
|
@ -99,6 +99,9 @@ void monSetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo) {
|
|||
tjsonAddStringToObject(pJson, "ts", buf);
|
||||
tjsonAddDoubleToObject(pJson, "dnode_id", pInfo->dnode_id);
|
||||
tjsonAddStringToObject(pJson, "dnode_ep", pInfo->dnode_ep);
|
||||
snprintf(buf, sizeof(buf), "%" PRId64, pInfo->cluster_id);
|
||||
tjsonAddStringToObject(pJson, "cluster_id", buf);
|
||||
tjsonAddDoubleToObject(pJson, "protocol", pInfo->protocol);
|
||||
}
|
||||
|
||||
void monSetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo) {
|
||||
|
|
|
@ -22,6 +22,7 @@ class MonitorTest : public ::testing::Test {
|
|||
cfg.maxLogs = 2;
|
||||
cfg.port = 80;
|
||||
cfg.server = "localhost";
|
||||
cfg.comp = 0;
|
||||
monInit(&cfg);
|
||||
}
|
||||
|
||||
|
@ -44,6 +45,8 @@ class MonitorTest : public ::testing::Test {
|
|||
void MonitorTest::GetBasicInfo(SMonInfo *pMonitor, SMonBasicInfo *pInfo) {
|
||||
pInfo->dnode_id = 1;
|
||||
strcpy(pInfo->dnode_ep, "localhost");
|
||||
pInfo->cluster_id = 6980428120398645172;
|
||||
pInfo->protocol = 1;
|
||||
}
|
||||
|
||||
void MonitorTest::GetClusterInfo(SMonInfo *pMonitor, SMonClusterInfo *pInfo) {
|
||||
|
|
Loading…
Reference in New Issue