From 10918b8a0f4d2d94f20dd6b94da13b7445333464 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 2 Nov 2023 16:24:13 +0100 Subject: [PATCH] add option for remote read concurrencylimit (#245) --- config/config.go | 12 +++++++----- prometheus/run.go | 33 +++++++++++++++++---------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/config/config.go b/config/config.go index 1742e3177..06f477031 100644 --- a/config/config.go +++ b/config/config.go @@ -278,11 +278,12 @@ type Carbonlink struct { // Prometheus configuration type Prometheus struct { - Listen string `toml:"listen" json:"listen" comment:"listen addr for prometheus ui and api"` - ExternalURLRaw string `toml:"external-url" json:"external-url" comment:"allows to set URL for redirect manually"` - ExternalURL *url.URL `toml:"-" json:"-"` - PageTitle string `toml:"page-title" json:"page-title"` - LookbackDelta time.Duration `toml:"lookback-delta" json:"lookback-delta"` + Listen string `toml:"listen" json:"listen" comment:"listen addr for prometheus ui and api"` + ExternalURLRaw string `toml:"external-url" json:"external-url" comment:"allows to set URL for redirect manually"` + ExternalURL *url.URL `toml:"-" json:"-"` + PageTitle string `toml:"page-title" json:"page-title"` + LookbackDelta time.Duration `toml:"lookback-delta" json:"lookback-delta"` + RemoteReadConcurrencyLimit int `toml:"remote-read-concurrency-limit" json:"remote-read-concurrency-limit" comment:"concurrently handled remote read requests"` } const ( @@ -396,6 +397,7 @@ func New() *Config { PageTitle: "Prometheus Time Series Collection and Processing Server", Listen: ":9092", LookbackDelta: 5 * time.Minute, + RemoteReadConcurrencyLimit: 10, }, Debug: Debug{ Directory: "", diff --git a/prometheus/run.go b/prometheus/run.go index b9ec9a3e4..147d9876e 100644 --- a/prometheus/run.go +++ b/prometheus/run.go @@ -49,22 +49,23 @@ func Run(config *config.Config) error { notifierManager := notifier.NewManager(¬ifier.Options{}, zapLogger) promHandler := web.New(zapLogger, &web.Options{ - ListenAddress: config.Prometheus.Listen, - MaxConnections: 500, - Storage: storage, - ExemplarStorage: &nopExemplarQueryable{}, - ExternalURL: config.Prometheus.ExternalURL, - RoutePrefix: "/", - QueryEngine: queryEngine, - ScrapeManager: scrapeManager, - RuleManager: rulesManager, - Flags: make(map[string]string), - LocalStorage: storage, - Gatherer: &nopGatherer{}, - Notifier: notifierManager, - CORSOrigin: corsOrigin, - PageTitle: config.Prometheus.PageTitle, - LookbackDelta: config.Prometheus.LookbackDelta, + ListenAddress: config.Prometheus.Listen, + MaxConnections: 500, + Storage: storage, + ExemplarStorage: &nopExemplarQueryable{}, + ExternalURL: config.Prometheus.ExternalURL, + RoutePrefix: "/", + QueryEngine: queryEngine, + ScrapeManager: scrapeManager, + RuleManager: rulesManager, + Flags: make(map[string]string), + LocalStorage: storage, + Gatherer: &nopGatherer{}, + Notifier: notifierManager, + CORSOrigin: corsOrigin, + PageTitle: config.Prometheus.PageTitle, + LookbackDelta: config.Prometheus.LookbackDelta, + RemoteReadConcurrencyLimit: config.Prometheus.RemoteReadConcurrencyLimit, }) promHandler.ApplyConfig(&promConfig.Config{})