2019-12-09 10:06:04 +00:00
|
|
|
package whisper
|
|
|
|
|
2019-12-20 09:40:50 +00:00
|
|
|
import (
|
|
|
|
prom "github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
2019-12-09 10:06:04 +00:00
|
|
|
|
|
|
|
var (
|
2019-12-20 09:40:50 +00:00
|
|
|
envelopesReceivedCounter = prom.NewCounter(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_envelopes_received_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of envelopes received.",
|
|
|
|
})
|
|
|
|
envelopesValidatedCounter = prom.NewCounter(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_envelopes_validated_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of envelopes processed successfully.",
|
|
|
|
})
|
|
|
|
envelopesRejectedCounter = prom.NewCounterVec(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_envelopes_rejected_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of envelopes rejected.",
|
|
|
|
}, []string{"reason"})
|
|
|
|
envelopesCacheFailedCounter = prom.NewCounterVec(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_envelopes_cache_failures_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of envelopes which failed to be cached.",
|
|
|
|
}, []string{"type"})
|
|
|
|
envelopesCachedCounter = prom.NewCounterVec(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_envelopes_cached_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of envelopes cached.",
|
|
|
|
}, []string{"cache"})
|
|
|
|
envelopesSizeMeter = prom.NewHistogram(prom.HistogramOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_envelopes_size_bytes",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Size of processed Waku envelopes in bytes.",
|
|
|
|
Buckets: prom.ExponentialBuckets(256, 4, 10),
|
|
|
|
})
|
2019-12-09 10:06:04 +00:00
|
|
|
// rate limiter metrics
|
2019-12-20 09:40:50 +00:00
|
|
|
rateLimitsProcessed = prom.NewCounter(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_rate_limits_processed_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of packets Waku rate limiter processed.",
|
|
|
|
})
|
|
|
|
rateLimitsExceeded = prom.NewCounterVec(prom.CounterOpts{
|
2020-01-08 11:12:23 +00:00
|
|
|
Name: "whisper_rate_limits_exceeded_total",
|
2019-12-20 09:40:50 +00:00
|
|
|
Help: "Number of times the Waku rate limits were exceeded",
|
|
|
|
}, []string{"type"})
|
2019-12-09 10:06:04 +00:00
|
|
|
)
|
2019-12-20 09:40:50 +00:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
prom.MustRegister(envelopesReceivedCounter)
|
|
|
|
prom.MustRegister(envelopesRejectedCounter)
|
|
|
|
prom.MustRegister(envelopesCacheFailedCounter)
|
|
|
|
prom.MustRegister(envelopesCachedCounter)
|
|
|
|
prom.MustRegister(envelopesSizeMeter)
|
|
|
|
prom.MustRegister(rateLimitsProcessed)
|
|
|
|
prom.MustRegister(rateLimitsExceeded)
|
|
|
|
}
|