1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-23 04:27:03 +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

@@ -7,6 +7,7 @@ import (
"time"
"github.com/jhillyerd/inbucket/pkg/config"
"github.com/jhillyerd/inbucket/pkg/metric"
"github.com/rs/zerolog/log"
)
@@ -42,12 +43,11 @@ func init() {
rm.Set("RetainedSize", expRetainedSize)
rm.Set("SizeHist", expSizeHist)
// TODO #90 move
// log.AddTickerFunc(func() {
// expRetentionDeletesHist.Set(log.PushMetric(retentionDeletesHist, expRetentionDeletesTotal))
// expRetainedHist.Set(log.PushMetric(retainedHist, expRetainedCurrent))
// expSizeHist.Set(log.PushMetric(sizeHist, expRetainedSize))
// })
metric.AddTickerFunc(func() {
expRetentionDeletesHist.Set(metric.Push(retentionDeletesHist, expRetentionDeletesTotal))
expRetainedHist.Set(metric.Push(retainedHist, expRetainedCurrent))
expSizeHist.Set(metric.Push(sizeHist, expRetainedSize))
})
}
// RetentionScanner looks for messages older than the configured retention period and deletes them.