|
|
@@ -1412,12 +1412,12 @@ func (a *Accesses) Status(w http.ResponseWriter, r *http.Request, _ httprouter.P
|
|
|
promServer := env.GetPrometheusServerEndpoint()
|
|
|
|
|
|
api := prometheusAPI.NewAPI(a.PrometheusClient)
|
|
|
- result, err := api.Config(r.Context())
|
|
|
+ result, err := api.Buildinfo(r.Context())
|
|
|
if err != nil {
|
|
|
fmt.Fprintf(w, "Using Prometheus at "+promServer+". Error: "+err.Error())
|
|
|
} else {
|
|
|
|
|
|
- fmt.Fprintf(w, "Using Prometheus at "+promServer+". PrometheusConfig: "+result.YAML)
|
|
|
+ fmt.Fprintf(w, "Using Prometheus at "+promServer+". Version: "+result.Version)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1519,7 +1519,7 @@ func Initialize(additionalConfigWatchers ...*watcher.ConfigMapWatcher) *Accesses
|
|
|
timeout := 120 * time.Second
|
|
|
keepAlive := 120 * time.Second
|
|
|
tlsHandshakeTimeout := 10 * time.Second
|
|
|
- scrapeInterval := time.Minute
|
|
|
+ scrapeInterval := env.GetKubecostScrapeInterval()
|
|
|
|
|
|
var rateLimitRetryOpts *prom.RateLimitRetryOpts = nil
|
|
|
if env.IsPrometheusRetryOnRateLimitResponse() {
|
|
|
@@ -1560,17 +1560,20 @@ func Initialize(additionalConfigWatchers ...*watcher.ConfigMapWatcher) *Accesses
|
|
|
}
|
|
|
|
|
|
api := prometheusAPI.NewAPI(promCli)
|
|
|
- _, err = api.Config(context.Background())
|
|
|
+ _, err = api.Buildinfo(context.Background())
|
|
|
if err != nil {
|
|
|
log.Infof("No valid prometheus config file at %s. Error: %s . Troubleshooting help available at: %s. Ignore if using cortex/mimir/thanos here.", address, err.Error(), prom.PrometheusTroubleshootingURL)
|
|
|
} else {
|
|
|
log.Infof("Retrieved a prometheus config file from: %s", address)
|
|
|
}
|
|
|
|
|
|
- // Lookup scrape interval for kubecost job, update if found
|
|
|
- si, err := prom.ScrapeIntervalFor(promCli, env.GetKubecostJobName())
|
|
|
- if err == nil {
|
|
|
- scrapeInterval = si
|
|
|
+ if scrapeInterval == 0 {
|
|
|
+ scrapeInterval = time.Minute
|
|
|
+ // Lookup scrape interval for kubecost job, update if found
|
|
|
+ si, err := prom.ScrapeIntervalFor(promCli, env.GetKubecostJobName())
|
|
|
+ if err == nil {
|
|
|
+ scrapeInterval = si
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
log.Infof("Using scrape interval of %f", scrapeInterval.Seconds())
|