prometheus_exporter 0.5.2 → 0.5.3

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: 89d503831ed018381a2f32d77b14f04db0533d8f03f19befda4067fe29ad464e
4
- data.tar.gz: 31227ad5e110551343e4d0d1837a834333d0203c1df2b6343fe7b5584bb818ac
3
+ metadata.gz: a284b77cbd17e80457e94520d18976dc3dd6fb8c238d8a90cda6513e291f01ad
4
+ data.tar.gz: 4464419fc9c67d387edd9d6d5bdfac1411d0864d29c0cd3a6f10d2f02b3d7e24
5
5
  SHA512:
6
- metadata.gz: 7b594c1eec85156ccf1ee08e5ef9c4bc864f266c9d6960b74148dc5b2dc8c2712f37281125d0399928cdd49897b558593f25069d507db190bbe19616a2ad6a93
7
- data.tar.gz: 794a3837221c3e16aca9547eb833fade063b501627f6dafc7da8454e85d288d72d4d78adf6fe82a164ff54fa656ee0ea6024a418c328197d6b9aebf1a407c7e3
6
+ metadata.gz: 84c2e2af95a8839cd9deecca9fbc26bacff590ae5cb3677862f1eb1d476401114406130cc78d2248cec0380e70c1b74b306e1265b3343bbac9c09d8400e692a3
7
+ data.tar.gz: 41898546588ef7eafa772252ef5ed1a8c222e4009e64ccec35d463217336597a94f1c844f3e2174e030c19a7c1b90d1028e5729cc393cf797654362f5d66b7f2
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.5.3 - 29-07-2020
2
+
3
+ - FEATURE: added #remove to all metric types so users can remove specific labels if needed
4
+
1
5
  0.5.2 - 01-07-2020
2
6
 
3
7
  - FEATURE: expanded instrumentation for sidekiq
@@ -27,6 +27,10 @@ module PrometheusExporter::Metric
27
27
  @data.dup
28
28
  end
29
29
 
30
+ def remove(labels)
31
+ @data.delete(labels)
32
+ end
33
+
30
34
  def observe(increment = 1, labels = {})
31
35
  @data[labels] ||= 0
32
36
  @data[labels] += increment
@@ -27,6 +27,10 @@ module PrometheusExporter::Metric
27
27
  @data.dup
28
28
  end
29
29
 
30
+ def remove(labels)
31
+ @data.delete(labels)
32
+ end
33
+
30
34
  def observe(value, labels = {})
31
35
  if value.nil?
32
36
  data.delete(labels)
@@ -27,6 +27,12 @@ module PrometheusExporter::Metric
27
27
  data
28
28
  end
29
29
 
30
+ def remove(labels)
31
+ @observations.delete(labels)
32
+ @counts.delete(labels)
33
+ @sums.delete(labels)
34
+ end
35
+
30
36
  def type
31
37
  "histogram"
32
38
  end
@@ -32,6 +32,13 @@ module PrometheusExporter::Metric
32
32
  data
33
33
  end
34
34
 
35
+ def remove(labels)
36
+ @counts.delete(labels)
37
+ @sums.delete(labels)
38
+ @buffers[0].delete(labels)
39
+ @buffers[1].delete(labels)
40
+ end
41
+
35
42
  def type
36
43
  "summary"
37
44
  end
@@ -27,6 +27,7 @@ module PrometheusExporter::Server
27
27
 
28
28
  @active_record_metrics.map do |m|
29
29
  metric_key = (m["metric_labels"] || {}).merge("pid" => m["pid"])
30
+ metric_key.merge!(m["custom_labels"]) if m["custom_labels"]
30
31
 
31
32
  ACTIVE_RECORD_GAUGES.map do |k, help|
32
33
  k = k.to_s
@@ -37,6 +37,7 @@ module PrometheusExporter::Server
37
37
  now = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
38
38
  object['queues'].each do |queue|
39
39
  queue["created_at"] = now
40
+ queue["labels"].merge!(object['custom_labels']) if object['custom_labels']
40
41
  sidekiq_metrics.delete_if { |metric| metric['created_at'] + MAX_SIDEKIQ_METRIC_AGE < now }
41
42
  sidekiq_metrics << queue
42
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusExporter
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop