|
|
@@ -4,7 +4,6 @@ import (
|
|
|
"context"
|
|
|
"flag"
|
|
|
"fmt"
|
|
|
- "github.com/kubecost/cost-model/pkg/util/timeutil"
|
|
|
"net/http"
|
|
|
"reflect"
|
|
|
"strconv"
|
|
|
@@ -12,6 +11,8 @@ import (
|
|
|
"sync"
|
|
|
"time"
|
|
|
|
|
|
+ "github.com/kubecost/cost-model/pkg/util/timeutil"
|
|
|
+
|
|
|
"k8s.io/klog"
|
|
|
|
|
|
"github.com/julienschmidt/httprouter"
|
|
|
@@ -401,7 +402,6 @@ func (a *Accesses) ClusterCosts(w http.ResponseWriter, r *http.Request, ps httpr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
useThanos, _ := strconv.ParseBool(r.URL.Query().Get("multi"))
|
|
|
|
|
|
if useThanos && !thanos.IsEnabled() {
|
|
|
@@ -722,6 +722,16 @@ func (a *Accesses) GetPrometheusMetadata(w http.ResponseWriter, _ *http.Request,
|
|
|
w.Write(WrapData(prom.Validate(a.PrometheusClient)))
|
|
|
}
|
|
|
|
|
|
+func (a *Accesses) GetPrometheusQueueState(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {
|
|
|
+ w.Header().Set("Content-Type", "application/json")
|
|
|
+ w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
+
|
|
|
+ promClient := a.GetPrometheusClient(true)
|
|
|
+ queueState, err := prom.GetPrometheusQueueState(promClient)
|
|
|
+
|
|
|
+ w.Write(WrapData(queueState, err))
|
|
|
+}
|
|
|
+
|
|
|
// Creates a new ClusterManager instance using a boltdb storage. If that fails,
|
|
|
// then we fall back to a memory-only storage.
|
|
|
func newClusterManager() *cm.ClusterManager {
|
|
|
@@ -1073,6 +1083,9 @@ func Initialize(additionalConfigWatchers ...ConfigWatchers) *Accesses {
|
|
|
a.Router.GET("/pricingSourceStatus", a.GetPricingSourceStatus)
|
|
|
a.Router.GET("/pricingSourceCounts", a.GetPricingSourceCounts)
|
|
|
|
|
|
+ // diagnostics
|
|
|
+ a.Router.GET("/diagnostics/requestQueue", a.GetPrometheusQueueState)
|
|
|
+
|
|
|
// cluster manager endpoints
|
|
|
a.Router.GET("/clusters", managerEndpoints.GetAllClusters)
|
|
|
a.Router.PUT("/clusters", managerEndpoints.PutCluster)
|