vendor: update github.com/VictoriaMetrics/metrics from v1.9.1 to v1.9.2

This fixes possible deadlock when metrics.WritePrometheus calls Gauge callback, which calls metrics functions with internal lock.
This commit is contained in:
Aliaksandr Valialkin 2019-12-02 22:28:45 +02:00
parent b9616c017f
commit 6bee9115aa
6 changed files with 15 additions and 7 deletions

2
go.mod
View file

@ -4,7 +4,7 @@ require (
cloud.google.com/go v0.49.0 // indirect cloud.google.com/go v0.49.0 // indirect
cloud.google.com/go/storage v1.4.0 cloud.google.com/go/storage v1.4.0
github.com/VictoriaMetrics/fastcache v1.5.4 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/aws/aws-sdk-go v1.25.43
github.com/cespare/xxhash/v2 v2.1.1 github.com/cespare/xxhash/v2 v2.1.1
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect

4
go.sum
View file

@ -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/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 h1:0BaXbRH01RycJk79OOBwMCXlNryko9z4yEf6RqbP+Xo=
github.com/VictoriaMetrics/fastcache v1.5.4/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= 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.2 h1:+CNV5OOPe1PuHff3AsOa5cbN8qCWkWwZZA7eOmFjOwQ=
github.com/VictoriaMetrics/metrics v1.9.1/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ= 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 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= 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= github.com/aws/aws-sdk-go v1.25.43 h1:R5YqHQFIulYVfgRySz9hvBRTWBjudISa+r0C8XQ1ufg=

View file

@ -15,6 +15,7 @@
* Fast. * Fast.
* Allows exporting distinct metric sets via distinct endpoints. See [Set](http://godoc.org/github.com/VictoriaMetrics/metrics#Set). * 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. * 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 ### Limitations

View file

@ -19,6 +19,8 @@ const (
// Histogram is a histogram for non-negative values with automatically created buckets. // 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 bucket contains a counter for values in the given range.
// Each non-empty bucket is exposed via the following metric: // Each non-empty bucket is exposed via the following metric:
// //
@ -32,7 +34,8 @@ const (
// - <counter> - the number of hits to the given bucket during Update* calls // - <counter> - the number of hits to the given bucket during Update* calls
// //
// Histogram buckets can be converted to Prometheus-like buckets with `le` labels // Histogram buckets can be converted to Prometheus-like buckets with `le` labels
// with `prometheus_buckets(<metric_name>_bucket)` function in VictoriaMetrics: // with `prometheus_buckets(<metric_name>_bucket)` function from Extended PromQL in VictoriaMetrics.
// (see https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL ):
// //
// prometheus_buckets(request_duration_bucket) // prometheus_buckets(request_duration_bucket)
// //

View file

@ -42,10 +42,14 @@ func (s *Set) WritePrometheus(w io.Writer) {
if !sort.SliceIsSorted(s.a, lessFunc) { if !sort.SliceIsSorted(s.a, lessFunc) {
sort.Slice(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) nm.metric.marshalTo(nm.name, &bb)
} }
s.mu.Unlock()
w.Write(bb.Bytes()) w.Write(bb.Bytes())
} }

2
vendor/modules.txt vendored
View file

@ -12,7 +12,7 @@ cloud.google.com/go/storage
github.com/BurntSushi/toml github.com/BurntSushi/toml
# github.com/VictoriaMetrics/fastcache v1.5.4 # github.com/VictoriaMetrics/fastcache v1.5.4
github.com/VictoriaMetrics/fastcache github.com/VictoriaMetrics/fastcache
# github.com/VictoriaMetrics/metrics v1.9.1 # github.com/VictoriaMetrics/metrics v1.9.2
github.com/VictoriaMetrics/metrics github.com/VictoriaMetrics/metrics
# github.com/aws/aws-sdk-go v1.25.43 # github.com/aws/aws-sdk-go v1.25.43
github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws