Register metrics before component start (#27744)

Signed-off-by: wayblink <anyang.wang@zilliz.com>
pull/27804/head
wayblink 2023-10-19 17:14:10 +08:00 committed by GitHub
parent 635efdf170
commit aa1fba79b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -250,6 +250,7 @@ func (mr *MilvusRoles) setupLogger() {
// Register serves prometheus http service
func setupPrometheusHTTPServer(r *internalmetrics.MilvusRegistry) {
log.Info("setupPrometheusHTTPServer")
http.Register(&http.Handler{
Path: "/metrics",
Handler: promhttp.HandlerFor(r, promhttp.HandlerOpts{}),
@ -338,6 +339,7 @@ func (mr *MilvusRoles) Run() {
}
http.ServeHTTP()
setupPrometheusHTTPServer(Registry)
var wg sync.WaitGroup
local := mr.Local
@ -380,7 +382,6 @@ func (mr *MilvusRoles) Run() {
mr.setupLogger()
tracer.Init()
setupPrometheusHTTPServer(Registry)
paramtable.SetCreateTime(time.Now())
paramtable.SetUpdateTime(time.Now())