flush flushes any remaining local byte counters to the Prometheus counters.
()
| 95 | |
| 96 | // flush flushes any remaining local byte counters to the Prometheus counters. |
| 97 | func (c *meteredConn) flush() { |
| 98 | if sentBytes := c.sentBytesLocal.Swap(0); sentBytes > 0 { |
| 99 | c.sentBytesCounter.Add(float64(sentBytes)) |
| 100 | } |
| 101 | if receivedBytes := c.receivedBytesLocal.Swap(0); receivedBytes > 0 { |
| 102 | c.receivedBytesCounter.Add(float64(receivedBytes)) |
| 103 | } |
| 104 | } |
no test coverage detected