yabeda-prometheus-mmap 0.1.2 → 0.2.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: 73d01a0f121f5146808f3f97a1fb089ccaaffedcaeda142549af989cb55496c1
4
- data.tar.gz: a513b29dba8f2406c3e0888e36ccd4a7445040b55602abf29211b15a66776d48
3
+ metadata.gz: 759db288b622e2ae72ba1d304d0cabbf31d67f9e68cbc7f056c34a33b636e101
4
+ data.tar.gz: c6778787416e6ebe3a719d2bf8e88e910e6eb4518fa1f5d8fde4571839f0fb4a
5
5
  SHA512:
6
- metadata.gz: 77b401497bdead3aef26fdcd217d9b25bcb6265140c754b1491a3f28d8dff9d2443b1eb41f9198e3997c12293e88e8011c2d5d2b04fa1a3a468583c920d11c0e
7
- data.tar.gz: 617deebd2f04b5ec0397c671047e9c0391619ec2830f17749e40e0075d904ce4a0508bfe0c612f97c3cb322b4891f43fcbd6a875685de5c59ca80d09dd9cee38
6
+ metadata.gz: 739bfbbb8de20743592d0528bd0e7a83c3a8c2e416cab44c10e2a4f90fd8577c3d17f287df1ece768bded0a4645f401e78856f59782a2c0e22d001aec650fc42
7
+ data.tar.gz: a69d049adb2ef301e0efd1cc01bb49fa0632c4584727de5ac4d0f647602df887bbc92203cb22ceb4585f5c20d926c09f9db6222a0310033fd71cc481d095d252
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ ---
2
+ AllCops:
3
+ TargetRubyVersion: 2.3
4
+
5
+ Metrics/BlockLength:
6
+ Exclude:
7
+ - "Gemfile"
8
+ - "spec/**/*"
9
+
10
+ Layout/LineLength:
11
+ Max: 120
data/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 0.2.0 - 2021-07-21
9
+
10
+ ### Added
11
+
12
+ - Debug mode with metric `yabeda_prometheus_mmap_render_duration` to measure how long takes to render response with already collected metrics for Prometheus. Requires Yabeda 0.10+. [@Envek], [@dsalahutdinov]
13
+
14
+ ### Changed
15
+
16
+ - Yabeda 0.10.0 or newer is required. [@Envek]
17
+
18
+ ## 0.1.2 - 2021-06-23
19
+
20
+ ### Fixed
21
+
22
+ - Fix `uninitialized constant Yabeda::Rack::Handler (NameError)` when using [yabeda-rack-attack](https://github.com/dsalahutdinov/yabeda-rack-attack). [@dsalahutdinov]
23
+
8
24
  ## 0.1.1 - 2020-08-04
9
25
 
10
26
  ### Fixed
@@ -17,3 +33,4 @@ Initial release. [@dsalahutdinov][]
17
33
 
18
34
  [@macchiang]: https://github.com/macchiang "Mac"
19
35
  [@dsalahutdinov]: https://github.com/dsalahutdinov "Salahutdinov Dmitry"
36
+ [@Envek]: https://github.com/Envek "Andrey Novikov"
data/README.md CHANGED
@@ -55,6 +55,11 @@ And then execute:
55
55
 
56
56
  Port is configured by `PROMETHEUS_EXPORTER_PORT` or `PORT` variables (default is `9394`).
57
57
 
58
+ ## Debugging metrics
59
+
60
+ - Time of already collected metrics rendering in response for Prometheus: `yabeda_prometheus_mmap_render_duration`.
61
+
62
+ These are only enabled in debug mode. See [Yabeda debugging metrics](https://github.com/yabeda-rb/yabeda#debugging-metrics) on how to enable it (e.g. by specifying `YABEDA_DEBUG=true` in your environment variables).
58
63
 
59
64
  ## Development with Docker
60
65
 
@@ -75,6 +75,17 @@ module Yabeda
75
75
  raise ArgumentError, 'Prometheus require metrics to have comments'
76
76
  end
77
77
 
78
+ def debug!
79
+ Yabeda.configure do
80
+ group :yabeda_prometheus_mmap
81
+
82
+ histogram :render_duration,
83
+ tags: %i[], unit: :seconds,
84
+ buckets: [0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10],
85
+ comment: 'Time required to render all metrics in Prometheus format'
86
+ end
87
+ end
88
+
78
89
  Yabeda.register_adapter(:prometheus, new)
79
90
  end
80
91
  end
@@ -47,8 +47,17 @@ module Yabeda
47
47
  end
48
48
 
49
49
  def call(env)
50
- Yabeda.collectors.each(&:call) if env['PATH_INFO'] == path
51
- super
50
+ ::Yabeda.collect! if env['PATH_INFO'] == path
51
+
52
+ if ::Yabeda.debug?
53
+ result = nil
54
+ ::Yabeda.yabeda_prometheus_mmap.render_duration.measure({}) do
55
+ result = super
56
+ end
57
+ result
58
+ else
59
+ super
60
+ end
52
61
  end
53
62
  end
54
63
  end
@@ -3,7 +3,7 @@
3
3
  module Yabeda
4
4
  module Prometheus
5
5
  module Mmap
6
- VERSION = '0.1.2'
6
+ VERSION = '0.2.0'
7
7
  end
8
8
  end
9
9
  end
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_dependency 'prometheus-client-mmap'
31
- spec.add_dependency 'yabeda', '~> 0.5'
31
+ spec.add_dependency 'yabeda', '~> 0.10'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-prometheus-mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Salahutdinov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-23 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prometheus-client-mmap
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
33
+ version: '0.10'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.5'
40
+ version: '0.10'
41
41
  description: Uses prometheus-client-mmap
42
42
  email:
43
43
  - dsalahutdinov@gmail.com
@@ -49,6 +49,7 @@ files:
49
49
  - ".github/workflows/test.yml"
50
50
  - ".gitignore"
51
51
  - ".rspec"
52
+ - ".rubocop.yml"
52
53
  - CHANGELOG.md
53
54
  - Gemfile
54
55
  - LICENSE.txt