Skip to content

Commit

Permalink
revise util func
Browse files Browse the repository at this point in the history
  • Loading branch information
Song Gao committed Feb 24, 2020
1 parent 21dc6d8 commit 81546a0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/autoscaler/autoscaler/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,8 @@ func genMetricsEndpoint(tac *v1alpha1.TidbClusterAutoScaler) (string, error) {
if tac.Spec.MetricsUrl == nil && tac.Spec.Monitor == nil {
return "", fmt.Errorf("tac[%s/%s] metrics url or monitor should be defined explicitly", tac.Namespace, tac.Name)
}
conn := ""
if tac.Spec.Monitor != nil {
conn = fmt.Sprintf("http://%s-prometheus.%s.svc:9090", tac.Spec.Monitor.Name, tac.Spec.Monitor.Namespace)
}
if tac.Spec.MetricsUrl != nil {
conn = *tac.Spec.MetricsUrl
return *tac.Spec.MetricsUrl, nil
}
return conn, nil
return fmt.Sprintf("http://%s-prometheus.%s.svc:9090", tac.Spec.Monitor.Name, tac.Spec.Monitor.Namespace), nil
}

0 comments on commit 81546a0

Please sign in to comment.