Documentation ¶
Index ¶
- Constants
- func CalculateRecomendedReplicasByCpuCosts(tac *v1alpha1.TidbClusterAutoScaler, sq *SingleQuery, sts *appsv1.StatefulSet, ...) (int32, error)
- func FilterMetrics(metrics []autoscalingv2beta2.MetricSpec) autoscalingv2beta2.MetricSpec
- type Data
- type Metric
- type MetricType
- type Response
- type Result
- type SingleQuery
Constants ¶
View Source
const ( TikvSumCpuMetricsPattern = `sum(increase(tikv_thread_cpu_seconds_total{cluster="%s"}[%s])) by (instance)` TidbSumCpuMetricsPattern = `sum(increase(process_cpu_seconds_total{cluster="%s",job="tidb"}[%s])) by (instance)` InvalidTacMetricConfigureMsg = "tac[%s/%s] metric configuration invalid" )
View Source
const (
CpuSumMetricsErrorMsg = "" /* 142-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
func CalculateRecomendedReplicasByCpuCosts ¶
func CalculateRecomendedReplicasByCpuCosts(tac *v1alpha1.TidbClusterAutoScaler, sq *SingleQuery, sts *appsv1.StatefulSet, client promClient.Client, memberType v1alpha1.MemberType, duration time.Duration) (int32, error)
TODO: create issue to explain how auto-scaling algorithm based on cpu metrics work
func FilterMetrics ¶
func FilterMetrics(metrics []autoscalingv2beta2.MetricSpec) autoscalingv2beta2.MetricSpec
currently, we only choose one metrics to be computed. If there exists several metrics, we tend to choose ResourceMetricSourceType metric
Types ¶
type Metric ¶
type Metric struct { Cluster string `json:"cluster,omitempty"` Instance string `json:"instance"` Job string `json:"job,omitempty"` KubernetesNamespace string `json:"kubernetes_namespace,omitempty"` KubernetesNode string `json:"kubernetes_node,omitempty"` KubernetesPodIp string `json:"kubernetes_pod_ip,omitempty"` }
type MetricType ¶
type MetricType string
MetricType describe the current Supported Metric Type to calculate the recommended Replicas
const (
MetricTypeCPU MetricType = "cpu"
)
func GenMetricType ¶
func GenMetricType(tac *v1alpha1.TidbClusterAutoScaler, metric autoscalingv2beta2.MetricSpec) (MetricType, error)
genMetricType return the supported MetricType in Operator by kubernetes auto-scaling MetricType
type Result ¶
type Result struct { Metric Metric `json:"metric"` Value []interface{} `json:"value"` }
type SingleQuery ¶
type SingleQuery struct { Endpoint string Timestamp int64 Quary string Instances []string Metric autoscalingv2beta2.MetricSpec }
Click to show internal directories.
Click to hide internal directories.