Improve xpub cache

This commit is contained in:
Martin Boehm
2021-04-28 18:00:13 +02:00
parent 1df8f8eb69
commit 1d55a66fab
8 changed files with 52 additions and 36 deletions

View File

@@ -32,6 +32,7 @@ type Metrics struct {
ExplorerPendingRequests *prometheus.GaugeVec
WebsocketPendingRequests *prometheus.GaugeVec
SocketIOPendingRequests *prometheus.GaugeVec
XPubCacheSize prometheus.Gauge
}
// Labels represents a collection of label name -> value mappings.
@@ -230,6 +231,13 @@ func GetMetrics(coin string) (*Metrics, error) {
},
[]string{"method"},
)
metrics.XPubCacheSize = prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "blockbook_xpub_cache_size",
Help: "Number of cached xpubs",
ConstLabels: Labels{"coin": coin},
},
)
v := reflect.ValueOf(metrics)
for i := 0; i < v.NumField(); i++ {