Skip to content

Commit

Permalink
add option for remote read concurrencylimit (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedius authored Nov 2, 2023
1 parent 1db4b3d commit 10918b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
12 changes: 7 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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: "",
Expand Down
33 changes: 17 additions & 16 deletions prometheus/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,23 @@ func Run(config *config.Config) error {
notifierManager := notifier.NewManager(&notifier.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{})
Expand Down

0 comments on commit 10918b8

Please sign in to comment.