From 32688b2e727e2a21453ef1feebc9e21b386be744 Mon Sep 17 00:00:00 2001 From: flyingcat <1004815462@qq.com> Date: Fri, 24 Jul 2020 16:28:44 +0800 Subject: [PATCH] fix typp (#3006) Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com> --- pkg/autoscaler/autoscaler/calculate/calculate.go | 4 ++-- pkg/autoscaler/autoscaler/tidb_autoscaler.go | 2 +- pkg/autoscaler/autoscaler/tikv_autoscaler.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/autoscaler/autoscaler/calculate/calculate.go b/pkg/autoscaler/autoscaler/calculate/calculate.go index 9194c492c1..667137586c 100644 --- a/pkg/autoscaler/autoscaler/calculate/calculate.go +++ b/pkg/autoscaler/autoscaler/calculate/calculate.go @@ -42,12 +42,12 @@ const ( type SingleQuery struct { Endpoint string Timestamp int64 - Quary string + Query string Instances []string } func queryMetricsFromPrometheus(tac *v1alpha1.TidbClusterAutoScaler, client promClient.Client, sq *SingleQuery, resp *Response) error { - query := sq.Quary + query := sq.Query timestamp := sq.Timestamp ctx, cancel := context.WithTimeout(context.Background(), time.Second*httpRequestTimeout) diff --git a/pkg/autoscaler/autoscaler/tidb_autoscaler.go b/pkg/autoscaler/autoscaler/tidb_autoscaler.go index 83c79e0bcb..3cbfe32b61 100644 --- a/pkg/autoscaler/autoscaler/tidb_autoscaler.go +++ b/pkg/autoscaler/autoscaler/tidb_autoscaler.go @@ -108,7 +108,7 @@ func calculateTidbMetrics(tac *v1alpha1.TidbClusterAutoScaler, sts *appsv1.State Endpoint: ep, Timestamp: time.Now().Unix(), Instances: instances, - Quary: fmt.Sprintf(calculate.TidbSumCpuMetricsPattern, tac.Spec.Cluster.Name, *tac.Spec.TiDB.MetricsTimeDuration), + Query: fmt.Sprintf(calculate.TidbSumCpuMetricsPattern, tac.Spec.Cluster.Name, *tac.Spec.TiDB.MetricsTimeDuration), } return calculate.CalculateRecomendedReplicasByCpuCosts(tac, sq, sts, client, v1alpha1.TiDBMemberType, duration, metrics[0].MetricSpec) } diff --git a/pkg/autoscaler/autoscaler/tikv_autoscaler.go b/pkg/autoscaler/autoscaler/tikv_autoscaler.go index ece5e41290..cb80e7ee78 100644 --- a/pkg/autoscaler/autoscaler/tikv_autoscaler.go +++ b/pkg/autoscaler/autoscaler/tikv_autoscaler.go @@ -90,7 +90,7 @@ func calculateTiKVMetrics(tac *v1alpha1.TidbClusterAutoScaler, tc *v1alpha1.Tidb Endpoint: ep, Timestamp: time.Now().Unix(), Instances: instances, - Quary: fmt.Sprintf(calculate.TikvSumCpuMetricsPattern, tac.Spec.Cluster.Name, *tac.Spec.TiKV.MetricsTimeDuration), + Query: fmt.Sprintf(calculate.TikvSumCpuMetricsPattern, tac.Spec.Cluster.Name, *tac.Spec.TiKV.MetricsTimeDuration), } return calculateTiKVCPUMetrics(tac, tc, sts, sq, client, duration, metrics[0]) } @@ -103,13 +103,13 @@ func calculateTiKVMetrics(tac *v1alpha1.TidbClusterAutoScaler, tc *v1alpha1.Tidb Endpoint: ep, Timestamp: now, Instances: instances, - Quary: fmt.Sprintf(calculate.TikvSumStorageMetricsPattern, tac.Spec.Cluster.Name, "capacity"), + Query: fmt.Sprintf(calculate.TikvSumStorageMetricsPattern, tac.Spec.Cluster.Name, "capacity"), } availableSq := &calculate.SingleQuery{ Endpoint: ep, Timestamp: now, Instances: instances, - Quary: fmt.Sprintf(calculate.TikvSumStorageMetricsPattern, tac.Spec.Cluster.Name, "available"), + Query: fmt.Sprintf(calculate.TikvSumStorageMetricsPattern, tac.Spec.Cluster.Name, "available"), } return calculateTiKVStorageMetrics(tac, tc, capacitySq, availableSq, client, metrics[0]) }