Skip to content

Commit

Permalink
Merge branch 'removeCloudTempData' of https://github.com/lichunzhu/ti…
Browse files Browse the repository at this point in the history
…db-operator into removeCloudTempData
  • Loading branch information
lichunzhu committed Jul 24, 2020
2 parents 4e1d38f + 32d164f commit c5e77dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/autoscaler/autoscaler/calculate/calculate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/autoscaler/autoscaler/tidb_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/autoscaler/autoscaler/tikv_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
Expand All @@ -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])
}
Expand Down

0 comments on commit c5e77dc

Please sign in to comment.