promenade 0.4.0 → 0.5.0

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: fcfb43aad9817592d691db8877de9ac9df46e39e98df91d600121e497dd3b1b4
4
- data.tar.gz: e152ba9577142a1648ab18914a777144930a685359c0ea874502027d2961b467
3
+ metadata.gz: 21a119e5d3d87a758957487577e0167dfff5f3d9bf04938b9c2b257f91d46c7c
4
+ data.tar.gz: 37698954cc28bdfca381663448821c190bfb5e5d4f67373780668c45e90669e5
5
5
  SHA512:
6
- metadata.gz: 997977c4f41d8ecc5db991cece8ff6b7ab950104ac8ad996b273446fef94ac6d4c5ce8f5c90a515d686ccc02db828c77630d03eeb8bd83ed72b6460fc3a700ed
7
- data.tar.gz: cdc7399c7d32986cd676d71cbddd333d535c2695068a278a01ef981ae75c88e1f43ca626341665b556cf3f421f9e0e74f0e1752f4f07cda132f249f5042efbc9
6
+ metadata.gz: 9fc56c5ea2851e9dfaeae6e56ef63795cab6e2acbd11eed8ecc0e70b9f8198186f92ca74d37afaa92bba579db826b06820fad7b78ee2dcd756aa019d8dd7967f
7
+ data.tar.gz: dd5269ee49251537374407c60cf9f31a00d3fcb6ffcfa7c0c0bfa9e8b76d23ca29c868d25ff5732a815e9adef193d73d4da626dd3f223f90d61ae31b640a9340
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- promenade (0.4.0)
4
+ promenade (0.5.0)
5
5
  actionpack
6
6
  activesupport (> 6.0, < 8.0)
7
7
  prometheus-client-mmap (~> 0.16.0)
@@ -266,4 +266,4 @@ DEPENDENCIES
266
266
  webrick
267
267
 
268
268
  BUNDLED WITH
269
- 2.1.4
269
+ 2.3.16
@@ -40,6 +40,7 @@ module Promenade
40
40
  @app = app
41
41
  @registry = registry
42
42
  @label_builder = label_builder
43
+ @latency_buckets = Promenade.configuration.rack_latency_buckets
43
44
  @exception_handler = exception_handler || default_exception_handler
44
45
  register_metrics!
45
46
  end
@@ -53,6 +54,7 @@ module Promenade
53
54
  attr_reader :app,
54
55
  :registry,
55
56
  :label_builder,
57
+ :latency_buckets,
56
58
  :exception_handler
57
59
 
58
60
  def trace(env)
@@ -93,7 +95,7 @@ module Promenade
93
95
 
94
96
  def register_metrics!
95
97
  registry.counter(REQUESTS_COUNTER_NAME, "A counter of the total number of HTTP requests made.")
96
- registry.histogram(HISTOGRAM_NAME, "A histogram of the response latency.")
98
+ registry.histogram(HISTOGRAM_NAME, "A histogram of the response latency.", {}, latency_buckets)
97
99
  registry.counter(EXCEPTIONS_COUNTER_NAME, "A counter of the total number of exceptions raised.")
98
100
  end
99
101
 
@@ -0,0 +1,11 @@
1
+ module Promenade
2
+ class Configuration
3
+ attr_accessor :rack_latency_buckets
4
+
5
+ DEFAULT_RACK_LATENCY_BUCKETS = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10].freeze
6
+
7
+ def initialize
8
+ @rack_latency_buckets = DEFAULT_RACK_LATENCY_BUCKETS
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Promenade
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.5.0".freeze
3
3
  end
data/lib/promenade.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "promenade/version"
2
2
  require "promenade/setup"
3
+ require "promenade/configuration"
3
4
  require "promenade/railtie" if defined? ::Rails::Railtie
4
5
  require "promenade/prometheus"
5
6
 
@@ -14,5 +15,13 @@ module Promenade
14
15
  def metric(name)
15
16
  Promenade::Prometheus.metric(name)
16
17
  end
18
+
19
+ def configuration
20
+ @_configuration ||= Configuration.new
21
+ end
22
+
23
+ def configure
24
+ yield(configuration)
25
+ end
17
26
  end
18
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promenade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Robinson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -246,7 +246,7 @@ dependencies:
246
246
  - - ">="
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
- description:
249
+ description:
250
250
  email:
251
251
  - edward-robinson@cookpad.com
252
252
  executables:
@@ -275,6 +275,7 @@ files:
275
275
  - lib/promenade/client/rack/exception_handler.rb
276
276
  - lib/promenade/client/rack/request_labeler.rb
277
277
  - lib/promenade/client/rack/singleton_caller.rb
278
+ - lib/promenade/configuration.rb
278
279
  - lib/promenade/engine.rb
279
280
  - lib/promenade/kafka.rb
280
281
  - lib/promenade/kafka/async_producer_subscriber.rb
@@ -293,7 +294,7 @@ licenses:
293
294
  - MIT
294
295
  metadata:
295
296
  rubygems_mfa_required: 'true'
296
- post_install_message:
297
+ post_install_message:
297
298
  rdoc_options: []
298
299
  require_paths:
299
300
  - lib
@@ -311,8 +312,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
312
  - !ruby/object:Gem::Version
312
313
  version: '0'
313
314
  requirements: []
314
- rubygems_version: 3.3.8
315
- signing_key:
315
+ rubygems_version: 3.2.32
316
+ signing_key:
316
317
  specification_version: 4
317
318
  summary: Promenade makes it simple to instrument Ruby apps for prometheus scraping
318
319
  test_files: []