addReceivedBytes adds bytes to the local received counter and flushes to Prometheus if threshold is reached.
(n int64)
| 87 | |
| 88 | // addReceivedBytes adds bytes to the local received counter and flushes to Prometheus if threshold is reached. |
| 89 | func (c *meteredConn) addReceivedBytes(n int64) { |
| 90 | newTotal := c.receivedBytesLocal.Add(n) |
| 91 | if newTotal >= flushThreshold { |
| 92 | c.flush() |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // flush flushes any remaining local byte counters to the Prometheus counters. |
| 97 | func (c *meteredConn) flush() { |