mirror of https://github.com/0xERR0R/blocky.git
added last list group refresh timestamp metric
This commit is contained in:
parent
e94505557e
commit
54c2ad870d
|
@ -4,6 +4,7 @@ import (
|
|||
"blocky/evt"
|
||||
"blocky/lists"
|
||||
"blocky/util"
|
||||
"time"
|
||||
|
||||
"fmt"
|
||||
|
||||
|
@ -53,10 +54,14 @@ func registerBlockingEventListeners() {
|
|||
|
||||
whitelistCnt := whitelistGauge()
|
||||
|
||||
lastListGroupRefresh := lastListGroupRefresh()
|
||||
|
||||
RegisterMetric(blacklistCnt)
|
||||
RegisterMetric(whitelistCnt)
|
||||
RegisterMetric(lastListGroupRefresh)
|
||||
|
||||
subscribe(evt.BlockingCacheGroupChanged, func(listType lists.ListCacheType, groupName string, cnt int) {
|
||||
lastListGroupRefresh.Set(float64(time.Now().Unix()))
|
||||
switch listType {
|
||||
case lists.BLACKLIST:
|
||||
blacklistCnt.WithLabelValues(groupName).Set(float64(cnt))
|
||||
|
@ -98,6 +103,15 @@ func whitelistGauge() *prometheus.GaugeVec {
|
|||
return whitelistCnt
|
||||
}
|
||||
|
||||
func lastListGroupRefresh() prometheus.Gauge {
|
||||
return prometheus.NewGauge(
|
||||
prometheus.GaugeOpts{
|
||||
Name: "blocky_last_list_group_refresh",
|
||||
Help: "Timestamp of last list refresh",
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func registerCachingEventListeners() {
|
||||
entryCount := cacheEntryCount()
|
||||
prefetchDomainCount := prefetchDomainCacheCount()
|
||||
|
@ -149,6 +163,7 @@ func cacheMissCount() prometheus.Counter {
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
func domainPrefetchCount() prometheus.Counter {
|
||||
return prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
|
|
Loading…
Reference in New Issue