mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-02 01:06:41 +08:00
Refine QueryCoordV2 metrics (#20471)
Signed-off-by: yah01 <yang.cen@zilliz.com> Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
parent
14a544d631
commit
ea45a2aa4b
@ -77,29 +77,12 @@ var (
|
||||
Buckets: []float64{0, 5, 10, 20, 40, 100, 200, 400, 1000, 10000},
|
||||
}, []string{})
|
||||
|
||||
QueryCoordNumChildTasks = prometheus.NewGaugeVec(
|
||||
QueryCoordTaskNum = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: milvusNamespace,
|
||||
Subsystem: typeutil.QueryCoordRole,
|
||||
Name: "child_task_num",
|
||||
Help: "number of child tasks in QueryCoord's queue",
|
||||
}, []string{})
|
||||
|
||||
QueryCoordNumParentTasks = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: milvusNamespace,
|
||||
Subsystem: typeutil.QueryCoordRole,
|
||||
Name: "parent_task_num",
|
||||
Help: "number of parent tasks in QueryCoord's queue",
|
||||
}, []string{})
|
||||
|
||||
QueryCoordChildTaskLatency = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: milvusNamespace,
|
||||
Subsystem: typeutil.QueryCoordRole,
|
||||
Name: "child_task_latency",
|
||||
Help: "latency of child tasks",
|
||||
Buckets: buckets,
|
||||
Name: "task_num",
|
||||
Help: "the number of tasks in QueryCoord's scheduler",
|
||||
}, []string{})
|
||||
|
||||
QueryCoordNumQueryNodes = prometheus.NewGaugeVec(
|
||||
@ -119,8 +102,6 @@ func RegisterQueryCoord(registry *prometheus.Registry) {
|
||||
registry.MustRegister(QueryCoordReleaseCount)
|
||||
registry.MustRegister(QueryCoordLoadLatency)
|
||||
registry.MustRegister(QueryCoordReleaseLatency)
|
||||
registry.MustRegister(QueryCoordNumChildTasks)
|
||||
registry.MustRegister(QueryCoordNumParentTasks)
|
||||
registry.MustRegister(QueryCoordChildTaskLatency)
|
||||
registry.MustRegister(QueryCoordTaskNum)
|
||||
registry.MustRegister(QueryCoordNumQueryNodes)
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/metrics"
|
||||
"github.com/milvus-io/milvus/internal/proto/querypb"
|
||||
"github.com/milvus-io/milvus/internal/querycoordv2/meta"
|
||||
"github.com/milvus-io/milvus/internal/querycoordv2/observers"
|
||||
@ -235,6 +236,7 @@ func (job *LoadCollectionJob) Execute() error {
|
||||
return utils.WrapError(msg, err)
|
||||
}
|
||||
|
||||
metrics.QueryCoordNumCollections.WithLabelValues().Inc()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -299,6 +301,7 @@ func (job *ReleaseCollectionJob) Execute() error {
|
||||
|
||||
job.targetMgr.RemoveCollection(req.GetCollectionID())
|
||||
waitCollectionReleased(job.dist, req.GetCollectionID())
|
||||
metrics.QueryCoordNumCollections.WithLabelValues().Dec()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -443,6 +446,7 @@ func (job *LoadPartitionJob) Execute() error {
|
||||
return utils.WrapError(msg, err)
|
||||
}
|
||||
|
||||
metrics.QueryCoordNumCollections.WithLabelValues().Inc()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -538,5 +542,6 @@ func (job *ReleasePartitionJob) Execute() error {
|
||||
}
|
||||
waitCollectionReleased(job.dist, req.GetCollectionID(), toRelease...)
|
||||
}
|
||||
metrics.QueryCoordNumCollections.WithLabelValues().Dec()
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/metrics"
|
||||
"github.com/samber/lo"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"go.uber.org/zap"
|
||||
@ -251,6 +252,8 @@ func (s *Server) initMeta() error {
|
||||
log.Error("failed to recover collections")
|
||||
return err
|
||||
}
|
||||
metrics.QueryCoordNumCollections.WithLabelValues().Set(float64(len(s.meta.GetAll())))
|
||||
|
||||
err = s.meta.ReplicaManager.Recover()
|
||||
if err != nil {
|
||||
log.Error("failed to recover replicas")
|
||||
|
||||
@ -16,7 +16,11 @@
|
||||
|
||||
package session
|
||||
|
||||
import "sync"
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/metrics"
|
||||
)
|
||||
|
||||
type Manager interface {
|
||||
Add(node *NodeInfo)
|
||||
@ -34,12 +38,14 @@ func (m *NodeManager) Add(node *NodeInfo) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
m.nodes[node.ID()] = node
|
||||
metrics.QueryCoordNumQueryNodes.WithLabelValues().Set(float64(len(m.nodes)))
|
||||
}
|
||||
|
||||
func (m *NodeManager) Remove(nodeID int64) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
delete(m.nodes, nodeID)
|
||||
metrics.QueryCoordNumQueryNodes.WithLabelValues().Set(float64(len(m.nodes)))
|
||||
}
|
||||
|
||||
func (m *NodeManager) Get(nodeID int64) *NodeInfo {
|
||||
|
||||
@ -23,6 +23,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/metrics"
|
||||
"github.com/milvus-io/milvus/internal/proto/querypb"
|
||||
"github.com/milvus-io/milvus/internal/querycoordv2/meta"
|
||||
"github.com/milvus-io/milvus/internal/querycoordv2/session"
|
||||
@ -230,6 +231,7 @@ func (scheduler *taskScheduler) Add(task Task) error {
|
||||
log.Warn("failed to add task", zap.String("task", task.String()))
|
||||
return nil
|
||||
}
|
||||
metrics.QueryCoordTaskNum.WithLabelValues().Set(float64(scheduler.tasks.Len()))
|
||||
log.Info("task added", zap.String("task", task.String()))
|
||||
return nil
|
||||
}
|
||||
@ -574,6 +576,7 @@ func (scheduler *taskScheduler) remove(task Task) {
|
||||
log = log.With(zap.String("channel", task.Channel()))
|
||||
}
|
||||
|
||||
metrics.QueryCoordTaskNum.WithLabelValues().Set(float64(scheduler.tasks.Len()))
|
||||
log.Debug("task removed")
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user