github.com/koko1123/flow-go-1@v0.29.6/module/metrics/rate_limited_blockstore.go (about) 1 package metrics 2 3 import ( 4 "github.com/prometheus/client_golang/prometheus" 5 "github.com/prometheus/client_golang/prometheus/promauto" 6 7 "github.com/koko1123/flow-go-1/module" 8 ) 9 10 type RateLimitedBlockstoreCollector struct { 11 bytesRead prometheus.Counter 12 } 13 14 func NewRateLimitedBlockstoreCollector(prefix string) module.RateLimitedBlockstoreMetrics { 15 return &RateLimitedBlockstoreCollector{ 16 bytesRead: promauto.NewCounter(prometheus.CounterOpts{ 17 Namespace: namespaceStateSync, 18 Subsystem: subsystemExeDataBlobstore, 19 Name: prefix + "_bytes_read", 20 Help: "number of bytes read from the blockstore", 21 }), 22 } 23 } 24 25 func (r *RateLimitedBlockstoreCollector) BytesRead(n int) { 26 r.bytesRead.Add(float64(n)) 27 }