promenade 0.2.1 → 0.2.2

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: 7705979e8349af87c849139112e61e3a50cb09264e672363d6fdb5d1282da328
4
- data.tar.gz: 2d849d1877183ab91baa10195d2035abffc3619692ca62b7285af5d03cab9ca1
3
+ metadata.gz: 8b4b2246b9bdf2b31727cfb898cf680facfe1bfcd9a6c3393eb7237c4c2ef870
4
+ data.tar.gz: 64f386aa492f3f953cb80d8de3067e4d2565de9e0d3d9379888596f2d88cd283
5
5
  SHA512:
6
- metadata.gz: 72e7318b7db15017fd6882889abff0e194ba32a996dda10da4939f3c9de377c9f2c37903926fcb72066a1f311da662d5bd40f64aff0985415839abc114b876b0
7
- data.tar.gz: 7f71477ab1237c414dd79f02dee1c6995ffd3afbdbfb25f3d9ec0877b7eec727108aa0425e1297759809f0e3a6a9817567460cdd6fe540977e90e5e5c7803657
6
+ metadata.gz: 7a7e963d14200c730bfbc8d609ff8571dffae97f136ec5ecf3e567877795d1d8e300c8c9256b905263eb73f422e35b46cf6cae211cbab9edf89675ade9ab1f57
7
+ data.tar.gz: d2387375708b46e7f9823ba481419cf1f46b0656ce4f3e42485b420635383aaec7953185bdf714f7a4c7ecb4b38edd0a22bd1ca232705876d087a8df05668971
@@ -0,0 +1,20 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ -master
6
+ pull_request:
7
+ jobs:
8
+ test:
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: ['2.6', '2.7', '3.0']
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ bundler-cache: true
20
+ - run: bundle exec rake
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  /tmp/
9
9
  .rubocop-https*yml
10
10
  .sass-cache/
11
+ vendor
11
12
 
12
13
  # rspec failure tracking
13
14
  .rspec_status
data/.rubocop.yml CHANGED
@@ -2,9 +2,17 @@ inherit_from:
2
2
  - https://raw.githubusercontent.com/cookpad/guides/master/.rubocop.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.4
5
+ TargetRubyVersion: 2.5
6
+ NewCops: enable
7
+ Exclude:
8
+ - vendor/**/*
9
+ - vendor/**/.*
6
10
 
7
11
  Style/TrailingCommaInHashLiteral:
8
12
  EnforcedStyleForMultiline: comma
9
13
  Style/TrailingCommaInArguments:
10
14
  EnforcedStyleForMultiline: comma
15
+ Rails/RakeEnvironment:
16
+ Enabled: false
17
+ Rails/EnvironmentVariableAccess:
18
+ Enabled: false
data/Gemfile CHANGED
@@ -4,3 +4,4 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  gem "codecov"
7
+ gem "webrick"
data/Gemfile.lock CHANGED
@@ -1,108 +1,114 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- promenade (0.2.1)
4
+ promenade (0.2.2)
5
5
  activesupport
6
- prometheus-client-mmap (~> 0.9.3)
6
+ prometheus-client-mmap (~> 0.12.0)
7
7
  rack
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.0)
12
+ activesupport (6.1.3.2)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.1, >= 2.1.8)
18
- ast (2.4.0)
19
- backports (3.15.0)
20
- binding_of_caller (0.8.0)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ ast (2.4.2)
19
+ backports (3.21.0)
20
+ binding_of_caller (1.0.0)
21
21
  debug_inspector (>= 0.0.1)
22
- climate_control (0.2.0)
23
- codecov (0.1.14)
24
- json
25
- simplecov
26
- url
27
- coderay (1.1.2)
28
- concurrent-ruby (1.1.5)
29
- debug_inspector (0.0.3)
30
- deep-cover (0.7.5)
31
- deep-cover-core (= 0.7.5)
22
+ climate_control (1.0.0)
23
+ codecov (0.5.2)
24
+ simplecov (>= 0.15, < 0.22)
25
+ coderay (1.1.3)
26
+ concurrent-ruby (1.1.8)
27
+ debug_inspector (1.1.0)
28
+ deep-cover (1.1.0)
29
+ deep-cover-core (= 1.1.0)
32
30
  highline
33
31
  thor (>= 0.20.3)
34
32
  with_progress
35
- deep-cover-core (0.7.5)
33
+ deep-cover-core (1.1.0)
36
34
  backports (>= 3.11.0)
37
35
  binding_of_caller
38
- parser (>= 2.5, < 2.7)
36
+ parser (>= 2.5)
39
37
  pry
40
38
  term-ansicolor
41
39
  terminal-table
42
- diff-lcs (1.3)
43
- docile (1.3.2)
44
- highline (2.0.2)
45
- i18n (1.6.0)
40
+ diff-lcs (1.4.4)
41
+ docile (1.4.0)
42
+ highline (2.0.3)
43
+ i18n (1.8.10)
46
44
  concurrent-ruby (~> 1.0)
47
- jaro_winkler (1.5.3)
48
- json (2.2.0)
49
- method_source (0.9.2)
50
- minitest (5.12.0)
51
- parallel (1.17.0)
52
- parser (2.6.4.1)
53
- ast (~> 2.4.0)
54
- prometheus-client-mmap (0.9.10)
55
- pry (0.12.2)
56
- coderay (~> 1.1.0)
57
- method_source (~> 0.9.0)
58
- rack (2.0.7)
45
+ method_source (1.0.0)
46
+ minitest (5.14.4)
47
+ parallel (1.20.1)
48
+ parser (3.0.1.1)
49
+ ast (~> 2.4.1)
50
+ prometheus-client-mmap (0.12.0)
51
+ pry (0.14.1)
52
+ coderay (~> 1.1)
53
+ method_source (~> 1.0)
54
+ rack (2.2.3)
59
55
  rainbow (3.0.0)
60
- rake (10.5.0)
61
- rspec (3.8.0)
62
- rspec-core (~> 3.8.0)
63
- rspec-expectations (~> 3.8.0)
64
- rspec-mocks (~> 3.8.0)
65
- rspec-core (3.8.2)
66
- rspec-support (~> 3.8.0)
67
- rspec-expectations (3.8.4)
56
+ rake (13.0.3)
57
+ regexp_parser (2.1.1)
58
+ rexml (3.2.5)
59
+ rspec (3.10.0)
60
+ rspec-core (~> 3.10.0)
61
+ rspec-expectations (~> 3.10.0)
62
+ rspec-mocks (~> 3.10.0)
63
+ rspec-core (3.10.1)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-expectations (3.10.1)
68
66
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.8.0)
70
- rspec-mocks (3.8.1)
67
+ rspec-support (~> 3.10.0)
68
+ rspec-mocks (3.10.2)
71
69
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.8.0)
73
- rspec-support (3.8.2)
74
- rubocop (0.74.0)
75
- jaro_winkler (~> 1.5.1)
70
+ rspec-support (~> 3.10.0)
71
+ rspec-support (3.10.2)
72
+ rubocop (1.15.0)
76
73
  parallel (~> 1.10)
77
- parser (>= 2.6)
74
+ parser (>= 3.0.0.0)
78
75
  rainbow (>= 2.2.2, < 4.0)
76
+ regexp_parser (>= 1.8, < 3.0)
77
+ rexml
78
+ rubocop-ast (>= 1.5.0, < 2.0)
79
79
  ruby-progressbar (~> 1.7)
80
- unicode-display_width (>= 1.4.0, < 1.7)
81
- rubocop-performance (1.4.1)
82
- rubocop (>= 0.71.0)
83
- rubocop-rails (2.3.2)
80
+ unicode-display_width (>= 1.4.0, < 3.0)
81
+ rubocop-ast (1.5.0)
82
+ parser (>= 3.0.1.1)
83
+ rubocop-performance (1.11.3)
84
+ rubocop (>= 1.7.0, < 2.0)
85
+ rubocop-ast (>= 0.4.0)
86
+ rubocop-rails (2.10.1)
87
+ activesupport (>= 4.2.0)
84
88
  rack (>= 1.1)
85
- rubocop (>= 0.72.0)
86
- ruby-progressbar (1.10.1)
87
- simplecov (0.17.1)
89
+ rubocop (>= 1.7.0, < 2.0)
90
+ ruby-progressbar (1.11.0)
91
+ simplecov (0.21.2)
88
92
  docile (~> 1.1)
89
- json (>= 1.8, < 3)
90
- simplecov-html (~> 0.10.0)
91
- simplecov-html (0.10.2)
93
+ simplecov-html (~> 0.11)
94
+ simplecov_json_formatter (~> 0.1)
95
+ simplecov-html (0.12.3)
96
+ simplecov_json_formatter (0.1.3)
97
+ sync (0.5.0)
92
98
  term-ansicolor (1.7.1)
93
99
  tins (~> 1.0)
94
- terminal-table (1.8.0)
95
- unicode-display_width (~> 1.1, >= 1.1.1)
96
- thor (0.20.3)
97
- thread_safe (0.3.6)
98
- tins (1.21.1)
99
- tzinfo (1.2.5)
100
- thread_safe (~> 0.1)
101
- unicode-display_width (1.6.0)
102
- url (0.3.2)
100
+ terminal-table (3.0.1)
101
+ unicode-display_width (>= 1.1.1, < 3)
102
+ thor (1.1.0)
103
+ tins (1.29.1)
104
+ sync
105
+ tzinfo (2.0.4)
106
+ concurrent-ruby (~> 1.0)
107
+ unicode-display_width (2.0.0)
108
+ webrick (1.7.0)
103
109
  with_progress (1.0.1)
104
110
  ruby-progressbar (~> 1.4)
105
- zeitwerk (2.1.10)
111
+ zeitwerk (2.4.2)
106
112
 
107
113
  PLATFORMS
108
114
  ruby
@@ -113,12 +119,13 @@ DEPENDENCIES
113
119
  codecov
114
120
  deep-cover
115
121
  promenade!
116
- rake (~> 10.0)
122
+ rake (~> 13.0)
117
123
  rspec (~> 3.0)
118
124
  rubocop
119
125
  rubocop-performance
120
126
  rubocop-rails
121
127
  simplecov
128
+ webrick
122
129
 
123
130
  BUNDLED WITH
124
- 2.0.2
131
+ 2.1.4
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Promenade
2
2
 
3
- [![Build Status](https://travis-ci.org/errm/promenade.svg?branch=master)](https://travis-ci.org/errm/promenade)
3
+ [![CI](https://github.com/errm/promenade/actions/workflows/ci.yaml/badge.svg)](https://github.com/errm/promenade/actions/workflows/ci.yaml)
4
4
  [![Gem Version](https://badge.fury.io/rb/promenade.svg)](https://badge.fury.io/rb/promenade)
5
- [![codecov](https://codecov.io/gh/errm/promenade/branch/master/graph/badge.svg)](https://codecov.io/gh/errm/promenade)
6
5
 
7
6
  Promenade is a library to simplify instrumenting Ruby applications with Prometheus.
8
7
 
data/Rakefile CHANGED
@@ -5,12 +5,16 @@ require "rubocop/rake_task"
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
  RuboCop::RakeTask.new
7
7
 
8
- task default: %i(spec rubocop)
8
+ task default: %i(spec rubocop integration)
9
9
 
10
10
  task :clean do
11
11
  sh "rm -rf tmp/promenade"
12
12
  end
13
13
 
14
+ task integration: :clean do
15
+ sh "bin/integration_test"
16
+ end
17
+
14
18
  task spec: :clean
15
19
 
16
- task release: :spec
20
+ task release: :default
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "promenade"
5
+ require "fileutils"
6
+ require "net/http"
7
+
8
+ def test_http_body(expected)
9
+ uri = URI("http://localhost:9394/metrics")
10
+
11
+ Net::HTTP.start(uri.host, uri.port) do |http|
12
+ request = Net::HTTP::Get.new uri
13
+ response = http.request request
14
+ fail "#{response.body} didn't include #{expected}" unless response.body.split("\n").any?(expected)
15
+ end
16
+ end
17
+
18
+ Promenade.setup
19
+
20
+ pid = Process.spawn "exe/promenade"
21
+ sleep 1
22
+
23
+ at_exit do
24
+ Process.kill "SIGTERM", pid
25
+ Process.waitpid(pid)
26
+ end
27
+
28
+ Promenade.counter :widgets_created do
29
+ doc "Records how many widgets are created"
30
+ end
31
+
32
+ Promenade.metric(:widgets_created).increment({ type: "guinness" })
33
+ test_http_body('widgets_created{type="guinness"} 1')
34
+
35
+ Promenade.metric(:widgets_created).increment({ type: "john-smiths" })
36
+ test_http_body('widgets_created{type="guinness"} 1')
37
+ test_http_body('widgets_created{type="john-smiths"} 1')
38
+
39
+ Promenade.histogram :calculator_time_taken do
40
+ doc "Records how long it takes to do the adding"
41
+ buckets [0.25, 0.5, 1, 2, 4]
42
+ end
43
+
44
+ Promenade.metric(:calculator_time_taken).observe({ operation: "addition" }, 0.5)
45
+ Promenade.metric(:calculator_time_taken).observe({ operation: "addition" }, 0.5)
46
+ Promenade.metric(:calculator_time_taken).observe({ operation: "addition" }, 1)
47
+
48
+ test_http_body('calculator_time_taken_bucket{operation="addition",le="0.25"} 0')
49
+ test_http_body('calculator_time_taken_bucket{operation="addition",le="0.5"} 2')
50
+ test_http_body('calculator_time_taken_bucket{operation="addition",le="1"} 3')
51
+ test_http_body('calculator_time_taken_bucket{operation="addition",le="1"} 3')
52
+
53
+ exit
@@ -90,7 +90,7 @@ module Promenade
90
90
  Promenade.metric(:kafka_consumer_time_lag).set(labels, time_lag) if time_lag
91
91
  end
92
92
 
93
- def process_batch(event) # rubocop:disable Metrics/AbcSize
93
+ def process_batch(event)
94
94
  labels = get_labels(event)
95
95
  offset_lag = event.payload.fetch(:offset_lag)
96
96
  messages = event.payload.fetch(:message_count)
@@ -1,3 +1,3 @@
1
1
  module Promenade
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
data/promenade.gemspec CHANGED
@@ -2,7 +2,7 @@ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "promenade/version"
4
4
 
5
- Gem::Specification.new do |spec|
5
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
6
6
  spec.name = "promenade"
7
7
  spec.version = Promenade::VERSION
8
8
  spec.authors = ["Ed Robinson"]
@@ -22,14 +22,16 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.required_ruby_version = ">= 2.5", "< 4"
26
+
25
27
  spec.add_dependency "activesupport"
26
- spec.add_dependency "prometheus-client-mmap", "~> 0.9.3"
28
+ spec.add_dependency "prometheus-client-mmap", "~> 0.12.0"
27
29
  spec.add_dependency "rack"
28
30
 
29
31
  spec.add_development_dependency "bundler", "~> 2.0"
30
32
  spec.add_development_dependency "climate_control"
31
33
  spec.add_development_dependency "deep-cover"
32
- spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rake", "~> 13.0"
33
35
  spec.add_development_dependency "rspec", "~> 3.0"
34
36
  spec.add_development_dependency "rubocop"
35
37
  spec.add_development_dependency "rubocop-performance"
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.2.1
4
+ version: 0.2.2
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: 2019-09-24 00:00:00.000000000 Z
11
+ date: 2021-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.3
33
+ version: 0.12.0
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.9.3
40
+ version: 0.12.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '10.0'
103
+ version: '13.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.0'
110
+ version: '13.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,7 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- description:
181
+ description:
182
182
  email:
183
183
  - edward-robinson@cookpad.com
184
184
  executables:
@@ -186,10 +186,10 @@ executables:
186
186
  extensions: []
187
187
  extra_rdoc_files: []
188
188
  files:
189
+ - ".github/workflows/ci.yaml"
189
190
  - ".gitignore"
190
191
  - ".rspec"
191
192
  - ".rubocop.yml"
192
- - ".travis.yml"
193
193
  - CODE_OF_CONDUCT.md
194
194
  - Gemfile
195
195
  - Gemfile.lock
@@ -198,6 +198,7 @@ files:
198
198
  - README.md
199
199
  - Rakefile
200
200
  - bin/console
201
+ - bin/integration_test
201
202
  - bin/setup
202
203
  - exe/promenade
203
204
  - lib/promenade.rb
@@ -217,7 +218,7 @@ homepage: https://github.com/errm/promenade
217
218
  licenses:
218
219
  - MIT
219
220
  metadata: {}
220
- post_install_message:
221
+ post_install_message:
221
222
  rdoc_options: []
222
223
  require_paths:
223
224
  - lib
@@ -225,15 +226,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
226
  requirements:
226
227
  - - ">="
227
228
  - !ruby/object:Gem::Version
228
- version: '0'
229
+ version: '2.5'
230
+ - - "<"
231
+ - !ruby/object:Gem::Version
232
+ version: '4'
229
233
  required_rubygems_version: !ruby/object:Gem::Requirement
230
234
  requirements:
231
235
  - - ">="
232
236
  - !ruby/object:Gem::Version
233
237
  version: '0'
234
238
  requirements: []
235
- rubygems_version: 3.0.1
236
- signing_key:
239
+ rubygems_version: 3.1.2
240
+ signing_key:
237
241
  specification_version: 4
238
242
  summary: Promenade makes it simple to instrument Ruby apps for prometheus scraping
239
243
  test_files: []
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.5
5
- - 2.6.3
6
- before_install: gem install bundler -v 2.0.2