prometheus_exporter 0.4.16 → 0.4.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f71a3c031cd843aba70a3fb4692b73507c7ad7b1256e1cf5b1dbb264cebf73d3
4
- data.tar.gz: 0fbc4a8c24a2ce6d95e6aa315938fc0f4be46c8e769db49397fcbfd2b3dd81f4
3
+ metadata.gz: ca59b198973bbfb5df6e5204f7a74138df05759f6a44839a60eaabd1d0d58697
4
+ data.tar.gz: 384a5a138d1eb8c24ccc47984d6f6437bcced89f058cc55460bf3dcb60f326fb
5
5
  SHA512:
6
- metadata.gz: 760279a05df24ae8b06d11bed36d4121afe223020bd36a4cd8f945195c402313aea6c58c81b1f85c0d40b64812af31a37e1537ecc14573b435830311c0415cfd
7
- data.tar.gz: cc36f5859f8195000899e8b2bb066d9bf03698a8280e532231fda9e4bd7756d478fb0d5bd7c4e87dd34bb0a73f88485b198fd53f8c8bf8709c761fdcce41347c
6
+ metadata.gz: 7406bf4ed7f65ee3dd243ac01294737292b721b9cd04f34a93b84200ad3259bc18ee8326aa8f5bea438a6ada13dab42453dd380e0fd2d34008378ecd8f581504
7
+ data.tar.gz: 8834124a60121673f01023a2e564b3afb55f3977d2d0214cccc2b7fb201788c2b15650992c49402180e6468a7676278ce963a0bded8f2fcf6ccc9984937a9199
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.17 - 13-01-2019
2
+
3
+ - FEATURE: add support for `to_h` on all metrics which can be used to query existing key/values
4
+
1
5
  0.4.16 - 04-11-2019
2
6
 
3
7
  - FEATURE: Support #reset! on all metric types to reset a metric to default
@@ -38,6 +38,10 @@ module PrometheusExporter::Metric
38
38
  raise "Not implemented"
39
39
  end
40
40
 
41
+ def to_h
42
+ raise "Not implemented"
43
+ end
44
+
41
45
  def from_json(json)
42
46
  json = JSON.parse(json) if String === json
43
47
  @name = json["name"]
@@ -23,6 +23,10 @@ module PrometheusExporter::Metric
23
23
  end.join("\n")
24
24
  end
25
25
 
26
+ def to_h
27
+ @data.dup
28
+ end
29
+
26
30
  def observe(increment = 1, labels = {})
27
31
  @data[labels] ||= 0
28
32
  @data[labels] += increment
@@ -23,6 +23,10 @@ module PrometheusExporter::Metric
23
23
  @data = {}
24
24
  end
25
25
 
26
+ def to_h
27
+ @data.dup
28
+ end
29
+
26
30
  def observe(value, labels = {})
27
31
  if value.nil?
28
32
  data.delete(labels)
@@ -17,6 +17,16 @@ module PrometheusExporter::Metric
17
17
  @observations = {}
18
18
  end
19
19
 
20
+ def to_h
21
+ data = {}
22
+ @observations.each do |labels, buckets|
23
+ count = @counts[labels]
24
+ sum = @sums[labels]
25
+ data[labels] = { "count" => count, "sum" => sum }
26
+ end
27
+ data
28
+ end
29
+
20
30
  def type
21
31
  "histogram"
22
32
  end
@@ -22,6 +22,16 @@ module PrometheusExporter::Metric
22
22
  @sums = {}
23
23
  end
24
24
 
25
+ def to_h
26
+ data = {}
27
+ calculate_all_quantiles.each do |labels, quantiles|
28
+ count = @counts[labels]
29
+ sum = @sums[labels]
30
+ data[labels] = { "count" => count, "sum" => sum }
31
+ end
32
+ data
33
+ end
34
+
25
35
  def type
26
36
  "summary"
27
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusExporter
4
- VERSION = "0.4.16"
4
+ VERSION = "0.4.17"
5
5
  end
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "oj", "~> 3.0"
33
33
  spec.add_development_dependency "rack-test", "~> 0.8.3"
34
34
  spec.add_development_dependency "minitest-stub-const", "~> 0.6"
35
+ spec.add_development_dependency 'rubocop-discourse', '~> 1.0'
35
36
  if !RUBY_ENGINE == 'jruby'
36
37
  spec.add_development_dependency "raindrops", "~> 0.19"
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.16
4
+ version: 0.4.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-03 00:00:00.000000000 Z
11
+ date: 2020-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.6'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-discourse
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.0'
153
167
  description: Prometheus metric collector and exporter for Ruby
154
168
  email:
155
169
  - sam.saffron@gmail.com