mirror of https://github.com/milvus-io/milvus.git
Remove the collectionID label from metrics (#16571)
Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>pull/16675/head
parent
4855ba6fa3
commit
a3f7bb5f2d
|
@ -297,8 +297,8 @@ var (
|
||||||
Namespace: milvusNamespace,
|
Namespace: milvusNamespace,
|
||||||
Subsystem: typeutil.RootCoordRole,
|
Subsystem: typeutil.RootCoordRole,
|
||||||
Name: "num_of_partitions",
|
Name: "num_of_partitions",
|
||||||
Help: "The number of partitions per collection",
|
Help: "The number of partitions",
|
||||||
}, []string{collectionIDLabelName})
|
}, []string{})
|
||||||
|
|
||||||
// RootCoordNumOfSegments counts the number of segments per collections.
|
// RootCoordNumOfSegments counts the number of segments per collections.
|
||||||
RootCoordNumOfSegments = prometheus.NewGaugeVec(
|
RootCoordNumOfSegments = prometheus.NewGaugeVec(
|
||||||
|
@ -306,8 +306,8 @@ var (
|
||||||
Namespace: milvusNamespace,
|
Namespace: milvusNamespace,
|
||||||
Subsystem: typeutil.RootCoordRole,
|
Subsystem: typeutil.RootCoordRole,
|
||||||
Name: "num_of_segments",
|
Name: "num_of_segments",
|
||||||
Help: "The number of segments per collection",
|
Help: "The number of segments",
|
||||||
}, []string{collectionIDLabelName})
|
}, []string{})
|
||||||
|
|
||||||
// RootCoordNumOfIndexedSegments counts the number of indexed segments per collection.
|
// RootCoordNumOfIndexedSegments counts the number of indexed segments per collection.
|
||||||
RootCoordNumOfIndexedSegments = prometheus.NewGaugeVec(
|
RootCoordNumOfIndexedSegments = prometheus.NewGaugeVec(
|
||||||
|
@ -315,8 +315,8 @@ var (
|
||||||
Namespace: milvusNamespace,
|
Namespace: milvusNamespace,
|
||||||
Subsystem: typeutil.RootCoordRole,
|
Subsystem: typeutil.RootCoordRole,
|
||||||
Name: "num_of_indexed_segments",
|
Name: "num_of_indexed_segments",
|
||||||
Help: "The number of indexed segments per collection",
|
Help: "The number of indexed segments",
|
||||||
}, []string{collectionIDLabelName})
|
}, []string{})
|
||||||
|
|
||||||
// RootCoordNumOfDMLChannel counts the number of DML channels.
|
// RootCoordNumOfDMLChannel counts the number of DML channels.
|
||||||
RootCoordNumOfDMLChannel = prometheus.NewGauge(
|
RootCoordNumOfDMLChannel = prometheus.NewGauge(
|
||||||
|
@ -384,8 +384,8 @@ func RegisterRootCoord(registry *prometheus.Registry) {
|
||||||
// for collection
|
// for collection
|
||||||
registry.MustRegister(RootCoordNumOfCollections)
|
registry.MustRegister(RootCoordNumOfCollections)
|
||||||
registry.MustRegister(RootCoordNumOfPartitions)
|
registry.MustRegister(RootCoordNumOfPartitions)
|
||||||
registry.MustRegister(RootCoordNumOfSegments)
|
// registry.MustRegister(RootCoordNumOfSegments)
|
||||||
registry.MustRegister(RootCoordNumOfIndexedSegments)
|
// registry.MustRegister(RootCoordNumOfIndexedSegments)
|
||||||
|
|
||||||
registry.MustRegister(RootCoordNumOfDMLChannel)
|
registry.MustRegister(RootCoordNumOfDMLChannel)
|
||||||
registry.MustRegister(RootCoordNumOfMsgStream)
|
registry.MustRegister(RootCoordNumOfMsgStream)
|
||||||
|
|
|
@ -777,7 +777,6 @@ func (dct *dropCollectionTask) Execute(ctx context.Context) error {
|
||||||
|
|
||||||
_ = dct.chMgr.removeDMLStream(collID)
|
_ = dct.chMgr.removeDMLStream(collID)
|
||||||
_ = dct.chMgr.removeDQLStream(collID)
|
_ = dct.chMgr.removeDQLStream(collID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,14 +77,6 @@ type DdOperation struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
// MetricRequestsTotal used to count the num of total requests
|
|
||||||
MetricRequestsTotal = "total"
|
|
||||||
|
|
||||||
// MetricRequestsSuccess used to count the num of successful requests
|
|
||||||
MetricRequestsSuccess = "success"
|
|
||||||
)
|
|
||||||
|
|
||||||
func metricProxy(v int64) string {
|
func metricProxy(v int64) string {
|
||||||
return fmt.Sprintf("client_%d", v)
|
return fmt.Sprintf("client_%d", v)
|
||||||
}
|
}
|
||||||
|
@ -467,7 +459,6 @@ func (c *Core) getSegments(ctx context.Context, collID typeutil.UniqueID) (map[t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics.RootCoordNumOfSegments.WithLabelValues(strconv.FormatInt(collID, 10)).Set(float64(len(segID2PartID)))
|
|
||||||
return segID2PartID, nil
|
return segID2PartID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1534,7 +1525,7 @@ func (c *Core) DescribeCollection(ctx context.Context, in *milvuspb.DescribeColl
|
||||||
|
|
||||||
// ShowCollections list all collection names
|
// ShowCollections list all collection names
|
||||||
func (c *Core) ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error) {
|
func (c *Core) ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error) {
|
||||||
metrics.RootCoordShowCollectionsCounter.WithLabelValues(MetricRequestsTotal).Inc()
|
metrics.RootCoordShowCollectionsCounter.WithLabelValues(metrics.TotalLabel).Inc()
|
||||||
if code, ok := c.checkHealthy(); !ok {
|
if code, ok := c.checkHealthy(); !ok {
|
||||||
return &milvuspb.ShowCollectionsResponse{
|
return &milvuspb.ShowCollectionsResponse{
|
||||||
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "StateCode="+internalpb.StateCode_name[int32(code)]),
|
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "StateCode="+internalpb.StateCode_name[int32(code)]),
|
||||||
|
@ -1564,7 +1555,7 @@ func (c *Core) ShowCollections(ctx context.Context, in *milvuspb.ShowCollections
|
||||||
zap.String("dbname", in.DbName), zap.Int("num of collections", len(t.Rsp.CollectionNames)),
|
zap.String("dbname", in.DbName), zap.Int("num of collections", len(t.Rsp.CollectionNames)),
|
||||||
zap.Int64("msgID", in.Base.MsgID))
|
zap.Int64("msgID", in.Base.MsgID))
|
||||||
|
|
||||||
metrics.RootCoordShowCollectionsCounter.WithLabelValues(MetricRequestsSuccess).Inc()
|
metrics.RootCoordShowCollectionsCounter.WithLabelValues(metrics.SuccessLabel).Inc()
|
||||||
t.Rsp.Status = succStatus()
|
t.Rsp.Status = succStatus()
|
||||||
metrics.RootCoordDDLReadTypeLatency.WithLabelValues("ShowCollections").Observe(float64(tr.ElapseSpan().Milliseconds()))
|
metrics.RootCoordDDLReadTypeLatency.WithLabelValues("ShowCollections").Observe(float64(tr.ElapseSpan().Milliseconds()))
|
||||||
return t.Rsp, nil
|
return t.Rsp, nil
|
||||||
|
@ -1600,7 +1591,7 @@ func (c *Core) CreatePartition(ctx context.Context, in *milvuspb.CreatePartition
|
||||||
|
|
||||||
metrics.RootCoordCreatePartitionCounter.WithLabelValues(metrics.SuccessLabel).Inc()
|
metrics.RootCoordCreatePartitionCounter.WithLabelValues(metrics.SuccessLabel).Inc()
|
||||||
metrics.RootCoordDDLWriteTypeLatency.WithLabelValues("CreatePartition").Observe(float64(tr.ElapseSpan().Milliseconds()))
|
metrics.RootCoordDDLWriteTypeLatency.WithLabelValues("CreatePartition").Observe(float64(tr.ElapseSpan().Milliseconds()))
|
||||||
metrics.RootCoordNumOfPartitions.WithLabelValues(in.CollectionName).Inc()
|
metrics.RootCoordNumOfPartitions.WithLabelValues().Inc()
|
||||||
return succStatus(), nil
|
return succStatus(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1634,7 +1625,7 @@ func (c *Core) DropPartition(ctx context.Context, in *milvuspb.DropPartitionRequ
|
||||||
|
|
||||||
metrics.RootCoordDropPartitionCounter.WithLabelValues(metrics.SuccessLabel).Inc()
|
metrics.RootCoordDropPartitionCounter.WithLabelValues(metrics.SuccessLabel).Inc()
|
||||||
metrics.RootCoordDDLWriteTypeLatency.WithLabelValues("DropPartition").Observe(float64(tr.ElapseSpan().Milliseconds()))
|
metrics.RootCoordDDLWriteTypeLatency.WithLabelValues("DropPartition").Observe(float64(tr.ElapseSpan().Milliseconds()))
|
||||||
metrics.RootCoordNumOfPartitions.WithLabelValues(in.CollectionName).Dec()
|
metrics.RootCoordNumOfPartitions.WithLabelValues().Dec()
|
||||||
return succStatus(), nil
|
return succStatus(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/metrics"
|
|
||||||
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
||||||
|
@ -971,10 +970,6 @@ func (t *CreateIndexReqTask) Execute(ctx context.Context) error {
|
||||||
collectionID := collMeta.ID
|
collectionID := collMeta.ID
|
||||||
cnt := 0
|
cnt := 0
|
||||||
|
|
||||||
defer func() {
|
|
||||||
metrics.RootCoordNumOfIndexedSegments.WithLabelValues(strconv.FormatInt(collectionID, 10)).Add(float64(cnt))
|
|
||||||
}()
|
|
||||||
|
|
||||||
for _, segID := range segIDs {
|
for _, segID := range segIDs {
|
||||||
info := etcdpb.SegmentIndexInfo{
|
info := etcdpb.SegmentIndexInfo{
|
||||||
CollectionID: collectionID,
|
CollectionID: collectionID,
|
||||||
|
|
Loading…
Reference in New Issue