diff --git a/go.mod b/go.mod index d20ce6e9c..8e66975b4 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( cloud.google.com/go v0.54.0 // indirect cloud.google.com/go/storage v1.6.0 github.com/VictoriaMetrics/fastcache v1.5.7 - github.com/VictoriaMetrics/metrics v1.11.0 + github.com/VictoriaMetrics/metrics v1.11.2 github.com/aws/aws-sdk-go v1.29.22 github.com/cespare/xxhash/v2 v2.1.1 github.com/golang/snappy v0.0.1 diff --git a/go.sum b/go.sum index b2fdbed91..f4fc4d1e9 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= -github.com/VictoriaMetrics/metrics v1.11.0 h1:sfRmbgk7hGrxNXrziwyTmU8FZFLFrPNC7g2kZs0xMTQ= -github.com/VictoriaMetrics/metrics v1.11.0/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ= +github.com/VictoriaMetrics/metrics v1.11.2 h1:t/ceLP6SvagUqypCKU7cI7+tQn54+TIV/tGoxihHvx8= +github.com/VictoriaMetrics/metrics v1.11.2/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/aws/aws-sdk-go v1.29.22 h1:3WmsCj3C30l6/4f50mPkDZoTPWSvaRCjcVJOWdCJoIE= diff --git a/vendor/github.com/VictoriaMetrics/metrics/histogram.go b/vendor/github.com/VictoriaMetrics/metrics/histogram.go index 3ddf68777..6a72cc55a 100644 --- a/vendor/github.com/VictoriaMetrics/metrics/histogram.go +++ b/vendor/github.com/VictoriaMetrics/metrics/histogram.go @@ -246,14 +246,22 @@ func (h *Histogram) marshalTo(prefix string, w io.Writer) { return } name, filters := splitMetricName(prefix) - if float64(int64(h.sum)) == h.sum { - fmt.Fprintf(w, "%s_sum%s %d\n", name, filters, int64(h.sum)) + sum := h.getSum() + if float64(int64(sum)) == sum { + fmt.Fprintf(w, "%s_sum%s %d\n", name, filters, int64(sum)) } else { - fmt.Fprintf(w, "%s_sum%s %g\n", name, filters, h.sum) + fmt.Fprintf(w, "%s_sum%s %g\n", name, filters, sum) } fmt.Fprintf(w, "%s_count%s %d\n", name, filters, countTotal) } +func (h *Histogram) getSum() float64 { + h.mu.Lock() + sum := h.sum + h.mu.Unlock() + return sum +} + func getBucketIdxAndOffset(v float64) (int, uint) { if v < 0 { panic(fmt.Errorf("BUG: v must be positive; got %g", v)) diff --git a/vendor/modules.txt b/vendor/modules.txt index c352a2f80..515e6ce33 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -12,7 +12,7 @@ cloud.google.com/go/storage github.com/BurntSushi/toml # github.com/VictoriaMetrics/fastcache v1.5.7 github.com/VictoriaMetrics/fastcache -# github.com/VictoriaMetrics/metrics v1.11.0 +# github.com/VictoriaMetrics/metrics v1.11.2 github.com/VictoriaMetrics/metrics # github.com/aws/aws-sdk-go v1.29.22 github.com/aws/aws-sdk-go/aws