prometheus_exporter 0.4.15 → 0.4.16

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: 86155ae93296d42918b6419efbdae95665e5149a89083894dd9ba5daaf9f84bf
4
- data.tar.gz: 49bee52b66976743b17794f7515cc57c7c6979338d479a66ec49ae0ff30d9f7f
3
+ metadata.gz: f71a3c031cd843aba70a3fb4692b73507c7ad7b1256e1cf5b1dbb264cebf73d3
4
+ data.tar.gz: 0fbc4a8c24a2ce6d95e6aa315938fc0f4be46c8e769db49397fcbfd2b3dd81f4
5
5
  SHA512:
6
- metadata.gz: c2ebf589c432b5c64339d15c4c25b99d4cca49228c466ba9a334c4af12b2ac7c7922a8607c9c90ea38cf1afd9a2f2efa5dde087ab4aed8f124e4f2577510ee11
7
- data.tar.gz: e1a2f8f93f59b62296ce1a2448f70c3decd8f970787ee5619593080da6e181c02c432e82e52ac9de11f626309eb9aa513e6070c56349ef84fcf3a84d4b44ea45
6
+ metadata.gz: 760279a05df24ae8b06d11bed36d4121afe223020bd36a4cd8f945195c402313aea6c58c81b1f85c0d40b64812af31a37e1537ecc14573b435830311c0415cfd
7
+ data.tar.gz: cc36f5859f8195000899e8b2bb066d9bf03698a8280e532231fda9e4bd7756d478fb0d5bd7c4e87dd34bb0a73f88485b198fd53f8c8bf8709c761fdcce41347c
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.16 - 04-11-2019
2
+
3
+ - FEATURE: Support #reset! on all metric types to reset a metric to default
4
+
1
5
  0.4.15 - 04-11-2019
2
6
 
3
7
  - FEATURE: Improve delayed job collector, add pending counts
@@ -34,6 +34,10 @@ module PrometheusExporter::Metric
34
34
  raise "Not implemented"
35
35
  end
36
36
 
37
+ def reset!
38
+ raise "Not implemented"
39
+ end
40
+
37
41
  def from_json(json)
38
42
  json = JSON.parse(json) if String === json
39
43
  @name = json["name"]
@@ -6,13 +6,17 @@ module PrometheusExporter::Metric
6
6
 
7
7
  def initialize(name, help)
8
8
  super
9
- @data = {}
9
+ reset!
10
10
  end
11
11
 
12
12
  def type
13
13
  "counter"
14
14
  end
15
15
 
16
+ def reset!
17
+ @data = {}
18
+ end
19
+
16
20
  def metric_text
17
21
  @data.map do |labels, value|
18
22
  "#{prefix(@name)}#{labels_text(labels)} #{value}"
@@ -6,7 +6,7 @@ module PrometheusExporter::Metric
6
6
 
7
7
  def initialize(name, help)
8
8
  super
9
- @data = {}
9
+ reset!
10
10
  end
11
11
 
12
12
  def type
@@ -19,6 +19,10 @@ module PrometheusExporter::Metric
19
19
  end.join("\n")
20
20
  end
21
21
 
22
+ def reset!
23
+ @data = {}
24
+ end
25
+
22
26
  def observe(value, labels = {})
23
27
  if value.nil?
24
28
  data.delete(labels)
@@ -8,6 +8,10 @@ module PrometheusExporter::Metric
8
8
  def initialize(name, help, opts = {})
9
9
  super(name, help)
10
10
  @buckets = (opts[:buckets] || DEFAULT_BUCKETS).sort.reverse
11
+ reset!
12
+ end
13
+
14
+ def reset!
11
15
  @sums = {}
12
16
  @counts = {}
13
17
  @observations = {}
@@ -10,12 +10,16 @@ module PrometheusExporter::Metric
10
10
 
11
11
  def initialize(name, help, opts = {})
12
12
  super(name, help)
13
+ reset!
14
+ @quantiles = opts[:quantiles] || DEFAULT_QUANTILES
15
+ end
16
+
17
+ def reset!
13
18
  @buffers = [{}, {}]
14
19
  @last_rotated = Process.clock_gettime(Process::CLOCK_MONOTONIC)
15
20
  @current_buffer = 0
16
21
  @counts = {}
17
22
  @sums = {}
18
- @quantiles = opts[:quantiles] || DEFAULT_QUANTILES
19
23
  end
20
24
 
21
25
  def type
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusExporter
4
- VERSION = "0.4.15"
4
+ VERSION = "0.4.16"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron