prometheus_exporter 2.0.3 → 2.0.5

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: 07f116c0fdf15835af1b9520ca81b47c1d7a6011b3b8991cf9b569127d7a22fc
4
- data.tar.gz: f631d2d3259d72577e896a4f2a650f7af65e70b5703f24a02cbcebadd75f97d1
3
+ metadata.gz: 8bd1d7c955d48051b122205cd59d9700eace9c4b5ef1e38a87c9d4fbb14e8164
4
+ data.tar.gz: a44f8ab58e239550a0a75875dd4ad05c2f79769dcc781ad380afac7fac02d10b
5
5
  SHA512:
6
- metadata.gz: 81894939793a45953be6efbf90db9506abb6cc5ca196e03fd0bfe92035430284240820e1311e3f9532933602fa337790eb828e99809f003378cb6290b74f1eba
7
- data.tar.gz: 151c49417eee04b2f9b931d9bda160fd19df22d2d9ff474f2f54b57bc828504eaf2d2f047eae2be1f121ce4d0b3ed74e9695959bcd51da8a52949da8a3931604
6
+ metadata.gz: b5eedad2d76d14cfdaa6e693ba7862b82f3845e2136249bad6a879ec44bdff946c9ffc93f89448e1bdda1b2f673a5bc46df07266c2c8867247aa513250b5e79c
7
+ data.tar.gz: ae93f7dc838787cb72ae00037de19028f85d66ae7a71432fd74f064820ac3bc9664a27e64bfb0072fa41c195a1956007ffee3b629f80a882517248a4b21ff1bc
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ 2.0.5 - 2022-11-15
2
+
3
+ - FIX: regression :prepend style instrumentation not working correctly
4
+
5
+ 2.0.4 - 2022-11-10
6
+
7
+ - FIX/FEATURE: support for Redis 5 gem instrumentation
8
+
1
9
  2.0.3 - 2022-05-23
2
10
 
3
11
  - FEATURE: new ping endpoint for keepalive checks
data/README.md CHANGED
@@ -5,7 +5,7 @@ Prometheus Exporter allows you to aggregate custom metrics from multiple process
5
5
  To learn more see [Instrumenting Rails with Prometheus](https://samsaffron.com/archive/2018/02/02/instrumenting-rails-with-prometheus) (it has pretty pictures!)
6
6
 
7
7
  * [Requirements](#requirements)
8
- * [Migrating from v0.x](#migrating-from-v0.x)
8
+ * [Migrating from v0.x](#migrating-from-v0x)
9
9
  * [Installation](#installation)
10
10
  * [Usage](#usage)
11
11
  * [Single process mode](#single-process-mode)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class MyCustomCollector < PrometheusExporter::Server::Collector
3
+ class MyCustomCollector < PrometheusExporter::Server::BaseCollector
4
4
  def initialize
5
5
  @gauge1 = PrometheusExporter::Metric::Gauge.new("thing1", "I am thing 1")
6
6
  @gauge2 = PrometheusExporter::Metric::Gauge.new("thing2", "I am thing 2")
@@ -40,10 +40,7 @@ class PrometheusExporter::Instrumentation::MethodProfiler
40
40
  data
41
41
  end
42
42
 
43
- private
44
-
45
- def self.patch_using_prepend(klass, methods, name)
46
- prepend_instument = Module.new
43
+ def self.define_methods_on_module(klass, methods, name)
47
44
  patch_source_line = __LINE__ + 3
48
45
  patches = methods.map do |method_name|
49
46
  <<~RUBY
@@ -63,8 +60,13 @@ private
63
60
  RUBY
64
61
  end.join("\n")
65
62
 
66
- prepend_instument.module_eval patches, __FILE__, patch_source_line
67
- klass.prepend(prepend_instument)
63
+ klass.module_eval patches, __FILE__, patch_source_line
64
+ end
65
+
66
+ def self.patch_using_prepend(klass, methods, name)
67
+ prepend_instrument = Module.new
68
+ define_methods_on_module(prepend_instrument, methods, name)
69
+ klass.prepend(prepend_instrument)
68
70
  end
69
71
 
70
72
  def self.patch_using_alias_method(klass, methods, name)
@@ -11,7 +11,12 @@ class PrometheusExporter::Middleware
11
11
  @client = config[:client] || PrometheusExporter::Client.default
12
12
 
13
13
  if config[:instrument]
14
- if defined? Redis::Client
14
+ if defined?(RedisClient)
15
+ apply_redis_client_middleware!
16
+ end
17
+ if defined?(Redis::VERSION) && (Gem::Version.new(Redis::VERSION) >= Gem::Version.new('5.0.0'))
18
+ # redis 5 support handled via RedisClient
19
+ elsif defined? Redis::Client
15
20
  MethodProfiler.patch(Redis::Client, [
16
21
  :call, :call_pipeline
17
22
  ], :redis, instrument: config[:instrument])
@@ -116,4 +121,14 @@ class PrometheusExporter::Middleware
116
121
 
117
122
  end
118
123
 
124
+ private
125
+
126
+ module RedisInstrumenter
127
+ MethodProfiler.define_methods_on_module(self, ["call", "call_pipelined"], "redis")
128
+ end
129
+
130
+ def apply_redis_client_middleware!
131
+ RedisClient.register(RedisInstrumenter)
132
+ end
133
+
119
134
  end
@@ -60,7 +60,7 @@ module PrometheusExporter::Server
60
60
  custom_labels = obj['custom_labels']
61
61
  labels = custom_labels.nil? ? default_labels : default_labels.merge(custom_labels)
62
62
 
63
- @http_requests_total.observe(1, labels.merge(status: obj["status"]))
63
+ @http_requests_total.observe(1, labels.merge("status" => obj["status"]))
64
64
 
65
65
  if timings = obj["timings"]
66
66
  @http_request_duration_seconds.observe(timings["total_duration"], labels)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusExporter
4
- VERSION = '2.0.3'
4
+ VERSION = '2.0.5'
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "rubocop", ">= 0.69"
30
30
  spec.add_development_dependency "bundler", ">= 2.1.4"
31
31
  spec.add_development_dependency "rake", "~> 13.0"
32
- spec.add_development_dependency "minitest", "~> 5.0"
32
+ spec.add_development_dependency "minitest", "~> 5.15.0" # https://github.com/qrush/m/issues/93
33
33
  spec.add_development_dependency "guard", "~> 2.0"
34
34
  spec.add_development_dependency "mini_racer", "~> 0.5.0"
35
35
  spec.add_development_dependency "guard-minitest", "~> 2.0"
@@ -39,6 +39,8 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "rubocop-discourse", ">2"
40
40
  spec.add_development_dependency "appraisal", "~> 2.3"
41
41
  spec.add_development_dependency "activerecord", "~> 6.0.0"
42
+ spec.add_development_dependency "redis", "> 5"
43
+ spec.add_development_dependency "m"
42
44
  if !RUBY_ENGINE == 'jruby'
43
45
  spec.add_development_dependency "raindrops", "~> 0.19"
44
46
  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: 2.0.3
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-23 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webrick
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '5.0'
75
+ version: 5.15.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '5.0'
82
+ version: 5.15.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: guard
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,34 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 6.0.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: redis
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">"
214
+ - !ruby/object:Gem::Version
215
+ version: '5'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">"
221
+ - !ruby/object:Gem::Version
222
+ version: '5'
223
+ - !ruby/object:Gem::Dependency
224
+ name: m
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
209
237
  description: Prometheus metric collector and exporter for Ruby
210
238
  email:
211
239
  - sam.saffron@gmail.com