prometheus-client 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTg5OWIzZmEwM2Y5ZTJlYTZhYmZiYmJjNWQ2YzllZDY3ODE0NzZlMA==
4
+ NDk0MDcwZDZiNTAzOWQ4M2M1ZTQ3MzI0MzVmYTU4OThkMTc4MWFhZg==
5
5
  data.tar.gz: !binary |-
6
- OGViMTA5YzQ5ODNiMGMwOTg0OGRkMGYwYjQ4Mjg5ZDMxZjYxYjkxMg==
6
+ NDI0OThmMTY0ZDMzNGY3N2UzMTExODRjOWEwNDc3ZWEzMzZmNmNlZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjdhODgyNjgyYzQyMmRmNzQyM2FjMzg2MDQ5NDIwNjM3MzBlNmQwMGVhNTlk
10
- NWFhNzE0NjU0Mjg2OGE2ZWQzNTNlNmVjODU3MDlmMzZjNmExMmY5ZjkxYzlh
11
- NmQ3ZDVkOTUzZTk0Yzk3ODAyZTk4ZmZiNGU2M2M1NmU1YzFmMjI=
9
+ MTE3ZGQ1ZjIyYWFlZTJiNzQ2MWFjY2Y5ZTZlMTA0NWJkMmZkNWRkYzAwZDM0
10
+ NWVlYzQ2YjgyMDUxZDIyZDBkMmY4N2EzZWEwZDc5NmQ5Zjc2M2M1MzAyZjg3
11
+ YzRhMzQyMTYwMWYzM2Q3YzJkMzExYWRmYmEwZjI0NjM3YmU2Mjk=
12
12
  data.tar.gz: !binary |-
13
- ODMzOGU1MzVjN2M2NzFmZDQyZjc4MjgwMzRmYjViZDY4MTliNzM2ZDYwNDlm
14
- MjE0YWQ5ZWI1MDA5MjZlY2U0NGExNzA2MWJlYjk2YWU1NjkwNjdkOWJjZWJj
15
- ZGMzNmJhZDZiZTgyMTkzYmY1YmFmMmZmNDUzYmQ1ZjE3MDU5NWI=
13
+ YTFjMzU5NDA3N2VjMTM4Y2Q4MDZiOGM3MTU1YWYwZmI0YTY0MjQxMTUyNDg5
14
+ NGJjMTQyZGFkNDQ5NmE3NzE3NWYyYzAzODMwMzNiOThjMzBlZTA5N2U2ZWI0
15
+ OTA5M2MwMjcwMzI1ZWU2Y2MyMTk4ZDExY2I2NmU4OTY2ZjU5YWE=
@@ -20,12 +20,12 @@ module Prometheus
20
20
  @app = app
21
21
  @registry = options[:registry] || Client.registry
22
22
  @path = options[:path] || '/metrics'
23
- @accpetable = build_dictionary(FORMATS)
23
+ @acceptable = build_dictionary(FORMATS, FALLBACK)
24
24
  end
25
25
 
26
26
  def call(env)
27
27
  if env['PATH_INFO'] == @path
28
- format = negotiate(env['HTTP_ACCEPT'], @accpetable, FALLBACK)
28
+ format = negotiate(env['HTTP_ACCEPT'], @acceptable)
29
29
  format ? respond_with(format) : not_acceptable(FORMATS)
30
30
  else
31
31
  @app.call(env)
@@ -34,8 +34,8 @@ module Prometheus
34
34
 
35
35
  private
36
36
 
37
- def negotiate(accept, formats, fallback)
38
- return fallback if accept.to_s.empty?
37
+ def negotiate(accept, formats)
38
+ accept = '*/*' if accept.to_s.empty?
39
39
 
40
40
  parse(accept).each do |content_type, _|
41
41
  return formats[content_type] if formats.key?(content_type)
@@ -81,8 +81,8 @@ module Prometheus
81
81
  ]
82
82
  end
83
83
 
84
- def build_dictionary(formats)
85
- formats.each_with_object({}) do |format, memo|
84
+ def build_dictionary(formats, fallback)
85
+ formats.each_with_object('*/*' => fallback) do |format, memo|
86
86
  memo[format::CONTENT_TYPE] = format
87
87
  memo[format::MEDIA_TYPE] = format
88
88
  end
@@ -15,11 +15,9 @@ module Prometheus
15
15
  def initialize(estimator)
16
16
  @sum, @total = estimator.sum, estimator.observations
17
17
 
18
- values = estimator.invariants.each_with_object({}) do |i, memo|
19
- memo[i.quantile] = estimator.query(i.quantile)
18
+ estimator.invariants.each do |invariant|
19
+ self[invariant.quantile] = estimator.query(invariant.quantile)
20
20
  end
21
-
22
- replace(values)
23
21
  end
24
22
  end
25
23
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module Client
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schmidt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-22 00:00:00.000000000 Z
11
+ date: 2014-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: quantile