mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
fix: erroneous high value for gateway received bytes metrics (#8978)
http.Request.ContentLength can be negative, which affects the gateway_s3_bytes_received value in Prometheus output. The commit only increases the value of the total received bytes in gateway mode when r.ContentLength is greater than zero.
This commit is contained in:
@@ -37,8 +37,8 @@ type Metrics struct {
|
||||
}
|
||||
|
||||
// IncBytesReceived - Increase total bytes received from gateway backend
|
||||
func (s *Metrics) IncBytesReceived(n int64) {
|
||||
s.bytesReceived.Add(uint64(n))
|
||||
func (s *Metrics) IncBytesReceived(n uint64) {
|
||||
s.bytesReceived.Add(n)
|
||||
}
|
||||
|
||||
// GetBytesReceived - Get total bytes received from gateway backend
|
||||
@@ -47,8 +47,8 @@ func (s *Metrics) GetBytesReceived() uint64 {
|
||||
}
|
||||
|
||||
// IncBytesSent - Increase total bytes sent to gateway backend
|
||||
func (s *Metrics) IncBytesSent(n int64) {
|
||||
s.bytesSent.Add(uint64(n))
|
||||
func (s *Metrics) IncBytesSent(n uint64) {
|
||||
s.bytesSent.Add(n)
|
||||
}
|
||||
|
||||
// GetBytesSent - Get total bytes received from gateway backend
|
||||
|
||||
Reference in New Issue
Block a user