prometheus-client-mmap 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b5c498fd358490972a9c83c9cdab567b2a934ee564f20e7ce061eade259c24d
4
- data.tar.gz: fb742b9c13cbb68ec78365bc3cffdccc071b87bfd8d4ad208d67f23b44e44500
3
+ metadata.gz: 4503b14fb2d97e4fbd1bed4ddb1d37d34a0afdba74b75f038103d21cf3042194
4
+ data.tar.gz: 40d3335f7ce24e60675af78ccbc9eef3bd0d5cfca48e1d1bddcbf93464ce848e
5
5
  SHA512:
6
- metadata.gz: 232a459c83853b13ff03d0d947cd877af10e39d9509140e107c6c74d476a5eac1c4fe1f8137478b126b201e6715d79478623fd4fe0a12fa7f386abbd52a2581c
7
- data.tar.gz: 46e15e628e07b8b72ac51b6d830e899a6b2687c97167266470edb924507f8f640c0a68a40e3bfe9570b262cf37e3fe874c781466788a33b9bf044303a93a575e
6
+ metadata.gz: 6337982b5065d19fc6bbe4cf81c4441bf8ec26fef77d23660660afb8240b0a52fb502dc7806bcfc7263b1dbcc335d16eb81337b03bb54872d29548b2f1f2b2bf
7
+ data.tar.gz: 1e463661bd0127dc750afbcf677743cb37fe107672356a4e1f24ca86eaa6bf85453293ba5fd39541e7667e5319da5be27db530704e48acbe6160d88cff769798
data/README.md CHANGED
@@ -8,7 +8,7 @@ A suite of instrumentation metric primitives for Ruby that can be exposed
8
8
  through a HTTP interface. Intended to be used together with a
9
9
  [Prometheus server][1].
10
10
 
11
- [![Gem Version][4]](http://badge.fury.io/rb/prometheus-client-mmap)
11
+ [![Gem Version][4]](https://badge.fury.io/rb/prometheus-client-mmap)
12
12
  [![Build Status][3]](https://gitlab.com/gitlab-org/prometheus-client-mmap/commits/master)
13
13
 
14
14
  ## Installation
@@ -186,7 +186,8 @@ histogram.get({ service: 'users' })
186
186
  ### Summary
187
187
 
188
188
  Summary, similar to histograms, is an accumulator for samples. It captures
189
- Numeric data and provides an efficient percentile calculation mechanism.
189
+ Numeric data and keeps the sum and the count of the observations, exported as
190
+ `<name>_sum` and `<name>_count`. It does not calculate quantiles.
190
191
 
191
192
  ```ruby
192
193
  summary = Prometheus::Client::Summary.new(:service_latency_seconds, '...')
@@ -194,9 +195,9 @@ summary = Prometheus::Client::Summary.new(:service_latency_seconds, '...')
194
195
  # record a value
195
196
  summary.observe({ service: 'database' }, Benchmark.realtime { service.call() })
196
197
 
197
- # retrieve the current quantile values
198
+ # retrieve the sum of the recorded values for a given label set
198
199
  summary.get({ service: 'database' })
199
- # => { 0.5 => 0.1233122, 0.9 => 3.4323, 0.99 => 5.3428231 }
200
+ # => 5.3428231
200
201
  ```
201
202
 
202
203
  ## Configuration
@@ -275,7 +276,7 @@ pipeline for the tag completes.
275
276
  [1]: https://github.com/prometheus/prometheus
276
277
  [2]: http://rack.github.io/
277
278
  [3]: https://gitlab.com/gitlab-org/prometheus-client-mmap/badges/master/pipeline.svg
278
- [4]: https://badge.fury.io/rb/prometheus-client.svg
279
+ [4]: https://badge.fury.io/rb/prometheus-client-mmap.svg
279
280
  [8]: https://github.com/prometheus/pushgateway
280
281
  [9]: lib/prometheus/client/rack/exporter.rb
281
282
  [10]: lib/prometheus/client/rack/collector.rb
@@ -57,14 +57,12 @@ module Prometheus
57
57
  end
58
58
  end
59
59
 
60
+ # Summary::Value keeps no quantiles, only the sum and the count.
60
61
  def summary(name, set, value)
61
- rv = value.get.map do |q, v|
62
- [name, set.merge(quantile: q), v]
63
- end
64
-
65
- rv << ["#{name}_sum", set, value.get.sum]
66
- rv << ["#{name}_count", set, value.get.total]
67
- rv
62
+ [
63
+ ["#{name}_sum", set, value.sum.get],
64
+ ["#{name}_count", set, value.total.get],
65
+ ]
68
66
  end
69
67
 
70
68
  def histogram(name, set, value)
@@ -65,7 +65,7 @@ module Prometheus
65
65
  response = if Prometheus::Client.configuration.value_class.multiprocess
66
66
  format.marshal_multiprocess
67
67
  else
68
- format.marshal
68
+ format.marshal(@registry)
69
69
  end
70
70
  [
71
71
  200,
@@ -4,7 +4,8 @@ require 'prometheus/client/uses_value_type'
4
4
  module Prometheus
5
5
  module Client
6
6
  # Summary is an accumulator for samples. It captures Numeric data and
7
- # provides an efficient quantile calculation mechanism.
7
+ # keeps the sum and the count of the observations. It does not
8
+ # calculate quantiles.
8
9
  class Summary < Metric
9
10
  extend Gem::Deprecate
10
11
 
@@ -22,6 +23,12 @@ module Prometheus
22
23
  @sum.increment(value)
23
24
  @total.increment
24
25
  end
26
+
27
+ # Returns the sum of the observations, as Summary#get does for this
28
+ # label set.
29
+ def get
30
+ @sum.get
31
+ end
25
32
  end
26
33
 
27
34
  def initialize(name, docstring, base_labels = {})
@@ -50,15 +57,6 @@ module Prometheus
50
57
  end
51
58
  end
52
59
 
53
- # Returns all label sets with their values
54
- def values
55
- synchronize do
56
- @values.each_with_object({}) do |(labels, value), memo|
57
- memo[labels] = value.sum
58
- end
59
- end
60
- end
61
-
62
60
  private
63
61
 
64
62
  def default(labels)
@@ -1,5 +1,5 @@
1
1
  module Prometheus
2
2
  module Client
3
- VERSION = '1.7.1'.freeze
3
+ VERSION = '1.7.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client-mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmidt