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