From c6024a32f5d9fe85ca0e8e369dc5428906e4308f Mon Sep 17 00:00:00 2001 From: "yihao.dai" Date: Sun, 3 Sep 2023 20:47:02 +0800 Subject: [PATCH] Add rate limit ratio monitoring (#26709) Signed-off-by: bigsheeper --- internal/rootcoord/quota_center.go | 1 + pkg/metrics/rootcoord_metrics.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/internal/rootcoord/quota_center.go b/internal/rootcoord/quota_center.go index f5291bb6e6..d2931ae853 100644 --- a/internal/rootcoord/quota_center.go +++ b/internal/rootcoord/quota_center.go @@ -456,6 +456,7 @@ func (q *QuotaCenter) calculateWriteRates() error { updateCollectionFactor(growingSegFactors) for collection, factor := range collectionFactors { + metrics.RootCoordRateLimitRatio.WithLabelValues(fmt.Sprint(collection)).Set(1 - factor) if factor <= 0 { if _, ok := ttFactors[collection]; ok && factor == ttFactors[collection] { // factor comes from ttFactor diff --git a/pkg/metrics/rootcoord_metrics.go b/pkg/metrics/rootcoord_metrics.go index d29f667b95..1ce0e94a68 100644 --- a/pkg/metrics/rootcoord_metrics.go +++ b/pkg/metrics/rootcoord_metrics.go @@ -169,6 +169,15 @@ var ( "quota_states", }) + // RootCoordRateLimitRatio reflects the ratio of rate limit. + RootCoordRateLimitRatio = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: milvusNamespace, + Subsystem: typeutil.RootCoordRole, + Name: "rate_limit_ratio", + Help: "", + }, []string{collectionIDLabelName}) + RootCoordDDLReqLatencyInQueue = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: milvusNamespace, @@ -208,5 +217,6 @@ func RegisterRootCoord(registry *prometheus.Registry) { registry.MustRegister(RootCoordNumOfRoles) registry.MustRegister(RootCoordTtDelay) registry.MustRegister(RootCoordQuotaStates) + registry.MustRegister(RootCoordRateLimitRatio) registry.MustRegister(RootCoordDDLReqLatencyInQueue) }