github.com/status-im/status-go@v1.1.0/waku/common/metrics.go (about) 1 // Copyright 2019 The Waku Library Authors. 2 // 3 // The Waku library is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Lesser General Public License as published by 5 // the Free Software Foundation, either version 3 of the License, or 6 // (at your option) any later version. 7 // 8 // The Waku library is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty off 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Lesser General Public License for more details. 12 // 13 // You should have received a copy of the GNU Lesser General Public License 14 // along with the Waku library. If not, see <http://www.gnu.org/licenses/>. 15 // 16 // This software uses the go-ethereum library, which is licensed 17 // under the GNU Lesser General Public Library, version 3 or any later. 18 19 package common 20 21 import ( 22 prom "github.com/prometheus/client_golang/prometheus" 23 ) 24 25 var ( 26 EnvelopesReceivedCounter = prom.NewCounter(prom.CounterOpts{ 27 Name: "waku_envelopes_received_total", 28 Help: "Number of envelopes received.", 29 }) 30 EnvelopesValidatedCounter = prom.NewCounter(prom.CounterOpts{ 31 Name: "waku_envelopes_validated_total", 32 Help: "Number of envelopes processed successfully.", 33 }) 34 EnvelopesRejectedCounter = prom.NewCounterVec(prom.CounterOpts{ 35 Name: "waku_envelopes_rejected_total", 36 Help: "Number of envelopes rejected.", 37 }, []string{"reason"}) 38 EnvelopesCacheFailedCounter = prom.NewCounterVec(prom.CounterOpts{ 39 Name: "waku_envelopes_cache_failures_total", 40 Help: "Number of envelopes which failed to be cached.", 41 }, []string{"type"}) 42 EnvelopesCachedCounter = prom.NewCounterVec(prom.CounterOpts{ 43 Name: "waku_envelopes_cached_total", 44 Help: "Number of envelopes cached.", 45 }, []string{"cache"}) 46 EnvelopesSizeMeter = prom.NewHistogram(prom.HistogramOpts{ 47 Name: "waku_envelopes_size_bytes", 48 Help: "Size of processed Waku envelopes in bytes.", 49 Buckets: prom.ExponentialBuckets(256, 4, 10), 50 }) 51 RateLimitsProcessed = prom.NewCounter(prom.CounterOpts{ 52 Name: "waku_rate_limits_processed_total", 53 Help: "Number of packets Waku rate limiter processed.", 54 }) 55 RateLimitsExceeded = prom.NewCounterVec(prom.CounterOpts{ 56 Name: "waku_rate_limits_exceeded_total", 57 Help: "Number of times the Waku rate limits were exceeded", 58 }, []string{"type"}) 59 BridgeSent = prom.NewCounter(prom.CounterOpts{ 60 Name: "waku_bridge_sent_total", 61 Help: "Number of envelopes bridged from Waku", 62 }) 63 BridgeReceivedSucceed = prom.NewCounter(prom.CounterOpts{ 64 Name: "waku_bridge_received_success_total", 65 Help: "Number of envelopes bridged to Waku and successfully added", 66 }) 67 BridgeReceivedFailed = prom.NewCounter(prom.CounterOpts{ 68 Name: "waku_bridge_received_failure_total", 69 Help: "Number of envelopes bridged to Waku and failed to be added", 70 }) 71 ) 72 73 func init() { 74 prom.MustRegister(EnvelopesReceivedCounter) 75 prom.MustRegister(EnvelopesRejectedCounter) 76 prom.MustRegister(EnvelopesCacheFailedCounter) 77 prom.MustRegister(EnvelopesCachedCounter) 78 prom.MustRegister(EnvelopesSizeMeter) 79 prom.MustRegister(RateLimitsProcessed) 80 prom.MustRegister(RateLimitsExceeded) 81 prom.MustRegister(BridgeSent) 82 prom.MustRegister(BridgeReceivedSucceed) 83 prom.MustRegister(BridgeReceivedFailed) 84 }