diff --git a/internal/datacoord/index_meta.go b/internal/datacoord/index_meta.go index ec2e7c9c7e118..6e8fc15616f4c 100644 --- a/internal/datacoord/index_meta.go +++ b/internal/datacoord/index_meta.go @@ -801,7 +801,7 @@ func (m *indexMeta) SetStoredIndexFileSizeMetric(collections map[UniqueID]*colle coll, ok := collections[segmentIdx.CollectionID] if ok { metrics.DataCoordStoredIndexFilesSize.WithLabelValues(coll.DatabaseName, coll.Schema.GetName(), - fmt.Sprint(segmentIdx.CollectionID), fmt.Sprint(segmentIdx.SegmentID)).Set(float64(segmentIdx.IndexSize)) + fmt.Sprint(segmentIdx.CollectionID)).Set(float64(segmentIdx.IndexSize)) total += segmentIdx.IndexSize } } diff --git a/internal/datacoord/meta.go b/internal/datacoord/meta.go index fdc30766914d2..32a84f59f5628 100644 --- a/internal/datacoord/meta.go +++ b/internal/datacoord/meta.go @@ -416,7 +416,7 @@ func (m *meta) GetQuotaInfo() *metricsinfo.DataCoordQuotaMetrics { coll, ok := m.collections[segment.GetCollectionID()] if ok { metrics.DataCoordStoredBinlogSize.WithLabelValues(coll.DatabaseName, - fmt.Sprint(segment.GetCollectionID()), fmt.Sprint(segment.GetID()), segment.GetState().String()).Set(float64(segmentSize)) + fmt.Sprint(segment.GetCollectionID()), segment.GetState().String()).Set(float64(segmentSize)) } else { log.Warn("not found database name", zap.Int64("collectionID", segment.GetCollectionID())) } @@ -515,10 +515,6 @@ func (m *meta) DropSegment(segmentID UniqueID) error { return err } metrics.DataCoordNumSegments.WithLabelValues(segment.GetState().String(), segment.GetLevel().String()).Dec() - coll, ok := m.collections[segment.CollectionID] - if ok { - metrics.CleanupDataCoordSegmentMetrics(coll.DatabaseName, segment.CollectionID, segment.ID) - } m.segments.DropSegment(segmentID) log.Info("meta update: dropping segment - complete", diff --git a/internal/metastore/kv/datacoord/kv_catalog.go b/internal/metastore/kv/datacoord/kv_catalog.go index 9899b506e3b92..8499007851aa0 100644 --- a/internal/metastore/kv/datacoord/kv_catalog.go +++ b/internal/metastore/kv/datacoord/kv_catalog.go @@ -356,9 +356,7 @@ func (kc *Catalog) collectMetrics(s *datapb.SegmentInfo) { cnt += statsFieldFn(s.GetStatslogs()) cnt += statsFieldFn(s.GetDeltalogs()) - metrics.DataCoordSegmentBinLogFileCount. - WithLabelValues(fmt.Sprint(s.CollectionID), fmt.Sprint(s.GetID())). - Set(float64(cnt)) + metrics.DataCoordSegmentBinLogFileCount.WithLabelValues(fmt.Sprint(s.CollectionID)).Set(float64(cnt)) } func (kc *Catalog) hasBinlogPrefix(segment *datapb.SegmentInfo) (bool, error) { diff --git a/pkg/metrics/datacoord_metrics.go b/pkg/metrics/datacoord_metrics.go index 92e851c77a577..c36b44d0167cc 100644 --- a/pkg/metrics/datacoord_metrics.go +++ b/pkg/metrics/datacoord_metrics.go @@ -141,7 +141,6 @@ var ( }, []string{ databaseLabelName, collectionIDLabelName, - segmentIDLabelName, segmentStateLabelName, }) DataCoordSegmentBinLogFileCount = prometheus.NewGaugeVec( @@ -152,7 +151,6 @@ var ( Help: "number of binlog files for each segment", }, []string{ collectionIDLabelName, - segmentIDLabelName, }) DataCoordStoredIndexFilesSize = prometheus.NewGaugeVec( @@ -165,7 +163,6 @@ var ( databaseLabelName, collectionName, collectionIDLabelName, - segmentIDLabelName, }) DataCoordDmlChannelNum = prometheus.NewGaugeVec( @@ -380,25 +377,6 @@ func RegisterDataCoord(registry *prometheus.Registry) { registry.MustRegister(DataCoordTaskExecuteLatency) } -func CleanupDataCoordSegmentMetrics(dbName string, collectionID int64, segmentID int64) { - DataCoordSegmentBinLogFileCount. - Delete( - prometheus.Labels{ - collectionIDLabelName: fmt.Sprint(collectionID), - segmentIDLabelName: fmt.Sprint(segmentID), - }) - DataCoordStoredBinlogSize.Delete(prometheus.Labels{ - databaseLabelName: dbName, - collectionIDLabelName: fmt.Sprint(collectionID), - segmentIDLabelName: fmt.Sprint(segmentID), - }) - DataCoordStoredIndexFilesSize.DeletePartialMatch(prometheus.Labels{ - databaseLabelName: dbName, - collectionIDLabelName: fmt.Sprint(collectionID), - segmentIDLabelName: fmt.Sprint(segmentID), - }) -} - func CleanupDataCoordWithCollectionID(collectionID int64) { IndexTaskNum.DeletePartialMatch(prometheus.Labels{ collectionIDLabelName: fmt.Sprint(collectionID), diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index 312bebc069806..f1fbb137abe46 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -101,7 +101,6 @@ const ( indexName = "index_name" isVectorIndex = "is_vector_index" segmentStateLabelName = "segment_state" - segmentIDLabelName = "segment_id" segmentLevelLabelName = "segment_level" usernameLabelName = "username" roleNameLabelName = "role_name"