metricquery

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotMatchWorkloadError  = fmt.Errorf("metric type %v, but no WorkloadNamerInfo provided", WorkloadMetricType)
	NotMatchContainerError = fmt.Errorf("metric type %v, but no WorkloadNamerInfo provided", ContainerMetricType)
	NotMatchPodError       = fmt.Errorf("metric type %v, but no WorkloadNamerInfo provided", PodMetricType)
	NotMatchNodeError      = fmt.Errorf("metric type %v, but no WorkloadNamerInfo provided", NodeMetricType)
	NotMatchPromError      = fmt.Errorf("metric type %v, but no WorkloadNamerInfo provided", PromQLMetricType)
)

Functions

This section is empty.

Types

type ContainerNamerInfo

type ContainerNamerInfo struct {
	Namespace     string
	WorkloadName  string
	Kind          string
	APIVersion    string
	ContainerName string
	Selector      labels.Selector
}

type Metric

type Metric struct {
	Type MetricType
	// such as cpu/memory, or http_requests
	MetricName string
	// Workload only support for MetricName cpu/memory
	Workload *WorkloadNamerInfo
	// Container only support for MetricName cpu/memory
	Container *ContainerNamerInfo
	// Pod only support for MetricName cpu/memory
	Pod *PodNamerInfo
	// Node only support for MetricName cpu/memory
	Node *NodeNamerInfo
	// Prom can support any MetricName, user give the promQL
	Prom *PromNamerInfo
}

func (*Metric) BuildUniqueKey

func (m *Metric) BuildUniqueKey() string

func (*Metric) ValidateMetric

func (m *Metric) ValidateMetric() error

type MetricServerQuery

type MetricServerQuery struct {
	Metric *Metric
}

MetricServerQuery is used to do query for metric server

type MetricSource

type MetricSource string
const (
	PrometheusMetricSource    MetricSource = "prom"
	MetricServerMetricSource  MetricSource = "metricserver"
	QCloudMonitorMetricSource MetricSource = "qcloudmonitor"
)

type MetricType

type MetricType string
const (
	WorkloadMetricType  MetricType = "workload"
	PodMetricType       MetricType = "pod"
	ContainerMetricType MetricType = "container"
	NodeMetricType      MetricType = "node"
	PromQLMetricType    MetricType = "promql"
)

type NodeNamerInfo

type NodeNamerInfo struct {
	Name     string
	Selector labels.Selector
}

type PodNamerInfo

type PodNamerInfo struct {
	Namespace string
	Name      string
	Selector  labels.Selector
}

type PromNamerInfo

type PromNamerInfo struct {
	QueryExpr string
	Namespace string
	Selector  labels.Selector
}

type PrometheusQuery

type PrometheusQuery struct {
	Query string
}

PrometheusQuery is used to do query for prometheus

type QCloudMonitorQuery

type QCloudMonitorQuery struct {
	Metric *Metric
}

QCloudMonitorQuery is used to do query for qcloud monitor

type Query

type Query struct {
	Type          MetricSource
	MetricServer  *MetricServerQuery
	Prometheus    *PrometheusQuery
	QCloudMonitor *QCloudMonitorQuery
}

Query is used to do query for different data source. you can extends it with your data source query

type WorkloadNamerInfo

type WorkloadNamerInfo struct {
	Namespace  string
	Kind       string
	Name       string
	APIVersion string
	Selector   labels.Selector
}

Jump to

Keyboard shortcuts

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