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

Add MaxQueryConcurrency to the state payload.

Matt Bolt 4 лет назад
Родитель
Сommit
a7edca93b5
1 измененных файлов с 9 добавлено и 6 удалено
  1. 9 6
      pkg/prom/diagnostics.go

+ 9 - 6
pkg/prom/diagnostics.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"time"
 
+	"github.com/kubecost/cost-model/pkg/env"
 	"github.com/kubecost/cost-model/pkg/log"
 	prometheus "github.com/prometheus/client_golang/api"
 )
@@ -19,9 +20,10 @@ type QueuedPromRequest struct {
 // PrometheusQueueState contains diagnostic information concerning the state of the prometheus request
 // queue
 type PrometheusQueueState struct {
-	QueuedRequests   []*QueuedPromRequest `json:"queuedRequests"`
-	OutboundRequests int                  `json:"outboundRequests"`
-	TotalRequests    int                  `json:"totalRequests"`
+	QueuedRequests      []*QueuedPromRequest `json:"queuedRequests"`
+	OutboundRequests    int                  `json:"outboundRequests"`
+	TotalRequests       int                  `json:"totalRequests"`
+	MaxQueryConcurrency int                  `json:"maxQueryConcurrency"`
 }
 
 // GetPrometheusQueueState is a diagnostic function that probes the prometheus request queue and gathers
@@ -46,9 +48,10 @@ func GetPrometheusQueueState(client prometheus.Client) (*PrometheusQueueState, e
 	})
 
 	return &PrometheusQueueState{
-		QueuedRequests:   requests,
-		OutboundRequests: outbound,
-		TotalRequests:    outbound + len(requests),
+		QueuedRequests:      requests,
+		OutboundRequests:    outbound,
+		TotalRequests:       outbound + len(requests),
+		MaxQueryConcurrency: env.GetMaxQueryConcurrency(),
 	}, nil
 }