enhance: Add compaction type label to metrics (#29485)

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
pull/29539/head
XuanYang-cn 2023-12-27 15:56:48 +08:00 committed by GitHub
parent c45f8a2946
commit fe04598900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View File

@ -613,7 +613,7 @@ func (t *compactionTask) compact() (*datapb.CompactionPlanResult, error) {
)
log.Info("compact overall elapse", zap.Duration("elapse", time.Since(compactStart)))
metrics.DataNodeCompactionLatency.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Observe(float64(t.tr.ElapseSpan().Milliseconds()))
metrics.DataNodeCompactionLatency.WithLabelValues(fmt.Sprint(paramtable.GetNodeID()), t.plan.GetType().String()).Observe(float64(t.tr.ElapseSpan().Milliseconds()))
metrics.DataNodeCompactionLatencyInQueue.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Observe(float64(durInQueue.Milliseconds()))
planResult := &datapb.CompactionPlanResult{

View File

@ -18,6 +18,7 @@ package datanode
import (
"context"
"fmt"
"time"
"github.com/samber/lo"
@ -33,6 +34,7 @@ import (
"github.com/milvus-io/milvus/internal/storage"
"github.com/milvus-io/milvus/pkg/common"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/metrics"
"github.com/milvus-io/milvus/pkg/util/funcutil"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/metautil"
@ -227,6 +229,8 @@ func (t *levelZeroCompactionTask) compact() (*datapb.CompactionPlanResult, error
Channel: t.plan.GetChannel(),
}
metrics.DataNodeCompactionLatency.WithLabelValues(fmt.Sprint(paramtable.GetNodeID()), t.plan.GetType().String()).
Observe(float64(t.tr.ElapseSpan().Milliseconds()))
log.Info("L0 compaction finished", zap.Duration("elapse", t.tr.ElapseSpan()))
return result, nil

View File

@ -161,6 +161,7 @@ var (
Buckets: longTaskBuckets,
}, []string{
nodeIDLabelName,
compactionTypeLabel,
})
DataNodeCompactionLatencyInQueue = prometheus.NewHistogramVec(

View File

@ -64,6 +64,7 @@ const (
ReduceSegments = "segments"
ReduceShards = "shards"
compactionTypeLabel = "compaction_type"
nodeIDLabelName = "node_id"
statusLabelName = "status"
indexTaskStatusLabelName = "index_task_status"