Browse Source

Merge pull request #861 from kitianFresh/bugfix/deal-with-error-when-init-prometheus-client

deal with prometheus client init error and fatal exit when there has error
Ajay Tripathy 4 năm trước cách đây
mục cha
commit
5448a991ee
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      pkg/costmodel/router.go

+ 4 - 1
pkg/costmodel/router.go

@@ -817,7 +817,10 @@ func Initialize(additionalConfigWatchers ...ConfigWatchers) *Accesses {
 	keepAlive := 120 * time.Second
 	scrapeInterval, _ := time.ParseDuration("1m")
 
-	promCli, _ := prom.NewPrometheusClient(address, timeout, keepAlive, queryConcurrency, "")
+	promCli, err := prom.NewPrometheusClient(address, timeout, keepAlive, queryConcurrency, "")
+	if err != nil {
+		klog.Fatalf("Failed to create prometheus client, Error: %v", err)
+	}
 
 	api := prometheusAPI.NewAPI(promCli)
 	pcfg, err := api.Config(context.Background())