prometheus-client 0.10.0 → 0.11.0.pre.alpha.1

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: be821ad9a35fc316970961619d14342baa8166ff6143e21e30e527e0dc1bd325
4
- data.tar.gz: bf6583e5e6b45cc96ffa9424abe5707e3f17ba5782ba6e42c89a994e8233a0f6
3
+ metadata.gz: a558dc9a9c12b948a111369fd378ef1f41135695b0f7fb30eb2691a86a05ea3f
4
+ data.tar.gz: 0d8554c3e1a4cec8e6db066158247c7a1c8e0fc86653e9a252bc3c08c04d1618
5
5
  SHA512:
6
- metadata.gz: ff408a86bebf88bc757850dc69c3faf9b56dc8d556f0c837d350496ee37810390e5cf6f0b319785e3c9a79968f67467b1fd2a5213c07468a907bd5eae907363c
7
- data.tar.gz: df5a509d431e8d7a9ca03f984400cfd3d0705d3322f9f2a336653f6956a828135b75efb99aa3817398c1f559bf4722d2580a5608b598f1d8312b24d97d18098c
6
+ metadata.gz: 91b4d4bb9f606b33f77bc0fab83a523d0cf61d6f875f5c42de738513aebc2e6a44994c9098c103b51b54eb2c80957c82616aab4fadb07e583c1b5b0ef3821697
7
+ data.tar.gz: d956b78c30fff9db52e45f9826f739f1088501ebd12ad71b016e0d58abe3262c320180fd68ba74dbc898a279141e6e27b9f51d2d8471b0d28f7e5bb5eef95595
data/README.md CHANGED
@@ -66,8 +66,6 @@ The Ruby client can also be used to push its collected metrics to a
66
66
  where it's not possible or feasible to let a Prometheus server scrape a Ruby
67
67
  process. TLS and basic access authentication are supported.
68
68
 
69
- **Attention**: The implementation still uses the legacy API of the pushgateway.
70
-
71
69
  ```ruby
72
70
  require 'prometheus/client'
73
71
  require 'prometheus/client/push'
@@ -150,7 +150,7 @@ module Prometheus
150
150
  labels[:pid] = process_id
151
151
  end
152
152
 
153
- labels.map{|k,v| "#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}"}.join('&')
153
+ labels.to_a.sort.map{|k,v| "#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}"}.join('&')
154
154
  end
155
155
 
156
156
  def internal_store
@@ -215,11 +215,7 @@ module Prometheus
215
215
 
216
216
  if @used > 0
217
217
  # File already has data. Read the existing values
218
- with_file_lock do
219
- read_all_values.each do |key, _, pos|
220
- @positions[key] = pos
221
- end
222
- end
218
+ with_file_lock { populate_positions }
223
219
  else
224
220
  # File is empty. Init the `used` counter, if we're in write mode
225
221
  if !readonly
@@ -230,10 +226,14 @@ module Prometheus
230
226
  end
231
227
  end
232
228
 
233
- # Yield (key, value, pos). No locking is performed.
229
+ # Return a list of key-value pairs
234
230
  def all_values
235
231
  with_file_lock do
236
- read_all_values.map { |k, v, p| [k, v] }
232
+ @positions.map do |key, pos|
233
+ @f.seek(pos)
234
+ value = @f.read(8).unpack('d')[0]
235
+ [key, value]
236
+ end
237
237
  end
238
238
  end
239
239
 
@@ -309,22 +309,18 @@ module Prometheus
309
309
  @positions[key] = @used - 8
310
310
  end
311
311
 
312
- # Yield (key, value, pos). No locking is performed.
313
- def read_all_values
312
+ # Read position of all keys. No locking is performed.
313
+ def populate_positions
314
314
  @f.seek(8)
315
- values = []
316
315
  while @f.pos < @used
317
316
  padded_len = @f.read(4).unpack('l')[0]
318
- encoded = @f.read(padded_len).unpack("A#{padded_len}")[0]
319
- value = @f.read(8).unpack('d')[0]
320
- values << [encoded.strip, value, @f.pos - 8]
317
+ key = @f.read(padded_len).unpack("A#{padded_len}")[0].strip
318
+ @positions[key] = @f.pos
319
+ @f.seek(8, :CUR)
321
320
  end
322
- values
323
321
  end
324
322
  end
325
323
  end
326
324
  end
327
325
  end
328
326
  end
329
-
330
-
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '0.10.0'
5
+ VERSION = '0.11.0-alpha.1'
6
6
  end
7
7
  end
@@ -11,20 +11,11 @@ module Prometheus
11
11
  # By default metrics are registered on the global registry. Set the
12
12
  # `:registry` option to use a custom registry.
13
13
  #
14
- # By default metrics all have the prefix "http_server". Set to something
15
- # else if you like.
14
+ # By default metrics all have the prefix "http_server". Set
15
+ # `:metrics_prefix` to something else if you like.
16
16
  #
17
- # The request counter metric is broken down by code, method and path by
18
- # default. Set the `:counter_label_builder` option to use a custom label
19
- # builder.
20
- #
21
- # The request duration metric is broken down by method and path by default.
22
- # Set the `:duration_label_builder` option to use a custom label builder.
23
- #
24
- # Label Builder functions will receive a Rack env and a status code, and must
25
- # return a hash with the labels for that request. They must also accept an empty
26
- # env, and return a hash with the correct keys. This is necessary to initialize
27
- # the metrics with the correct set of labels.
17
+ # The request counter metric is broken down by code, method and path.
18
+ # The request duration metric is broken down by method and path.
28
19
  class Collector
29
20
  attr_reader :app, :registry
30
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Kochie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-10-07 00:00:00.000000000 Z
13
+ date: 2019-10-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: benchmark-ips
@@ -84,11 +84,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ">"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 1.3.1
90
90
  requirements: []
91
- rubygems_version: 3.0.3
91
+ rubyforge_project:
92
+ rubygems_version: 2.7.6
92
93
  signing_key:
93
94
  specification_version: 4
94
95
  summary: A suite of instrumentation metric primitivesthat can be exposed through a