1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

metric: new pkg refactored from log for #90

This commit is contained in:
James Hillyerd
2018-03-31 12:16:54 -07:00
parent 779b1e63af
commit 6601d156be
3 changed files with 30 additions and 29 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/jhillyerd/inbucket/pkg/config"
"github.com/jhillyerd/inbucket/pkg/message"
"github.com/jhillyerd/inbucket/pkg/metric"
"github.com/jhillyerd/inbucket/pkg/policy"
"github.com/rs/zerolog/log"
)
@@ -27,13 +28,12 @@ func init() {
m.Set("WarnsTotal", expWarnsTotal)
m.Set("WarnsHist", expWarnsHist)
// TODO #90 move elsewhere
// log.AddTickerFunc(func() {
// expReceivedHist.Set(log.PushMetric(deliveredHist, expReceivedTotal))
// expConnectsHist.Set(log.PushMetric(connectsHist, expConnectsTotal))
// expErrorsHist.Set(log.PushMetric(errorsHist, expErrorsTotal))
// expWarnsHist.Set(log.PushMetric(warnsHist, expWarnsTotal))
// })
metric.AddTickerFunc(func() {
expReceivedHist.Set(metric.Push(deliveredHist, expReceivedTotal))
expConnectsHist.Set(metric.Push(connectsHist, expConnectsTotal))
expErrorsHist.Set(metric.Push(errorsHist, expErrorsTotal))
expWarnsHist.Set(metric.Push(warnsHist, expWarnsTotal))
})
}
// Server holds the configuration and state of our SMTP server