diff --git a/internal/rootcoord/metrics_info.go b/internal/rootcoord/metrics_info.go index 1843e3316e..6239b343a4 100644 --- a/internal/rootcoord/metrics_info.go +++ b/internal/rootcoord/metrics_info.go @@ -43,8 +43,9 @@ func (c *Core) getSystemInfoMetrics(ctx context.Context, req *milvuspb.GetMetric SystemVersion: os.Getenv(metricsinfo.GitCommitEnvKey), DeployMode: os.Getenv(metricsinfo.DeployModeEnvKey), }, - // TODO(dragondriver): CreatedTime & UpdatedTime, easy but time-costing - Type: typeutil.RootCoordRole, + CreatedTime: Params.CreatedTime.String(), + UpdatedTime: Params.UpdatedTime.String(), + Type: typeutil.RootCoordRole, }, SystemConfigurations: metricsinfo.RootCoordConfiguration{ MinSegmentSizeToEnableIndex: Params.MinSegmentSizeToEnableIndex, diff --git a/internal/rootcoord/param_table.go b/internal/rootcoord/param_table.go index 8b499aacd5..b2736aa8a0 100644 --- a/internal/rootcoord/param_table.go +++ b/internal/rootcoord/param_table.go @@ -15,6 +15,7 @@ import ( "path" "strings" "sync" + "time" "github.com/milvus-io/milvus/internal/log" "github.com/milvus-io/milvus/internal/util/paramtable" @@ -47,6 +48,9 @@ type ParamTable struct { Timeout int TimeTickInterval int + CreatedTime time.Time + UpdatedTime time.Time + Log log.Config RoleName string diff --git a/internal/rootcoord/param_table_test.go b/internal/rootcoord/param_table_test.go index 981dde781f..a0eb2b9998 100644 --- a/internal/rootcoord/param_table_test.go +++ b/internal/rootcoord/param_table_test.go @@ -13,6 +13,7 @@ package rootcoord import ( "testing" + "time" "github.com/stretchr/testify/assert" ) @@ -58,4 +59,9 @@ func TestParamTable(t *testing.T) { assert.NotZero(t, Params.TimeTickInterval) t.Logf("master timetickerInterval = %d", Params.TimeTickInterval) + + Params.CreatedTime = time.Now() + Params.UpdatedTime = time.Now() + t.Logf("created time: %v", Params.CreatedTime) + t.Logf("updated time: %v", Params.UpdatedTime) } diff --git a/internal/rootcoord/root_coord.go b/internal/rootcoord/root_coord.go index 982d49b126..922a90ff9e 100644 --- a/internal/rootcoord/root_coord.go +++ b/internal/rootcoord/root_coord.go @@ -1111,9 +1111,15 @@ func (c *Core) Start() error { go c.sessionLoop() go c.chanTimeTick.StartWatch(&c.wg) go c.checkFlushedSegmentsLoop() + + Params.CreatedTime = time.Now() + Params.UpdatedTime = time.Now() + c.stateCode.Store(internalpb.StateCode_Healthy) }) + log.Debug(typeutil.RootCoordRole, zap.String("State Code", internalpb.StateCode_name[int32(internalpb.StateCode_Healthy)])) + return nil }