[TD-5861]<feature>:add uptime and dnodeId
This commit is contained in:
parent
0d532d15de
commit
2659b46e16
|
@ -41,6 +41,7 @@ extern char tsArbitrator[];
|
|||
extern int8_t tsArbOnline;
|
||||
extern int64_t tsArbOnlineTimestamp;
|
||||
extern int32_t tsDnodeId;
|
||||
extern int64_t tsDnodeStartTime;
|
||||
|
||||
// common
|
||||
extern int tsRpcTimer;
|
||||
|
|
|
@ -46,6 +46,7 @@ int8_t tsArbOnline = 0;
|
|||
int64_t tsArbOnlineTimestamp = TSDB_ARB_DUMMY_TIME;
|
||||
char tsEmail[TSDB_FQDN_LEN] = {0};
|
||||
int32_t tsDnodeId = 0;
|
||||
int64_t tsDnodeStartTime = 0;
|
||||
|
||||
// common
|
||||
int32_t tsRpcTimer = 300;
|
||||
|
|
|
@ -195,6 +195,7 @@ int32_t dnodeInitSystem() {
|
|||
dnodeSetRunStatus(TSDB_RUN_STATUS_RUNING);
|
||||
moduleStart();
|
||||
|
||||
tsDnodeStartTime = taosGetTimestampMs();
|
||||
dnodeReportStep("TDengine", "initialized successfully", 1);
|
||||
dInfo("TDengine is initialized successfully");
|
||||
|
||||
|
|
|
@ -30,6 +30,21 @@ bool metricsProcessRequest(HttpContext* pContext) {
|
|||
httpWriteJsonBufHead(jsonBuf);
|
||||
|
||||
httpJsonToken(jsonBuf, JsonObjStt);
|
||||
{
|
||||
int32_t dnodeId = dnodeGetDnodeId();
|
||||
char* keyDnodeId = "dnode_id";
|
||||
httpJsonPairIntVal(jsonBuf, keyDnodeId, strlen(keyDnodeId), dnodeId);
|
||||
}
|
||||
|
||||
{
|
||||
if (tsDnodeStartTime != 0) {
|
||||
int64_t now = taosGetTimestampMs();
|
||||
int64_t upTime = now-tsDnodeStartTime;
|
||||
char* keyUpTime = "up_time";
|
||||
httpJsonPairInt64Val(jsonBuf, keyUpTime, strlen(keyUpTime), upTime);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int32_t cpuCores = taosGetCpuCores();
|
||||
char* keyCpuCores = "cpu_cores";
|
||||
|
|
Loading…
Reference in New Issue