Skip to content

Commit

Permalink
router metrics changed/disabled!
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Jul 18, 2017
1 parent c33c241 commit 9abed32
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions pkg/router/metrics/haproxy/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
25 changes: 15 additions & 10 deletions pkg/router/template/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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{}),
Expand Down

0 comments on commit 9abed32

Please sign in to comment.