Expose created time and updated time to rootcoord metrics (#8174)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/7738/head
dragondriver 2021-09-17 21:52:00 +08:00 committed by GitHub
parent daf001f683
commit c3eb6f9761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View File

@ -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,

View File

@ -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

View File

@ -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)
}

View File

@ -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
}