From 035976b275c1a82abeaf1bbbeb0f2a3ff4b53411 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Thu, 19 Jan 2017 11:29:00 +0100 Subject: [PATCH] retrieval: handle not found error correctly --- cmd/prometheus/main.go | 18 +++++++++++++++++- promql/functions.go | 3 --- retrieval/target.go | 6 +++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 0f5b21e451..62c8728a9d 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -20,6 +20,8 @@ import ( _ "net/http/pprof" // Comment this line to disable pprof endpoint. "os" "os/signal" + "runtime" + "runtime/trace" "syscall" "time" @@ -56,10 +58,24 @@ var ( func init() { prometheus.MustRegister(version.NewCollector("prometheus")) + runtime.SetMutexProfileFraction(20) + runtime.SetBlockProfileRate(20) } -// Main manages the startup and shutdown lifecycle of the entire Prometheus server. +// Main manages the stup and shutdown lifecycle of the entire Prometheus server. func Main() int { + go func() { + f, err := os.Create("trace") + if err != nil { + panic(err) + } + if err := trace.Start(f); err != nil { + panic(err) + } + time.Sleep(30 * time.Second) + trace.Stop() + f.Close() + }() if err := parse(os.Args[1:]); err != nil { log.Error(err) return 2 diff --git a/promql/functions.go b/promql/functions.go index b66e008c9d..6aca50601c 100644 --- a/promql/functions.go +++ b/promql/functions.go @@ -14,7 +14,6 @@ package promql import ( - "fmt" "math" "regexp" "sort" @@ -725,8 +724,6 @@ func funcHistogramQuantile(ev *evaluator, args Expressions) Value { q := ev.evalFloat(args[0]) inVec := ev.evalVector(args[1]) - fmt.Println("invec", inVec) - outVec := Vector{} signatureToMetricWithBuckets := map[uint64]*metricWithBuckets{} for _, el := range inVec { diff --git a/retrieval/target.go b/retrieval/target.go index ccf8c12d9f..2f31af7875 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -78,9 +78,9 @@ func NewHTTPClient(cfg config.HTTPClientConfig) (*http.Client, error) { // The only timeout we care about is the configured scrape timeout. // It is applied on request. So we leave out any timings here. var rt http.RoundTripper = &http.Transport{ - Proxy: http.ProxyURL(cfg.ProxyURL.URL), - DisableKeepAlives: true, - TLSClientConfig: tlsConfig, + Proxy: http.ProxyURL(cfg.ProxyURL.URL), + MaxIdleConns: 10000, + TLSClientConfig: tlsConfig, } // If a bearer token is provided, create a round tripper that will set the