|
|
@@ -9,7 +9,6 @@ import (
|
|
|
|
|
|
"github.com/julienschmidt/httprouter"
|
|
|
"github.com/opencost/opencost/pkg/cloudcost"
|
|
|
- "github.com/opencost/opencost/pkg/customcost"
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
|
"github.com/rs/cors"
|
|
|
|
|
|
@@ -58,21 +57,6 @@ func Execute(opts *CostModelOpts) error {
|
|
|
a.CloudCostQueryService = cloudcost.NewQueryService(repoQuerier, repoQuerier)
|
|
|
}
|
|
|
|
|
|
- log.Infof("Custom Costs enabled: %t", env.IsCustomCostEnabled())
|
|
|
- if env.IsCustomCostEnabled() {
|
|
|
- hourlyRepo := customcost.NewMemoryRepository()
|
|
|
- dailyRepo := customcost.NewMemoryRepository()
|
|
|
- ingConfig := customcost.DefaultIngestorConfiguration()
|
|
|
- var err error
|
|
|
- a.CustomCostPipelineService, err = customcost.NewPipelineService(hourlyRepo, dailyRepo, ingConfig)
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("error instantiating custom cost pipeline service: %v", err)
|
|
|
- }
|
|
|
-
|
|
|
- customCostQuerier := customcost.NewQuerier(hourlyRepo, dailyRepo, ingConfig.HourlyDuration, ingConfig.DailyDuration)
|
|
|
- a.CustomCostQueryService = customcost.NewQueryService(customCostQuerier)
|
|
|
- }
|
|
|
-
|
|
|
rootMux := http.NewServeMux()
|
|
|
a.Router.GET("/healthz", Healthz)
|
|
|
|
|
|
@@ -91,9 +75,6 @@ func Execute(opts *CostModelOpts) error {
|
|
|
a.Router.GET("/cloudCost/rebuild", a.CloudCostPipelineService.GetCloudCostRebuildHandler())
|
|
|
a.Router.GET("/cloudCost/repair", a.CloudCostPipelineService.GetCloudCostRepairHandler())
|
|
|
|
|
|
- a.Router.GET("/customCost/total", a.CustomCostQueryService.GetCustomCostTotalHandler())
|
|
|
- a.Router.GET("/customCost/timeseries", a.CustomCostQueryService.GetCustomCostTimeseriesHandler())
|
|
|
-
|
|
|
if env.IsPProfEnabled() {
|
|
|
a.Router.HandlerFunc(http.MethodGet, "/debug/pprof/", pprof.Index)
|
|
|
a.Router.HandlerFunc(http.MethodGet, "/debug/pprof/cmdline", pprof.Cmdline)
|