2022-03-02 21:11:57 +08:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// RootCoordProxyLister counts the num of registered proxy nodes
|
|
|
|
RootCoordProxyLister = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "list_of_proxy",
|
|
|
|
Help: "List of proxy nodes which have registered with etcd",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{nodeIDLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// for grpc
|
|
|
|
|
|
|
|
// RootCoordCreateCollectionCounter counts the num of calls of CreateCollection
|
|
|
|
RootCoordCreateCollectionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "create_collection_total",
|
|
|
|
Help: "Counter of create collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDropCollectionCounter counts the num of calls of DropCollection
|
|
|
|
RootCoordDropCollectionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "drop_collection_total",
|
|
|
|
Help: "Counter of drop collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordHasCollectionCounter counts the num of calls of HasCollection
|
|
|
|
RootCoordHasCollectionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "has_collection_total",
|
|
|
|
Help: "Counter of has collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDescribeCollectionCounter counts the num of calls of DescribeCollection
|
|
|
|
RootCoordDescribeCollectionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "describe_collection_total",
|
|
|
|
Help: "Counter of describe collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordShowCollectionsCounter counts the num of calls of ShowCollections
|
|
|
|
RootCoordShowCollectionsCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "show_collections_total",
|
|
|
|
Help: "Counter of show collections",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordCreatePartitionCounter counts the num of calls of CreatePartition
|
|
|
|
RootCoordCreatePartitionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "create_partition_total",
|
|
|
|
Help: "Counter of create partition",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDropPartitionCounter counts the num of calls of DropPartition
|
|
|
|
RootCoordDropPartitionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "drop_partition_total",
|
|
|
|
Help: "Counter of drop partition",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordHasPartitionCounter counts the num of calls of HasPartition
|
|
|
|
RootCoordHasPartitionCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "has_partition_total",
|
|
|
|
Help: "Counter of has partition",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordShowPartitionsCounter counts the num of calls of ShowPartitions
|
|
|
|
RootCoordShowPartitionsCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "show_partitions_total",
|
|
|
|
Help: "Counter of show partitions",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordCreateIndexCounter counts the num of calls of CreateIndex
|
|
|
|
RootCoordCreateIndexCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "create_index_total",
|
|
|
|
Help: "Counter of create index",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDropIndexCounter counts the num of calls of DropIndex
|
|
|
|
RootCoordDropIndexCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "drop_index_total",
|
|
|
|
Help: "Counter of drop index",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDescribeIndexCounter counts the num of calls of DescribeIndex
|
|
|
|
RootCoordDescribeIndexCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "describe_index_total",
|
|
|
|
Help: "Counter of describe index",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDescribeSegmentCounter counts the num of calls of DescribeSegment
|
|
|
|
RootCoordDescribeSegmentCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "describe_segment_total",
|
|
|
|
Help: "Counter of describe segment",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordShowSegmentsCounter counts the num of calls of ShowSegments
|
|
|
|
RootCoordShowSegmentsCounter = prometheus.NewCounterVec(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "show_segments_total",
|
|
|
|
Help: "Counter of show segments",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{statusLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// for time tick
|
|
|
|
|
|
|
|
// RootCoordInsertChannelTimeTick counts the time tick num of insert channel in 24H
|
|
|
|
RootCoordInsertChannelTimeTick = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "insert_channel_time_tick",
|
|
|
|
Help: "Time tick of insert Channel in 24H",
|
|
|
|
}, []string{"PChannel"})
|
|
|
|
|
|
|
|
// RootCoordDDLReadTypeLatency records the latency for read type of DDL operations.
|
|
|
|
RootCoordDDLReadTypeLatency = prometheus.NewHistogramVec(
|
|
|
|
prometheus.HistogramOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "ddl_read_type_latency",
|
|
|
|
Help: "The latency for read type of DDL operations",
|
2022-03-15 21:51:21 +08:00
|
|
|
}, []string{functionLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordDDLWriteTypeLatency records the latency for write type of DDL operations.
|
|
|
|
RootCoordDDLWriteTypeLatency = prometheus.NewHistogramVec(
|
|
|
|
prometheus.HistogramOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "ddl_write_type_latency",
|
|
|
|
Help: "The latency for write type of DDL operations",
|
2022-03-15 21:51:21 +08:00
|
|
|
}, []string{functionLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordSyncTimeTickLatency records the latency of sync time tick.
|
|
|
|
RootCoordSyncTimeTickLatency = prometheus.NewHistogram(
|
|
|
|
prometheus.HistogramOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "sync_time_tick_latency",
|
|
|
|
Help: "The latency of sync time tick",
|
|
|
|
})
|
|
|
|
|
|
|
|
// RootCoordIDAllocCounter records the number of global ID allocations.
|
|
|
|
RootCoordIDAllocCounter = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "id_alloc_count",
|
|
|
|
Help: "The number of global ID allocations",
|
|
|
|
})
|
|
|
|
|
|
|
|
// RootCoordLocalTimestampAllocCounter records the number of timestamp allocations in RootCoord.
|
|
|
|
RootCoordTimestampAllocCounter = prometheus.NewGauge(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "timestamp_alloc_count",
|
|
|
|
Help: "The number of timestamp allocations in RootCoord",
|
|
|
|
})
|
|
|
|
|
|
|
|
// RootCoordETCDTimestampAllocCounter records the number of timestamp allocations in ETCD.
|
|
|
|
RootCoordETCDTimestampAllocCounter = prometheus.NewGauge(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "etcd_timestamp_alloc_count",
|
|
|
|
Help: "The number of timestamp allocations in ETCD",
|
|
|
|
})
|
|
|
|
|
|
|
|
// RootCoordNumOfCollections counts the number of collections.
|
|
|
|
RootCoordNumOfCollections = prometheus.NewGauge(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "num_of_collections",
|
|
|
|
Help: "The number of collections",
|
|
|
|
})
|
|
|
|
|
|
|
|
// RootCoordNumOfPartitions counts the number of partitions per collection.
|
|
|
|
RootCoordNumOfPartitions = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "num_of_partitions",
|
|
|
|
Help: "The number of partitions per collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{collectionIDLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordNumOfSegments counts the number of segments per collections.
|
|
|
|
RootCoordNumOfSegments = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "num_of_segments",
|
|
|
|
Help: "The number of segments per collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{collectionIDLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordNumOfIndexedSegments counts the number of indexed segments per collection.
|
|
|
|
RootCoordNumOfIndexedSegments = prometheus.NewGaugeVec(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "num_of_indexed_segments",
|
|
|
|
Help: "The number of indexed segments per collection",
|
2022-03-03 16:05:57 +08:00
|
|
|
}, []string{collectionIDLabelName})
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// RootCoordNumOfDMLChannel counts the number of DML channels.
|
|
|
|
RootCoordNumOfDMLChannel = prometheus.NewGauge(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "num_of_dml_channel",
|
|
|
|
Help: "The number of DML channels",
|
|
|
|
})
|
|
|
|
|
|
|
|
// RootCoordNumOfMsgStream counts the number of message streams.
|
|
|
|
RootCoordNumOfMsgStream = prometheus.NewGauge(
|
|
|
|
prometheus.GaugeOpts{
|
|
|
|
Namespace: milvusNamespace,
|
|
|
|
Subsystem: typeutil.RootCoordRole,
|
|
|
|
Name: "num_of_msg_stream",
|
|
|
|
Help: "The number of message streams",
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
//RegisterRootCoord registers RootCoord metrics
|
2022-03-18 15:51:22 +08:00
|
|
|
func RegisterRootCoord(registry *prometheus.Registry) {
|
|
|
|
registry.Register(RootCoordProxyLister)
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// for grpc
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordCreateCollectionCounter)
|
|
|
|
registry.MustRegister(RootCoordDropCollectionCounter)
|
|
|
|
registry.MustRegister(RootCoordHasCollectionCounter)
|
|
|
|
registry.MustRegister(RootCoordDescribeCollectionCounter)
|
|
|
|
registry.MustRegister(RootCoordShowCollectionsCounter)
|
|
|
|
registry.MustRegister(RootCoordCreatePartitionCounter)
|
|
|
|
registry.MustRegister(RootCoordDropPartitionCounter)
|
|
|
|
registry.MustRegister(RootCoordHasPartitionCounter)
|
|
|
|
registry.MustRegister(RootCoordShowPartitionsCounter)
|
|
|
|
registry.MustRegister(RootCoordCreateIndexCounter)
|
|
|
|
registry.MustRegister(RootCoordDropIndexCounter)
|
|
|
|
registry.MustRegister(RootCoordDescribeIndexCounter)
|
|
|
|
registry.MustRegister(RootCoordDescribeSegmentCounter)
|
|
|
|
registry.MustRegister(RootCoordShowSegmentsCounter)
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// for time tick
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordInsertChannelTimeTick)
|
2022-03-02 21:11:57 +08:00
|
|
|
//prometheus.MustRegister(PanicCounter)
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordSyncTimeTickLatency)
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// for DDL latency
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordDDLReadTypeLatency)
|
|
|
|
registry.MustRegister(RootCoordDDLWriteTypeLatency)
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// for allocator
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordIDAllocCounter)
|
|
|
|
registry.MustRegister(RootCoordTimestampAllocCounter)
|
|
|
|
registry.MustRegister(RootCoordETCDTimestampAllocCounter)
|
2022-03-02 21:11:57 +08:00
|
|
|
|
|
|
|
// for collection
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordNumOfCollections)
|
|
|
|
registry.MustRegister(RootCoordNumOfPartitions)
|
|
|
|
registry.MustRegister(RootCoordNumOfSegments)
|
|
|
|
registry.MustRegister(RootCoordNumOfIndexedSegments)
|
2022-03-02 21:11:57 +08:00
|
|
|
|
2022-03-18 15:51:22 +08:00
|
|
|
registry.MustRegister(RootCoordNumOfDMLChannel)
|
|
|
|
registry.MustRegister(RootCoordNumOfMsgStream)
|
2022-03-02 21:11:57 +08:00
|
|
|
}
|