From 9abed32592f1ddcecf163e133e7c8fc738929d16 Mon Sep 17 00:00:00 2001 From: deads2k Date: Thu, 6 Jul 2017 15:58:01 -0400 Subject: [PATCH] router metrics changed/disabled! --- pkg/router/metrics/haproxy/haproxy.go | 5 +++-- pkg/router/template/router.go | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pkg/router/metrics/haproxy/haproxy.go b/pkg/router/metrics/haproxy/haproxy.go index 8e868fd124d7..d5aa2ffa1288 100644 --- a/pkg/router/metrics/haproxy/haproxy.go +++ b/pkg/router/metrics/haproxy/haproxy.go @@ -415,8 +415,9 @@ loop: } e.serverLimited = servers > e.opts.ServerThreshold - e.serverThresholdCurrent.Set(float64(servers)) - e.serverThresholdLimit.Set(float64(e.opts.ServerThreshold)) + // TODO counters only go up + // e.serverThresholdCurrent.Set(float64(servers)) + // e.serverThresholdLimit.Set(float64(e.opts.ServerThreshold)) e.scrapeInterval = time.Duration(((float32(rows) / 1000) + 1) * float32(e.opts.BaseScrapeInterval)) e.nextScrapeInterval.Set(float64(e.scrapeInterval / time.Second)) diff --git a/pkg/router/template/router.go b/pkg/router/template/router.go index 59f7f8b7ee5a..aeca0a96fbe6 100644 --- a/pkg/router/template/router.go +++ b/pkg/router/template/router.go @@ -169,6 +169,19 @@ func newTemplateRouter(cfg templateRouterCfg) (*templateRouter, error) { return nil, err } + metricsReload := prometheus.NewSummary(prometheus.SummaryOpts{ + Namespace: "template_router", + Name: "reload_seconds", + Help: "Measures the time spent reloading the router in seconds.", + }) + prometheus.MustRegister(metricsReload) + metricWriteConfig := prometheus.NewSummary(prometheus.SummaryOpts{ + Namespace: "template_router", + Name: "write_config_seconds", + Help: "Measures the time spent writing out the router configuration to disk in seconds.", + }) + prometheus.MustRegister(metricWriteConfig) + router := &templateRouter{ dir: dir, templates: cfg.templates, @@ -190,16 +203,8 @@ func newTemplateRouter(cfg templateRouterCfg) (*templateRouter, error) { peerEndpoints: []Endpoint{}, bindPortsAfterSync: cfg.bindPortsAfterSync, - metricReload: prometheus.MustRegisterOrGet(prometheus.NewSummary(prometheus.SummaryOpts{ - Namespace: "template_router", - Name: "reload_seconds", - Help: "Measures the time spent reloading the router in seconds.", - })).(prometheus.Summary), - metricWriteConfig: prometheus.MustRegisterOrGet(prometheus.NewSummary(prometheus.SummaryOpts{ - Namespace: "template_router", - Name: "write_config_seconds", - Help: "Measures the time spent writing out the router configuration to disk in seconds.", - })).(prometheus.Summary), + metricReload: metricsReload, + metricWriteConfig: metricWriteConfig, rateLimitedCommitFunction: nil, rateLimitedCommitStopChannel: make(chan struct{}),