mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
A few parameterizations.
This commit is contained in:
parent
ea1e6471de
commit
b2df1c375a
14
main.go
14
main.go
|
@ -32,8 +32,11 @@ import (
|
||||||
|
|
||||||
// Commandline flags.
|
// Commandline flags.
|
||||||
var (
|
var (
|
||||||
configFile = flag.String("configFile", "prometheus.conf", "Prometheus configuration file name.")
|
configFile = flag.String("configFile", "prometheus.conf", "Prometheus configuration file name.")
|
||||||
metricsStoragePath = flag.String("metricsStoragePath", "/tmp/metrics", "Base path for metrics storage.")
|
metricsStoragePath = flag.String("metricsStoragePath", "/tmp/metrics", "Base path for metrics storage.")
|
||||||
|
scrapeResultsQueueCapacity = flag.Int("scrapeResultsQueueCapacity", 4096, "The size of the scrape results queue.")
|
||||||
|
ruleResultsQueueCapacity = flag.Int("ruleResultsQueueCapacity", 4096, "The size of the rule results queue.")
|
||||||
|
concurrentRetrievalAllowance = flag.Int("concurrentRetrievalAllowance", 15, "The number of concurrent metrics retrieval requests allowed.")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -59,12 +62,13 @@ func main() {
|
||||||
|
|
||||||
defer persistence.Close()
|
defer persistence.Close()
|
||||||
|
|
||||||
scrapeResults := make(chan format.Result, 4096)
|
// Queue depth will need to be exposed
|
||||||
|
scrapeResults := make(chan format.Result, *scrapeResultsQueueCapacity)
|
||||||
|
|
||||||
targetManager := retrieval.NewTargetManager(scrapeResults, 1)
|
targetManager := retrieval.NewTargetManager(scrapeResults, *concurrentRetrievalAllowance)
|
||||||
targetManager.AddTargetsFromConfig(conf)
|
targetManager.AddTargetsFromConfig(conf)
|
||||||
|
|
||||||
ruleResults := make(chan *rules.Result, 4096)
|
ruleResults := make(chan *rules.Result, *ruleResultsQueueCapacity)
|
||||||
|
|
||||||
ast.SetPersistence(persistence, nil)
|
ast.SetPersistence(persistence, nil)
|
||||||
ruleManager := rules.NewRuleManager(ruleResults, conf.Global.EvaluationInterval)
|
ruleManager := rules.NewRuleManager(ruleResults, conf.Global.EvaluationInterval)
|
||||||
|
|
|
@ -134,6 +134,10 @@ func (t *target) Scrape(earliest time.Time, results chan format.Result) (err err
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
|
|
||||||
request := func() {
|
request := func() {
|
||||||
|
defer func() {
|
||||||
|
done <- true
|
||||||
|
}()
|
||||||
|
|
||||||
resp, err := http.Get(t.Address())
|
resp, err := http.Get(t.Address())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -157,8 +161,6 @@ func (t *target) Scrape(earliest time.Time, results chan format.Result) (err err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
done <- true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
accumulator := func(d time.Duration) {
|
accumulator := func(d time.Duration) {
|
||||||
|
|
Loading…
Reference in a new issue