metricsinfo

package
v0.0.0-...-572c485 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetricTypeKey are the key of metric type in GetMetrics request.
	MetricTypeKey = common.MetricTypeKey

	// SystemInfoMetrics means users request for system information metrics.
	SystemInfoMetrics = "system_info"

	// CollectionStorageMetrics means users request for collection storage metrics.
	CollectionStorageMetrics = "collection_storage"
)
View Source
const (
	// GitCommitEnvKey defines the key to retrieve the commit corresponding to the current milvus version
	// from the metrics information
	GitCommitEnvKey = "MILVUS_GIT_COMMIT"

	// DeployModeEnvKey defines the key to retrieve the current milvus deployment mode
	// from the metrics information
	DeployModeEnvKey = "DEPLOY_MODE"

	// ClusterDeployMode represents distributed deployment mode
	ClusterDeployMode = "DISTRIBUTED"

	// StandaloneDeployMode represents the stand-alone deployment mode
	StandaloneDeployMode = "STANDALONE"

	// GitBuildTagsEnvKey build tag
	GitBuildTagsEnvKey = "MILVUS_GIT_BUILD_TAGS"

	// MilvusBuildTimeEnvKey build time
	MilvusBuildTimeEnvKey = "MILVUS_BUILD_TIME"

	// MilvusUsedGoVersion used go version
	MilvusUsedGoVersion = "MILVUS_USED_GO_VERSION"
)
View Source
const (
	SearchQueueMetric string = "SearchQueue"
	QueryQueueMetric  string = "QueryQueue"
)
View Source
const (
	UnsolvedQueueType string = "Unsolved"
	ReadyQueueType    string = "Ready"
	ReceiveQueueType  string = "Receive"
	ExecuteQueueType  string = "Execute"
)
View Source
const DefaultMetricsRetention = time.Second * 5

DefaultMetricsRetention defines the default retention of metrics cache. TODO(dragondriver): load from config file

View Source
const (
	// MsgUnimplementedMetric represents that user requests an unimplemented metric type
	MsgUnimplementedMetric = "sorry, but this metric type is not implemented"
)

Variables

This section is empty.

Functions

func ConstructComponentName

func ConstructComponentName(role string, id typeutil.UniqueID) string

ConstructComponentName returns a name according to the role name and its' id

func ConstructRequestByMetricType

func ConstructRequestByMetricType(metricType string) (*milvuspb.GetMetricsRequest, error)

ConstructRequestByMetricType constructs a request according to the metric type

func FillDeployMetricsWithEnv

func FillDeployMetricsWithEnv(m *DeployMetrics)

FillDeployMetricsWithEnv fill deploy metrics with env.

func MarshalComponentInfos

func MarshalComponentInfos(infos ComponentInfos) (string, error)

MarshalComponentInfos returns the json string of ComponentInfos

func MarshalTopology

func MarshalTopology(topology Topology) (string, error)

MarshalTopology returns the json string of Topology

func ParseMetricType

func ParseMetricType(req string) (string, error)

ParseMetricType returns the metric type of req

func UnmarshalComponentInfos

func UnmarshalComponentInfos(s string, infos ComponentInfos) error

UnmarshalComponentInfos constructs a ComponentInfos object using a json string

func UnmarshalTopology

func UnmarshalTopology(s string, topology Topology) error

UnmarshalTopology constructs a Topology object using the json string

Types

type BaseComponentInfos

type BaseComponentInfos struct {
	HasError      bool            `json:"has_error"`
	ErrorReason   string          `json:"error_reason"`
	Name          string          `json:"name"`
	HardwareInfos HardwareMetrics `json:"hardware_infos"`
	SystemInfo    DeployMetrics   `json:"system_info"`
	CreatedTime   string          `json:"created_time"`
	UpdatedTime   string          `json:"updated_time"`
	Type          string          `json:"type"`
	ID            int64           `json:"id"`
}

BaseComponentInfos contains basic information that all components should have.

type ComponentInfos

type ComponentInfos interface{}

ComponentInfos defines the interface of all component infos

type ConnTopology

type ConnTopology struct {
	Name                string           `json:"name"`
	ConnectedComponents []ConnectionInfo `json:"connected_components"`
}

ConnTopology contains connection topology TODO(dragondriver) necessary to show all connection edge in topology graph? for example, in system, Proxy connects to RootCoord and RootCoord also connects to Proxy, if we do so, the connection relationship may be confusing. ConnTopology shows how different components connect to each other.

type ConnectionEdge

type ConnectionEdge struct {
	ConnectedIdentifier int                  `json:"connected_identifier"`
	Type                ConnectionType       `json:"type"`
	TargetType          ConnectionTargetType `json:"target_type"` // RootCoord, DataCoord ...
}

ConnectionEdge contains connection's id, type and target type

type ConnectionInfo

type ConnectionInfo struct {
	TargetName string               `json:"target_name"`
	TargetType ConnectionTargetType `json:"target_type"`
}

ConnectionInfo contains info of connection target

type ConnectionTargetType

type ConnectionTargetType = string

ConnectionTargetType is the type of connection target

type ConnectionType

type ConnectionType = string

ConnectionType is the type of connection between nodes

const (
	CoordConnectToNode ConnectionType = "manage"
	Forward            ConnectionType = "forward"
)

ConnectionType definitions

type DataClusterTopology

type DataClusterTopology struct {
	Self                DataCoordInfos   `json:"self"`
	ConnectedDataNodes  []DataNodeInfos  `json:"connected_data_nodes"`
	ConnectedIndexNodes []IndexNodeInfos `json:"connected_index_nodes"`
}

DataClusterTopology shows the topology between DataCoord and DataNodes

type DataCoordCollectionInfo

type DataCoordCollectionInfo struct {
	NumEntitiesTotal int64
	IndexInfo        []*DataCoordIndexInfo
}

type DataCoordCollectionMetrics

type DataCoordCollectionMetrics struct {
	Collections map[int64]*DataCoordCollectionInfo
}

type DataCoordConfiguration

type DataCoordConfiguration struct {
	SegmentMaxSize float64 `json:"segment_max_size"`
}

DataCoordConfiguration records the configuration of DataCoord.

type DataCoordIndexInfo

type DataCoordIndexInfo struct {
	NumEntitiesIndexed int64
	IndexName          string
	FieldID            int64
}

type DataCoordInfos

type DataCoordInfos struct {
	BaseComponentInfos
	SystemConfigurations DataCoordConfiguration      `json:"system_configurations"`
	QuotaMetrics         *DataCoordQuotaMetrics      `json:"quota_metrics"`
	CollectionMetrics    *DataCoordCollectionMetrics `json:"collection_metrics"`
}

DataCoordInfos implements ComponentInfos

type DataCoordQuotaMetrics

type DataCoordQuotaMetrics struct {
	TotalBinlogSize      int64
	CollectionBinlogSize map[int64]int64
	PartitionsBinlogSize map[int64]map[int64]int64
	// l0 segments
	CollectionL0RowCount map[int64]int64
}

type DataCoordTopology

type DataCoordTopology struct {
	Cluster     DataClusterTopology `json:"cluster"`
	Connections ConnTopology        `json:"connections"`
}

DataCoordTopology shows the whole metrics of index cluster

type DataNodeConfiguration

type DataNodeConfiguration struct {
	FlushInsertBufferSize int64 `json:"flush_insert_buffer_size"`
}

DataNodeConfiguration records the configuration of DataNode.

type DataNodeInfos

type DataNodeInfos struct {
	BaseComponentInfos
	SystemConfigurations DataNodeConfiguration `json:"system_configurations"`
	QuotaMetrics         *DataNodeQuotaMetrics `json:"quota_metrics"`
}

DataNodeInfos implements ComponentInfos

type DataNodeQuotaMetrics

type DataNodeQuotaMetrics struct {
	Hms    HardwareMetrics
	Rms    []RateMetric
	Fgm    FlowGraphMetric
	Effect NodeEffect
}

DataNodeQuotaMetrics are metrics of DataNode.

type DeployMetrics

type DeployMetrics struct {
	SystemVersion string `json:"system_version"`
	DeployMode    string `json:"deploy_mode"`
	BuildVersion  string `json:"build_version"`
	BuildTime     string `json:"build_time"`
	UsedGoVersion string `json:"used_go_version"`
}

DeployMetrics records the deploy information of nodes.

type FlowGraphMetric

type FlowGraphMetric struct {
	MinFlowGraphChannel string
	MinFlowGraphTt      typeutil.Timestamp
	NumFlowGraph        int
}

FlowGraphMetric contains a minimal timestamp of flow graph and the number of flow graphs.

type HardwareMetrics

type HardwareMetrics struct {
	IP           string  `json:"ip"`
	CPUCoreCount int     `json:"cpu_core_count"`
	CPUCoreUsage float64 `json:"cpu_core_usage"`
	Memory       uint64  `json:"memory"`
	MemoryUsage  uint64  `json:"memory_usage"`

	// how to metric disk & disk usage in distributed storage
	Disk      uint64 `json:"disk"`
	DiskUsage uint64 `json:"disk_usage"`
}

HardwareMetrics records the hardware information of nodes.

type IndexClusterTopology

type IndexClusterTopology struct {
	Self           IndexCoordInfos  `json:"self"`
	ConnectedNodes []IndexNodeInfos `json:"connected_nodes"`
}

IndexClusterTopology shows the topology between IndexCoord and IndexNodes

type IndexCoordConfiguration

type IndexCoordConfiguration struct {
	MinioBucketName string `json:"minio_bucket_name"`
}

IndexCoordConfiguration records the configuration of IndexCoord.

type IndexCoordInfos

type IndexCoordInfos struct {
	BaseComponentInfos
	SystemConfigurations IndexCoordConfiguration `json:"system_configurations"`
}

IndexCoordInfos implements ComponentInfos

type IndexCoordTopology

type IndexCoordTopology struct {
	Cluster     IndexClusterTopology `json:"cluster"`
	Connections ConnTopology         `json:"connections"`
}

IndexCoordTopology shows the whole metrics of index cluster

type IndexNodeConfiguration

type IndexNodeConfiguration struct {
	MinioBucketName string `json:"minio_bucket_name"`

	SimdType string `json:"simd_type"`
}

IndexNodeConfiguration records the configuration of IndexNode.

type IndexNodeInfos

type IndexNodeInfos struct {
	BaseComponentInfos
	SystemConfigurations IndexNodeConfiguration `json:"system_configurations"`
}

IndexNodeInfos implements ComponentInfos

type MetricsCacheManager

type MetricsCacheManager struct {
	// contains filtered or unexported fields
}

MetricsCacheManager manage the cache of metrics information. TODO(dragondriver): we can use a map to manage the metrics if there are too many kind metrics

func NewMetricsCacheManager

func NewMetricsCacheManager() *MetricsCacheManager

NewMetricsCacheManager returns a cache manager of metrics information.

func (*MetricsCacheManager) GetRetention

func (manager *MetricsCacheManager) GetRetention() time.Duration

GetRetention returns the retention

func (*MetricsCacheManager) GetSystemInfoMetrics

func (manager *MetricsCacheManager) GetSystemInfoMetrics() (*milvuspb.GetMetricsResponse, error)

GetSystemInfoMetrics returns the cached system information metrics.

func (*MetricsCacheManager) InvalidateSystemInfoMetrics

func (manager *MetricsCacheManager) InvalidateSystemInfoMetrics()

InvalidateSystemInfoMetrics invalidates the system information metrics.

func (*MetricsCacheManager) IsSystemInfoMetricsValid

func (manager *MetricsCacheManager) IsSystemInfoMetricsValid() bool

IsSystemInfoMetricsValid checks if the manager's systemInfoMetrics is valid

func (*MetricsCacheManager) ResetRetention

func (manager *MetricsCacheManager) ResetRetention()

ResetRetention reset retention to default

func (*MetricsCacheManager) SetRetention

func (manager *MetricsCacheManager) SetRetention(retention time.Duration)

SetRetention updates the retention

func (*MetricsCacheManager) UpdateSystemInfoMetrics

func (manager *MetricsCacheManager) UpdateSystemInfoMetrics(infos *milvuspb.GetMetricsResponse)

UpdateSystemInfoMetrics updates systemInfoMetrics by given info

type NodeEffect

type NodeEffect struct {
	NodeID        int64
	CollectionIDs []int64
}

NodeEffect contains the a node and its effected collection info.

type ProxyConfiguration

type ProxyConfiguration struct {
	DefaultPartitionName string `json:"default_partition_name"`
	DefaultIndexName     string `json:"default_index_name"`
}

ProxyConfiguration records the configuration of Proxy.

type ProxyInfos

type ProxyInfos struct {
	BaseComponentInfos
	SystemConfigurations ProxyConfiguration `json:"system_configurations"`
	QuotaMetrics         *ProxyQuotaMetrics `json:"quota_metrics"`
}

ProxyInfos implements ComponentInfos

type ProxyQuotaMetrics

type ProxyQuotaMetrics struct {
	Hms HardwareMetrics
	Rms []RateMetric
}

ProxyQuotaMetrics are metrics of Proxy.

type QueryClusterTopology

type QueryClusterTopology struct {
	Self           QueryCoordInfos  `json:"self"`
	ConnectedNodes []QueryNodeInfos `json:"connected_nodes"`
}

QueryClusterTopology shows the topology between QueryCoord and QueryNodes

type QueryCoordConfiguration

type QueryCoordConfiguration struct {
	SearchChannelPrefix       string `json:"search_channel_prefix"`
	SearchResultChannelPrefix string `json:"search_result_channel_prefix"`
}

QueryCoordConfiguration records the configuration of QueryCoord.

type QueryCoordInfos

type QueryCoordInfos struct {
	BaseComponentInfos
	SystemConfigurations QueryCoordConfiguration `json:"system_configurations"`
}

QueryCoordInfos implements ComponentInfos

type QueryCoordTopology

type QueryCoordTopology struct {
	Cluster     QueryClusterTopology `json:"cluster"`
	Connections ConnTopology         `json:"connections"`
}

QueryCoordTopology shows the whole metrics of query cluster

type QueryNodeCollectionMetrics

type QueryNodeCollectionMetrics struct {
	CollectionRows map[int64]int64
}

type QueryNodeConfiguration

type QueryNodeConfiguration struct {
	SimdType string `json:"simd_type"`
}

QueryNodeConfiguration records the configuration of QueryNode.

type QueryNodeInfos

type QueryNodeInfos struct {
	BaseComponentInfos
	SystemConfigurations QueryNodeConfiguration      `json:"system_configurations"`
	QuotaMetrics         *QueryNodeQuotaMetrics      `json:"quota_metrics"`
	CollectionMetrics    *QueryNodeCollectionMetrics `json:"collection_metrics"`
}

QueryNodeInfos implements ComponentInfos

type QueryNodeQuotaMetrics

type QueryNodeQuotaMetrics struct {
	Hms                 HardwareMetrics
	Rms                 []RateMetric
	Fgm                 FlowGraphMetric
	SearchQueue         ReadInfoInQueue
	QueryQueue          ReadInfoInQueue
	GrowingSegmentsSize int64
	Effect              NodeEffect
}

QueryNodeQuotaMetrics are metrics of QueryNode.

type RateMetric

type RateMetric struct {
	Label RateMetricLabel
	Rate  float64
}

RateMetric contains a RateMetricLabel and a float rate.

type RateMetricLabel

type RateMetricLabel = string

RateMetricLabel defines the metric label collected from nodes.

const (
	NQPerSecond             RateMetricLabel = "NQPerSecond"
	SearchThroughput        RateMetricLabel = "SearchThroughput"
	ReadResultThroughput    RateMetricLabel = "ReadResultThroughput"
	InsertConsumeThroughput RateMetricLabel = "InsertConsumeThroughput"
	DeleteConsumeThroughput RateMetricLabel = "DeleteConsumeThroughput"
)

type ReadInfoInQueue

type ReadInfoInQueue struct {
	UnsolvedQueue    int64
	ReadyQueue       int64
	ReceiveChan      int64
	ExecuteChan      int64
	AvgQueueDuration time.Duration
}

ReadInfoInQueue contains NQ num or task num in QueryNode's task queue.

type RootCoordConfiguration

type RootCoordConfiguration struct {
	MinSegmentSizeToEnableIndex int64 `json:"min_segment_size_to_enable_index"`
}

RootCoordConfiguration records the configuration of RootCoord.

type RootCoordInfos

type RootCoordInfos struct {
	BaseComponentInfos
	SystemConfigurations RootCoordConfiguration `json:"system_configurations"`
}

RootCoordInfos implements ComponentInfos

type RootCoordTopology

type RootCoordTopology struct {
	Self        RootCoordInfos `json:"self"`
	Connections ConnTopology   `json:"connections"`
}

RootCoordTopology shows the whole metrics of root coordinator

type SystemTopology

type SystemTopology struct {
	NodesInfo []SystemTopologyNode `json:"nodes_info"`
}

SystemTopology shows the system topology

type SystemTopologyNode

type SystemTopologyNode struct {
	Identifier int              `json:"identifier"` // unique in the SystemTopology graph
	Connected  []ConnectionEdge `json:"connected"`
	Infos      ComponentInfos   `json:"infos"`
}

SystemTopologyNode is a node in system topology graph.

type Topology

type Topology interface{}

Topology defines the interface of topology graph between different components

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL