Remove the collectionID label from metrics (#16571)

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/16675/head
zhenshan.cao 2022-04-26 17:29:45 +08:00 committed by GitHub
parent 4855ba6fa3
commit a3f7bb5f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 27 deletions

View File

@ -297,8 +297,8 @@ var (
Namespace: milvusNamespace,
Subsystem: typeutil.RootCoordRole,
Name: "num_of_partitions",
Help: "The number of partitions per collection",
}, []string{collectionIDLabelName})
Help: "The number of partitions",
}, []string{})
// RootCoordNumOfSegments counts the number of segments per collections.
RootCoordNumOfSegments = prometheus.NewGaugeVec(
@ -306,8 +306,8 @@ var (
Namespace: milvusNamespace,
Subsystem: typeutil.RootCoordRole,
Name: "num_of_segments",
Help: "The number of segments per collection",
}, []string{collectionIDLabelName})
Help: "The number of segments",
}, []string{})
// RootCoordNumOfIndexedSegments counts the number of indexed segments per collection.
RootCoordNumOfIndexedSegments = prometheus.NewGaugeVec(
@ -315,8 +315,8 @@ var (
Namespace: milvusNamespace,
Subsystem: typeutil.RootCoordRole,
Name: "num_of_indexed_segments",
Help: "The number of indexed segments per collection",
}, []string{collectionIDLabelName})
Help: "The number of indexed segments",
}, []string{})
// RootCoordNumOfDMLChannel counts the number of DML channels.
RootCoordNumOfDMLChannel = prometheus.NewGauge(
@ -384,8 +384,8 @@ func RegisterRootCoord(registry *prometheus.Registry) {
// for collection
registry.MustRegister(RootCoordNumOfCollections)
registry.MustRegister(RootCoordNumOfPartitions)
registry.MustRegister(RootCoordNumOfSegments)
registry.MustRegister(RootCoordNumOfIndexedSegments)
// registry.MustRegister(RootCoordNumOfSegments)
// registry.MustRegister(RootCoordNumOfIndexedSegments)
registry.MustRegister(RootCoordNumOfDMLChannel)
registry.MustRegister(RootCoordNumOfMsgStream)

View File

@ -777,7 +777,6 @@ func (dct *dropCollectionTask) Execute(ctx context.Context) error {
_ = dct.chMgr.removeDMLStream(collID)
_ = dct.chMgr.removeDQLStream(collID)
return nil
}

View File

@ -77,14 +77,6 @@ type DdOperation struct {
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 {
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
}
@ -1534,7 +1525,7 @@ func (c *Core) DescribeCollection(ctx context.Context, in *milvuspb.DescribeColl
// ShowCollections list all collection names
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 {
return &milvuspb.ShowCollectionsResponse{
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.Int64("msgID", in.Base.MsgID))
metrics.RootCoordShowCollectionsCounter.WithLabelValues(MetricRequestsSuccess).Inc()
metrics.RootCoordShowCollectionsCounter.WithLabelValues(metrics.SuccessLabel).Inc()
t.Rsp.Status = succStatus()
metrics.RootCoordDDLReadTypeLatency.WithLabelValues("ShowCollections").Observe(float64(tr.ElapseSpan().Milliseconds()))
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.RootCoordDDLWriteTypeLatency.WithLabelValues("CreatePartition").Observe(float64(tr.ElapseSpan().Milliseconds()))
metrics.RootCoordNumOfPartitions.WithLabelValues(in.CollectionName).Inc()
metrics.RootCoordNumOfPartitions.WithLabelValues().Inc()
return succStatus(), nil
}
@ -1634,7 +1625,7 @@ func (c *Core) DropPartition(ctx context.Context, in *milvuspb.DropPartitionRequ
metrics.RootCoordDropPartitionCounter.WithLabelValues(metrics.SuccessLabel).Inc()
metrics.RootCoordDDLWriteTypeLatency.WithLabelValues("DropPartition").Observe(float64(tr.ElapseSpan().Milliseconds()))
metrics.RootCoordNumOfPartitions.WithLabelValues(in.CollectionName).Dec()
metrics.RootCoordNumOfPartitions.WithLabelValues().Dec()
return succStatus(), nil
}

View File

@ -24,7 +24,6 @@ import (
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus/internal/common"
"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/etcdpb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
@ -971,10 +970,6 @@ func (t *CreateIndexReqTask) Execute(ctx context.Context) error {
collectionID := collMeta.ID
cnt := 0
defer func() {
metrics.RootCoordNumOfIndexedSegments.WithLabelValues(strconv.FormatInt(collectionID, 10)).Add(float64(cnt))
}()
for _, segID := range segIDs {
info := etcdpb.SegmentIndexInfo{
CollectionID: collectionID,