config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// WorkloadCpuUsagePromQLFmtStr is used to query workload cpu usage by promql,  param is namespace,workload-name,duration str
	WorkloadCpuUsagePromQLFmtStr = `sum (irate (container_cpu_usage_seconds_total{container!="",image!="",container!="POD",namespace="%s",pod=~"^%s-.*$"}[%s]))`
	// WorkloadMemUsagePromQLFmtStr is used to query workload mem usage by promql, param is namespace, workload-name
	WorkloadMemUsagePromQLFmtStr = `sum(container_memory_working_set_bytes{container!="",image!="",container!="POD",namespace="%s",pod=~"^%s-.*$"})`

	// following is node exporter metric for node cpu/memory usage
	// NodeCpuUsagePromQLFmtStr is used to query node cpu usage by promql,  param is node name which prometheus scrape, duration str
	NodeCpuUsagePromQLFmtStr = `` /* 150-byte string literal not displayed */
	// NodeMemUsagePromQLFmtStr is used to query node cpu memory by promql,  param is node name, node name which prometheus scrape
	NodeMemUsagePromQLFmtStr = `sum(node_memory_MemTotal_bytes{instance=~"^%s.*"} - node_memory_MemAvailable_bytes{instance=~"^%s.*"})`
)
View Source
const TargetKindNode = "Node"

Variables

This section is empty.

Functions

This section is empty.

Types

type AlgorithmModelConfig

type AlgorithmModelConfig struct {
	UpdateInterval time.Duration
}

type Broadcaster

type Broadcaster struct {
	// contains filtered or unexported fields
}
var DeleteEventBroadcaster Broadcaster = NewBroadcaster()
var UpdateEventBroadcaster Broadcaster = NewBroadcaster()

func NewBroadcaster

func NewBroadcaster() Broadcaster

func (Broadcaster) Listen

func (b Broadcaster) Listen() Receiver

Listen starts listening to the broadcasts.

func (Broadcaster) Write

func (b Broadcaster) Write(v interface{})

Write broadcasts a value to all listeners.

type Config

type Config struct {
	Metric     *v1alpha1.MetricQuery
	Expression *v1alpha1.ExpressionQuery
	DSP        *v1alpha1.DSP
	Percentile *v1alpha1.Percentile
}

type MetricContext

type MetricContext struct {
	Namespace  string
	TargetKind string
	Name       string
}

func (*MetricContext) ConvertApiMetric2InternalConfig

func (c *MetricContext) ConvertApiMetric2InternalConfig(metric *v1alpha1.PredictionMetric) *Config

ConvertApiMetric2InternalConfig

func (*MetricContext) ConvertApiMetrics2InternalConfigs

func (c *MetricContext) ConvertApiMetrics2InternalConfigs(metrics []v1alpha1.PredictionMetric) []*Config

ConvertApiMetrics2InternalConfigs

func (*MetricContext) DeleteApiConfig

func (c *MetricContext) DeleteApiConfig(conf *v1alpha1.PredictionMetric)

func (*MetricContext) DeleteApiConfigs

func (c *MetricContext) DeleteApiConfigs(configs []v1alpha1.PredictionMetric)

func (*MetricContext) DeleteConfig

func (c *MetricContext) DeleteConfig(conf *Config)

func (*MetricContext) ResourceToPromQueryExpr

func (c *MetricContext) ResourceToPromQueryExpr(resourceName *corev1.ResourceName) string

func (*MetricContext) WithApiConfig

func (c *MetricContext) WithApiConfig(conf *v1alpha1.PredictionMetric)

func (*MetricContext) WithApiConfigs

func (c *MetricContext) WithApiConfigs(configs []v1alpha1.PredictionMetric)

func (*MetricContext) WithConfig

func (c *MetricContext) WithConfig(conf *Config)

func (*MetricContext) WithConfigs

func (c *MetricContext) WithConfigs(configs []*Config)

type Receiver

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

func (*Receiver) Read

func (r *Receiver) Read() interface{}

Read reads a value that has been broadcast, waiting until one is available if necessary.

Jump to

Keyboard shortcuts

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