Expose created time and updated time to indexcoord metrics (#8591)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/8212/head
dragondriver 2021-09-26 17:54:06 +08:00 committed by GitHub
parent 28aed84036
commit 0d41efe154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -250,6 +250,9 @@ func (i *IndexCoord) Start() error {
cb()
}
Params.CreatedTime = time.Now()
Params.UpdatedTime = time.Now()
i.UpdateStateCode(internalpb.StateCode_Healthy)
log.Debug("IndexCoord start successfully", zap.Any("State", i.stateCode.Load()))

View File

@ -50,8 +50,9 @@ func getSystemInfoMetrics(
SystemVersion: os.Getenv(metricsinfo.GitCommitEnvKey),
DeployMode: os.Getenv(metricsinfo.DeployModeEnvKey),
},
// TODO(dragondriver): CreatedTime & UpdatedTime, easy but time-costing
Type: typeutil.IndexCoordRole,
CreatedTime: Params.CreatedTime.String(),
UpdatedTime: Params.UpdatedTime.String(),
Type: typeutil.IndexCoordRole,
},
SystemConfigurations: metricsinfo.IndexCoordConfiguration{
MinioBucketName: Params.MinioBucketName,

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"
@ -37,6 +38,9 @@ type ParamTable struct {
MinIOUseSSL bool
MinioBucketName string
CreatedTime time.Time
UpdatedTime time.Time
Log log.Config
}

View File

@ -13,6 +13,7 @@ package indexcoord
import (
"testing"
"time"
)
func TestParamTable(t *testing.T) {
@ -57,6 +58,16 @@ func TestParamTable(t *testing.T) {
t.Run("MinioBucketName", func(t *testing.T) {
t.Logf("MinioBucketName: %v", Params.MinioBucketName)
})
t.Run("CreatedTime", func(t *testing.T) {
Params.CreatedTime = time.Now()
t.Logf("CreatedTime: %v", Params.CreatedTime)
})
t.Run("UpdatedTime", func(t *testing.T) {
Params.UpdatedTime = time.Now()
t.Logf("UpdatedTime: %v", Params.UpdatedTime)
})
}
//TODO: Params Load should be return error when key does not exist.