diff --git a/go.mod b/go.mod index fb74c1180..3a39d8399 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( cloud.google.com/go v0.49.0 // indirect cloud.google.com/go/storage v1.4.0 github.com/VictoriaMetrics/fastcache v1.5.4 - github.com/VictoriaMetrics/metrics v1.9.1 + github.com/VictoriaMetrics/metrics v1.9.2 github.com/aws/aws-sdk-go v1.25.43 github.com/cespare/xxhash/v2 v2.1.1 github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect diff --git a/go.sum b/go.sum index c78837aa8..158a92363 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,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.4 h1:0BaXbRH01RycJk79OOBwMCXlNryko9z4yEf6RqbP+Xo= github.com/VictoriaMetrics/fastcache v1.5.4/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= -github.com/VictoriaMetrics/metrics v1.9.1 h1:6bkFBTSCZ3woLQ6+ZLRIvrYjGn7GDqOid297WiT38o4= -github.com/VictoriaMetrics/metrics v1.9.1/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ= +github.com/VictoriaMetrics/metrics v1.9.2 h1:+CNV5OOPe1PuHff3AsOa5cbN8qCWkWwZZA7eOmFjOwQ= +github.com/VictoriaMetrics/metrics v1.9.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.25.43 h1:R5YqHQFIulYVfgRySz9hvBRTWBjudISa+r0C8XQ1ufg= diff --git a/vendor/github.com/VictoriaMetrics/metrics/README.md b/vendor/github.com/VictoriaMetrics/metrics/README.md index 6cb230507..4f1283abb 100644 --- a/vendor/github.com/VictoriaMetrics/metrics/README.md +++ b/vendor/github.com/VictoriaMetrics/metrics/README.md @@ -15,6 +15,7 @@ * Fast. * Allows exporting distinct metric sets via distinct endpoints. See [Set](http://godoc.org/github.com/VictoriaMetrics/metrics#Set). * Supports [easy-to-use histograms](http://godoc.org/github.com/VictoriaMetrics/metrics#Histogram), which just work without any tuning. + Read more about VictoriaMetrics histograms at [this article](https://medium.com/@valyala/improving-histogram-usability-for-prometheus-and-grafana-bc7e5df0e350). ### Limitations diff --git a/vendor/github.com/VictoriaMetrics/metrics/histogram.go b/vendor/github.com/VictoriaMetrics/metrics/histogram.go index 2d5f80bfa..6db9b9f83 100644 --- a/vendor/github.com/VictoriaMetrics/metrics/histogram.go +++ b/vendor/github.com/VictoriaMetrics/metrics/histogram.go @@ -19,6 +19,8 @@ const ( // Histogram is a histogram for non-negative values with automatically created buckets. // +// See https://medium.com/@valyala/improving-histogram-usability-for-prometheus-and-grafana-bc7e5df0e350 +// // Each bucket contains a counter for values in the given range. // Each non-empty bucket is exposed via the following metric: // @@ -32,7 +34,8 @@ const ( // - - the number of hits to the given bucket during Update* calls // // Histogram buckets can be converted to Prometheus-like buckets with `le` labels -// with `prometheus_buckets(_bucket)` function in VictoriaMetrics: +// with `prometheus_buckets(_bucket)` function from Extended PromQL in VictoriaMetrics. +// (see https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL ): // // prometheus_buckets(request_duration_bucket) // diff --git a/vendor/github.com/VictoriaMetrics/metrics/set.go b/vendor/github.com/VictoriaMetrics/metrics/set.go index dfc00426c..15976df75 100644 --- a/vendor/github.com/VictoriaMetrics/metrics/set.go +++ b/vendor/github.com/VictoriaMetrics/metrics/set.go @@ -42,10 +42,14 @@ func (s *Set) WritePrometheus(w io.Writer) { if !sort.SliceIsSorted(s.a, lessFunc) { sort.Slice(s.a, lessFunc) } - for _, nm := range s.a { + sa := append([]*namedMetric(nil), s.a...) + s.mu.Unlock() + + // Call marshalTo without the global lock, since certain metric types such as Gauge + // can call a callback, which, in turn, can try calling s.mu.Lock again. + for _, nm := range sa { nm.metric.marshalTo(nm.name, &bb) } - s.mu.Unlock() w.Write(bb.Bytes()) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 8cbb0e15e..54e1003c5 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.4 github.com/VictoriaMetrics/fastcache -# github.com/VictoriaMetrics/metrics v1.9.1 +# github.com/VictoriaMetrics/metrics v1.9.2 github.com/VictoriaMetrics/metrics # github.com/aws/aws-sdk-go v1.25.43 github.com/aws/aws-sdk-go/aws