Expose created time and updated time to datanode metrics (#8173)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
dragondriver 2021-09-17 21:32:47 +08:00 committed by GitHub
parent 57e46c5f2c
commit daf001f683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View File

@ -159,6 +159,7 @@ func (node *DataNode) Register() error {
log.Debug("DataNode Init",
zap.String("MsgChannelSubName", Params.MsgChannelSubName),
)
return nil
}
@ -342,6 +343,10 @@ func (node *DataNode) Start() error {
FilterThreshold = rep.GetTimestamp()
go node.BackGroundGC(node.clearSignal)
Params.CreatedTime = time.Now()
Params.UpdatedTime = time.Now()
node.UpdateStateCode(internalpb.StateCode_Healthy)
return nil
}

View File

@ -39,8 +39,9 @@ func (node *DataNode) getSystemInfoMetrics(ctx context.Context, req *milvuspb.Ge
SystemVersion: os.Getenv(metricsinfo.GitCommitEnvKey),
DeployMode: os.Getenv(metricsinfo.DeployModeEnvKey),
},
// TODO(dragondriver): CreatedTime & UpdatedTime, easy but time-costing
Type: typeutil.DataNodeRole,
CreatedTime: Params.CreatedTime.String(),
UpdatedTime: Params.UpdatedTime.String(),
Type: typeutil.DataNodeRole,
},
SystemConfigurations: metricsinfo.DataNodeConfiguration{
FlushInsertBufferSize: Params.FlushInsertBufferSize,

View File

@ -16,6 +16,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/util/paramtable"
@ -62,6 +63,9 @@ type ParamTable struct {
MinioSecretAccessKey string
MinioUseSSL bool
MinioBucketName string
CreatedTime time.Time
UpdatedTime time.Time
}
var Params ParamTable

View File

@ -14,6 +14,7 @@ package datanode
import (
"log"
"testing"
"time"
)
func TestParamTable_DataNode(t *testing.T) {
@ -98,4 +99,14 @@ func TestParamTable_DataNode(t *testing.T) {
name := Params.MinioBucketName
log.Println("MinioBucketName:", name)
})
t.Run("Test CreatedTime", func(t *testing.T) {
Params.CreatedTime = time.Now()
log.Println("CreatedTime: ", Params.CreatedTime)
})
t.Run("Test UpdatedTime", func(t *testing.T) {
Params.UpdatedTime = time.Now()
log.Println("UpdatedTime: ", Params.UpdatedTime)
})
}