2021-07-06 02:20:38 +02:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2021-10-15 22:26:33 +02:00
|
|
|
HistogramBuckets = []float64{0.005, 0.025, 0.05, 0.1, 0.25, 0.4, 1, 2, 5, 10, 20, 60, 120, 300}
|
|
|
|
// These mirror counters from the python code
|
|
|
|
RequestsCount = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
|
|
Name: "requests_count",
|
|
|
|
Help: "Total number of searches",
|
|
|
|
}, []string{"method"})
|
|
|
|
// These are unique to the go code
|
2021-10-21 08:52:03 +02:00
|
|
|
ErrorsCounter = promauto.NewCounterVec(prometheus.CounterOpts{
|
|
|
|
Name: "errors",
|
|
|
|
Help: "Number of errors by type",
|
|
|
|
}, []string{"error_type"})
|
2021-10-15 22:26:33 +02:00
|
|
|
QueryTime = promauto.NewHistogramVec(prometheus.HistogramOpts{
|
2021-07-06 02:20:38 +02:00
|
|
|
Name: "query_time",
|
2021-10-15 22:26:33 +02:00
|
|
|
Help: "Histogram of query times",
|
|
|
|
Buckets: HistogramBuckets,
|
|
|
|
}, []string{"method"})
|
2021-10-30 07:27:25 +02:00
|
|
|
PeersKnown = promauto.NewGauge(prometheus.GaugeOpts{
|
|
|
|
Name: "peers_known",
|
|
|
|
Help: "Number of peers we know about.",
|
|
|
|
})
|
|
|
|
PeersSubscribed = promauto.NewGauge(prometheus.GaugeOpts{
|
|
|
|
Name: "peers_subbed",
|
|
|
|
Help: "Number of peers that are subscribed to us.",
|
|
|
|
})
|
2021-07-06 02:20:38 +02:00
|
|
|
)
|
|
|
|
|