prometheus_exporter 0.4.13 → 0.4.14

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: 2ab1a1e0efbea1b4fd2613ae1f733bb693fbfba91373a9687f4e66e1f9d70361
4
- data.tar.gz: 0a798a9908fe29500b06fb153270ab413631e781a29e6fc490d40d682b40bcc4
3
+ metadata.gz: c0851cbef41df3faf274a45e60e176b3a34906209a82e280624a58fa72ad1929
4
+ data.tar.gz: d6abfafdd5178e9801df4b09bef7a0597f77549f99036423e3a4c870d6b47db2
5
5
  SHA512:
6
- metadata.gz: 1034d8636dd53f4bd801f957b550a34b03e8179a74341f194b45bc7ec3fddd00ae55817b1668d87d9147ba60d03ad7b401c3f49acb1d03013f9944f60c84c5a4
7
- data.tar.gz: 20bf37da5d593f206391f741025b1c010a5cf036f468d391c22feb5e2e998b8ffb55213b948df5491fc3c81bc78398feb66749432fb63283b468aafade1ccb7a
6
+ metadata.gz: 7e538b3d2e02c1d20e5a8b4cd30a11c8bbb6f3ffb6d3630384b4e1047ba69fdde331352cbe34cffed58927051a55eac25ab2e012b79700b80ec9052b8696cc67
7
+ data.tar.gz: d3e52bfbeeaeb14c5044c5a7301370993f900a471ed0c7a2b7c1b58b3881a51f3e144e896e4d6ab011e66dabb06af6cf4cde5de8fade2091f2b557efdc8cca5d
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.4.14 - 10-09-2019
2
+
3
+ - FEATURE: allow finding metrics by name RemoteMetric #find_registered_metric
4
+ - FIX: guard socket closing
5
+
1
6
  0.4.13 - 09-07-2019
2
7
 
3
8
  - Fix: Memory leak in unicorn and puma collectors
@@ -7,6 +7,8 @@ module PrometheusExporter
7
7
 
8
8
  class Client
9
9
  class RemoteMetric
10
+ attr_reader :name, :type, :help
11
+
10
12
  def initialize(name:, help:, type:, client:)
11
13
  @name = name
12
14
  @help = help
@@ -87,6 +89,16 @@ module PrometheusExporter
87
89
  metric
88
90
  end
89
91
 
92
+ def find_registered_metric(name, type: nil, help: nil)
93
+ @metrics.find do |metric|
94
+ type_match = type ? metric.type == type : true
95
+ help_match = help ? metric.help == help : true
96
+ name_match = metric.name == name
97
+
98
+ type_match && help_match && name_match
99
+ end
100
+ end
101
+
90
102
  def send_json(obj)
91
103
  payload = @custom_labels.nil? ? obj : obj.merge(custom_labels: @custom_labels)
92
104
  send(@json_serializer.dump(payload))
@@ -128,8 +140,8 @@ module PrometheusExporter
128
140
  sleep 0.001
129
141
  end
130
142
  @worker_thread = nil
131
- end
132
143
  close_socket!
144
+ end
133
145
  end
134
146
 
135
147
  private
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "client"
3
4
  require_relative "instrumentation/process"
4
5
  require_relative "instrumentation/method_profiler"
5
6
  require_relative "instrumentation/sidekiq"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusExporter
4
- VERSION = "0.4.13"
4
+ VERSION = "0.4.14"
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.4.13
4
+ version: 0.4.14
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-07-09 00:00:00.000000000 Z
11
+ date: 2019-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop