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

Issue #173 remove new normalization of offset, which was breaking things

Niko Kovacevic 6 лет назад
Родитель
Сommit
84b44211fb
2 измененных файлов с 3 добавлено и 9 удалено
  1. 1 7
      costmodel/router.go
  2. 2 2
      main.go

+ 1 - 7
costmodel/router.go

@@ -298,7 +298,7 @@ func (a *Accesses) AggregateCostModel(w http.ResponseWriter, r *http.Request, ps
 		endTime = endTime.Add(-1 * o)
 	}
 
-	// if window or offset are defined in terms of days, convert to hours
+	// if window is defined in terms of days, convert to hours
 	// e.g. convert "2d" to "48h"
 	window, err := normalizeTimeParam(window)
 	if err != nil {
@@ -306,12 +306,6 @@ func (a *Accesses) AggregateCostModel(w http.ResponseWriter, r *http.Request, ps
 		return
 	}
 
-	offset, err = normalizeTimeParam(offset)
-	if err != nil {
-		w.Write(wrapData(nil, err))
-		return
-	}
-
 	// convert time window into start and end times, formatted
 	// as ISO datetime strings
 	d, err := time.ParseDuration(window)

+ 2 - 2
main.go

@@ -3,14 +3,14 @@ package main
 import (
 	"net/http"
 
-	costModel "github.com/kubecost/cost-model/costmodel"
+	"github.com/kubecost/cost-model/costmodel"
 	"github.com/prometheus/client_golang/prometheus/promhttp"
 	"k8s.io/klog"
 )
 
 func main() {
 	rootMux := http.NewServeMux()
-	rootMux.Handle("/", costModel.Router)
+	rootMux.Handle("/", costmodel.Router)
 	rootMux.Handle("/metrics", promhttp.Handler())
 	klog.Fatal(http.ListenAndServe(":9003", rootMux))
 }