Просмотр исходного кода

Merge branch 'master' into Bolt-profiling-thanos

Matt Bolt 6 лет назад
Родитель
Сommit
0632426267
2 измененных файлов с 6 добавлено и 4 удалено
  1. 0 1
      costmodel/costmodel.go
  2. 6 3
      costmodel/router.go

+ 0 - 1
costmodel/costmodel.go

@@ -2325,7 +2325,6 @@ func getNormalizations(qr interface{}) ([]*Vector, error) {
 	if len(results) > 0 {
 		vectors := []*Vector{}
 		for i := range results {
-			klog.Infof("%+v", results[i])
 			values, ok := results[i].(map[string]interface{})["values"].([]interface{})
 			for _, d := range values {
 				dataPoint := d.([]interface{})

+ 6 - 3
costmodel/router.go

@@ -491,8 +491,10 @@ func (a *Accesses) AggregateCostModel(w http.ResponseWriter, r *http.Request, ps
 	}
 
 	// determine resolution by size of duration
-	resolution := "1h"
-	if durationHours >= 2160 {
+	resolution := duration
+	if durationHours > 1 {
+		resolution = "1h"
+	} else if durationHours >= 2160 {
 		// 90 days
 		resolution = "72h"
 	} else if durationHours >= 720 {
@@ -1264,7 +1266,8 @@ func init() {
 
 			_, err = ValidatePrometheus(thanosCli, true)
 			if err != nil {
-				klog.Fatalf("Failed to query Thanos at %s. Error: %s.", thanosUrl, err.Error())
+				klog.V(1).Infof("Warning: Failed to query Thanos at %s. Error: %s.", thanosUrl, err.Error())
+				A.ThanosClient = thanosCli
 			} else {
 				klog.V(1).Info("Success: retrieved the 'up' query against Thanos at: " + thanosUrl)