time_bandits 0.12.0 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ac35c38f3393a0ff15bd629eaa862ab6f80b8c23dd199bd7ab0a21081ed7adc
4
- data.tar.gz: 640caa883d9975cd47a662c0995b97fba05de0795e374ab4719f4c50cc3e773a
3
+ metadata.gz: 9824d9fcd5eef40eebbf628d042f34604f310e563570c62e488bb8084533f24a
4
+ data.tar.gz: c7bc40bcbce473400e9216268bf2abc10f7c1d6fbfc0ac90305bfaba444e8706
5
5
  SHA512:
6
- metadata.gz: 14059e1e2903f23e6b61340688a1d6942a00c062d6088bb23c1f04b89e355860aa34b66d5e4a7926986e4f947e37a8bad72cf9ff0f149d9f86d8a68fa9fd05fd
7
- data.tar.gz: cad90ceabc0220576aae6c8ffe83a3ec2c06f346e980e0c20d962267090dac1b03e36fcc8517e757104d9baf849b5cedc9bab5c7ffbabab2a064ffc7775eabc3
6
+ metadata.gz: 3d78ca08b9d112fd2e4365b7df522badce8e57965d469dac2cf65c5ea51753078021729e066d798781e040140e306af4f274fed6da4b9246a7866c44bff6fb92
7
+ data.tar.gz: 1ac34b522398bdf6419a53e28fd068e434cc538c669160cc423a8a9590443724e1d7acfe4ecb40fe50f2268c1c30f8882e137e5907c6e66ac960e64d8023ae97
@@ -0,0 +1,46 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ ruby-version: [3.0.3, 2.7.5, 2.6.9]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+
21
+ - name: Start containers
22
+ run: docker-compose -f docker-compose.yml up -d
23
+
24
+ - name: Set up Ruby ${{ matrix.ruby-version }}
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby-version }}
28
+
29
+ - name: Install dependencies
30
+ run: sudo apt-get install libsasl2-dev
31
+
32
+ - name: Install gems
33
+ run: bundle install
34
+
35
+ - name: Run tests
36
+ run: bundle exec rake test
37
+
38
+ - name: Install appraisals
39
+ run: bundle exec appraisal install
40
+
41
+ - name: Run appraisals
42
+ run: bundle exec appraisal rake test
43
+
44
+ - name: Stop containers
45
+ if: always()
46
+ run: docker-compose -f "docker-compose.yml" down
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ pkg/*
6
6
  .DS_Store
7
7
  .rvmrc
8
8
  dump.rdb
9
+ gemfiles/*
data/Appraisals CHANGED
@@ -1,7 +1,12 @@
1
- [
2
- "5.2.4.3",
3
- "6.0.3.2"
4
- ].each do |rails_version|
1
+ appraisals = [
2
+ "6.0.4.4",
3
+ "6.1.4.4",
4
+ ]
5
+
6
+ appraisals.insert(0, "5.2.6") if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
7
+ appraisals << "7.0.0" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
8
+
9
+ appraisals.each do |rails_version|
5
10
  appraise "activesupport-#{rails_version}" do
6
11
  gem "activesupport", rails_version
7
12
  gem "activerecord", rails_version
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2020 Stefan Kaes <skaes@railsexpress.de>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  Time Bandits is a gem plugin for Rails which enhances Rails' controller/view/db benchmark logging.
6
6
 
7
+ ![Build](https://github.com/skaes/time_bandits/actions/workflows/run-tests.yml/badge.svg)
8
+
9
+
7
10
  ## Usage
8
11
 
9
12
  Without configuration, the standard Rails 'Completed line' will change
@@ -85,6 +88,16 @@ Run `docker-compose up` to start Redis, MySQL, RabbitMQ and Memached containers,
85
88
 
86
89
  ## Release Notes
87
90
 
91
+ ## Version 0.12.3
92
+ - suppress Ruby 2.7 warnings about keyword parameters in controller tests
93
+
94
+ ## Version 0.12.2
95
+ - fixed that completed line was logged twice in Rails test environment
96
+
97
+ ## Version 0.12.1
98
+ - support having the rails gem in a bundle without activating the time bandits railtie
99
+ - automatically install the garbage collection time bandit in rails applications
100
+
88
101
  ## Version 0.12.0
89
102
  - drops support for Rails versions before 5.2.0 and Ruby versions before 2.2.0
90
103
  - makes it possible to use individual time bandits without Rails (e.g. in a Sinatra app)
@@ -181,26 +194,4 @@ Run `docker-compose up` to start Redis, MySQL, RabbitMQ and Memached containers,
181
194
  - times are all measured in milliseconds internally
182
195
  - added class TimeBandits::TimeConsumers::BaseConsumer to simplify writing custom consumers
183
196
 
184
- ## License
185
-
186
- Copyright (c) 2009-2020 Stefan Kaes <skaes@railsexpress.de>
187
-
188
- Permission is hereby granted, free of charge, to any person obtaining
189
- a copy of this software and associated documentation files (the
190
- "Software"), to deal in the Software without restriction, including
191
- without limitation the rights to use, copy, modify, merge, publish,
192
- distribute, sublicense, and/or sell copies of the Software, and to
193
- permit persons to whom the Software is furnished to do so, subject to
194
- the following conditions:
195
-
196
- The above copyright notice and this permission notice shall be
197
- included in all copies or substantial portions of the Software.
198
-
199
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
200
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
201
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
202
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
203
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
204
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
205
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
206
197
 
data/docker-compose.yml CHANGED
@@ -11,18 +11,18 @@ services:
11
11
 
12
12
  memcached:
13
13
  container_name: memcached
14
- image: memcached:1.6.6
14
+ image: memcached:1.6.8
15
15
  ports:
16
16
  - "11211:11211"
17
17
 
18
18
  redis:
19
19
  container_name: redis
20
- image: redis:5.0.9
20
+ image: redis:5.0
21
21
  ports:
22
22
  - "6379:6379"
23
23
 
24
24
  rabbitmq:
25
25
  container_name: rabbitmq
26
- image: rabbitmq:3.8.5
26
+ image: rabbitmq:3.8
27
27
  ports:
28
28
  - "5672:5672"
@@ -36,20 +36,6 @@ module ActionController #:nodoc:
36
36
  :time_bandits_completed_info,
37
37
  [ event.duration, additions, payload[:view_runtime], "#{payload[:controller]}##{payload[:action]}" ]
38
38
  )
39
-
40
- # this is an ugly hack to ensure completed lines show up in the test logs
41
- # TODO: move this code to some other place
42
- return unless Rails.env.test?
43
-
44
- status = payload[:status]
45
- if status.nil? && payload[:exception].present?
46
- exception_class_name = payload[:exception].first
47
- status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
48
- end
49
- message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in %.1fms" % event.duration
50
- message << " (#{additions.join(" | ")})" unless additions.blank?
51
-
52
- info(message)
53
39
  end
54
40
  end
55
41
 
@@ -7,7 +7,8 @@ module TimeBandits
7
7
  class Railtie < Rails::Railtie
8
8
 
9
9
  initializer "time_bandits" do |app|
10
- app.config.middleware.swap(Rails::Rack::Logger, TimeBandits::Rack::Logger)
10
+ app.config.middleware.insert_after(Rails::Rack::Logger, TimeBandits::Rack::Logger)
11
+ app.config.middleware.delete(Rails::Rack::Logger)
11
12
 
12
13
  ActiveSupport.on_load(:action_controller) do
13
14
  require 'time_bandits/monkey_patches/action_controller'
@@ -25,9 +26,9 @@ module TimeBandits
25
26
  # Rails 5 fires on_load events multiple times, so we need to protect against endless recursion here
26
27
  next if ActionController::TestCase::Behavior.instance_methods.include?(:process_without_time_bandits)
27
28
  module ActionController::TestCase::Behavior
28
- def process_with_time_bandits(*args)
29
+ def process_with_time_bandits(action, **opts)
29
30
  TimeBandits.reset
30
- process_without_time_bandits(*args)
31
+ process_without_time_bandits(action, **opts)
31
32
  end
32
33
  alias_method :process_without_time_bandits, :process
33
34
  alias_method :process, :process_with_time_bandits
@@ -41,9 +42,11 @@ module TimeBandits
41
42
  TimeBandits.add TimeBandits::TimeConsumers::Database
42
43
  end
43
44
 
44
- # reset statistics info, so that for example the time for the first request handled
45
- # by the dispatcher is correct.
45
+ # Reset statistics info, so that for example the time for the first request handled
46
+ # by the dispatcher is correct. Also: install GC time bandit here, as we want it to
47
+ # be the last one in the log line.
46
48
  app.config.after_initialize do
49
+ TimeBandits.add TimeBandits::TimeConsumers::GarbageCollection.instance if GC.respond_to? :enable_stats
47
50
  TimeBandits.reset
48
51
  end
49
52
 
@@ -1,3 +1,3 @@
1
1
  module TimeBandits
2
- VERSION = "0.12.0"
2
+ VERSION = "0.12.4"
3
3
  end
data/lib/time_bandits.rb CHANGED
@@ -16,7 +16,7 @@ module TimeBandits
16
16
  autoload :Beetle, 'time_bandits/time_consumers/beetle'
17
17
  end
18
18
 
19
- require 'time_bandits/railtie' if defined?(Rails)
19
+ require 'time_bandits/railtie' if defined?(Rails::Railtie)
20
20
  require 'time_bandits/time_consumers/base_consumer'
21
21
 
22
22
  mattr_accessor :time_bandits
@@ -32,11 +32,11 @@ class SequelTest < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def mysql_port
35
- ENV['TRAVIS'] == "true" ? 3306 : 3601
35
+ 3601
36
36
  end
37
37
 
38
38
  def sequel
39
- @sequel ||= Sequel.mysql2(host: "localhost", port: mysql_port, user: "root")
39
+ @sequel ||= Sequel.mysql2(host: "127.0.0.1", port: mysql_port, user: "root")
40
40
  end
41
41
 
42
42
  def metrics
data/time_bandits.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency("byebug")
30
30
  s.add_development_dependency("dalli")
31
31
  s.add_development_dependency("memcached", "~> 1.8.0")
32
- s.add_development_dependency("minitest", "~> 5.5")
32
+ s.add_development_dependency("minitest")
33
33
  s.add_development_dependency("mocha")
34
34
  s.add_development_dependency("mysql2")
35
35
  s.add_development_dependency("rake")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_bandits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2022-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread_variables
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: minitest
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '5.5'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '5.5'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mocha
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -227,18 +227,15 @@ executables: []
227
227
  extensions: []
228
228
  extra_rdoc_files: []
229
229
  files:
230
+ - ".github/workflows/run-tests.yml"
230
231
  - ".gitignore"
231
- - ".travis.yml"
232
232
  - Appraisals
233
233
  - Gemfile
234
+ - LICENSE.txt
234
235
  - README.md
235
236
  - Rakefile
236
237
  - TODO
237
238
  - docker-compose.yml
238
- - gemfiles/activesupport_5.2.4.3.gemfile
239
- - gemfiles/activesupport_5.2.4.3.gemfile.lock
240
- - gemfiles/activesupport_6.0.3.2.gemfile
241
- - gemfiles/activesupport_6.0.3.2.gemfile.lock
242
239
  - lib/time_bandits.rb
243
240
  - lib/time_bandits/monkey_patches/action_controller.rb
244
241
  - lib/time_bandits/monkey_patches/active_record.rb
@@ -291,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
288
  - !ruby/object:Gem::Version
292
289
  version: '0'
293
290
  requirements: []
294
- rubygems_version: 3.1.2
291
+ rubygems_version: 3.2.33
295
292
  signing_key:
296
293
  specification_version: 4
297
294
  summary: Custom performance logging for Rails
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- dist: bionic
2
- language: ruby
3
- rvm:
4
- - 2.5.7
5
- - 2.6.5
6
- - 2.7.0
7
- before_install:
8
- - gem install bundler
9
- script: "bundle exec rake appraisal:test"
10
- services:
11
- - redis-server
12
- - memcached
13
- - rabbitmq
14
- - mysql
15
- addons:
16
- apt:
17
- sources:
18
- - sourceline: "deb https://packages.erlang-solutions.com/ubuntu bionic contrib"
19
- key_url: "https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc"
20
- - sourceline: "deb https://dl.bintray.com/rabbitmq/debian bionic main"
21
- key_url: "https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc"
22
- packages:
23
- - rabbitmq-server
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "5.2.4.3"
6
- gem "activerecord", "5.2.4.3"
7
-
8
- gemspec path: "../"
@@ -1,81 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- time_bandits (0.11.0)
5
- activesupport (>= 5.2.4.3)
6
- thread_variables
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activemodel (5.2.4.3)
12
- activesupport (= 5.2.4.3)
13
- activerecord (5.2.4.3)
14
- activemodel (= 5.2.4.3)
15
- activesupport (= 5.2.4.3)
16
- arel (>= 9.0)
17
- activesupport (5.2.4.3)
18
- concurrent-ruby (~> 1.0, >= 1.0.2)
19
- i18n (>= 0.7, < 2)
20
- minitest (~> 5.1)
21
- tzinfo (~> 1.1)
22
- amq-protocol (2.3.1)
23
- amqp (1.8.0)
24
- amq-protocol (>= 2.2.0)
25
- eventmachine
26
- ansi (1.5.0)
27
- appraisal (2.3.0)
28
- bundler
29
- rake
30
- thor (>= 0.14.0)
31
- arel (9.0.0)
32
- beetle (3.4.1)
33
- activesupport (>= 2.3.4)
34
- amq-protocol (= 2.3.1)
35
- amqp (= 1.8.0)
36
- bunny (~> 0.7.12)
37
- hiredis (>= 0.4.5)
38
- redis (>= 4.2.1)
39
- bunny (0.7.12)
40
- byebug (11.1.3)
41
- concurrent-ruby (1.1.6)
42
- dalli (2.7.10)
43
- eventmachine (1.2.7)
44
- hiredis (0.6.3)
45
- i18n (1.8.3)
46
- concurrent-ruby (~> 1.0)
47
- memcached (1.8.0)
48
- minitest (5.14.1)
49
- mocha (1.11.2)
50
- mysql2 (0.5.3)
51
- rake (13.0.1)
52
- redis (4.2.1)
53
- sequel (5.33.0)
54
- thor (1.0.1)
55
- thread_safe (0.3.6)
56
- thread_variables (0.2.0)
57
- tzinfo (1.2.7)
58
- thread_safe (~> 0.1)
59
-
60
- PLATFORMS
61
- ruby
62
-
63
- DEPENDENCIES
64
- activerecord (= 5.2.4.3)
65
- activesupport (= 5.2.4.3)
66
- ansi
67
- appraisal
68
- beetle (>= 3.4.1)
69
- byebug
70
- dalli
71
- memcached (~> 1.8.0)
72
- minitest (~> 5.5)
73
- mocha
74
- mysql2
75
- rake
76
- redis
77
- sequel
78
- time_bandits!
79
-
80
- BUNDLED WITH
81
- 2.1.4
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "6.0.3.2"
6
- gem "activerecord", "6.0.3.2"
7
-
8
- gemspec path: "../"
@@ -1,81 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- time_bandits (0.11.0)
5
- activesupport (>= 5.2.4.3)
6
- thread_variables
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activemodel (6.0.3.2)
12
- activesupport (= 6.0.3.2)
13
- activerecord (6.0.3.2)
14
- activemodel (= 6.0.3.2)
15
- activesupport (= 6.0.3.2)
16
- activesupport (6.0.3.2)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2, >= 2.2.2)
22
- amq-protocol (2.3.1)
23
- amqp (1.8.0)
24
- amq-protocol (>= 2.2.0)
25
- eventmachine
26
- ansi (1.5.0)
27
- appraisal (2.3.0)
28
- bundler
29
- rake
30
- thor (>= 0.14.0)
31
- beetle (3.4.1)
32
- activesupport (>= 2.3.4)
33
- amq-protocol (= 2.3.1)
34
- amqp (= 1.8.0)
35
- bunny (~> 0.7.12)
36
- hiredis (>= 0.4.5)
37
- redis (>= 4.2.1)
38
- bunny (0.7.12)
39
- byebug (11.1.3)
40
- concurrent-ruby (1.1.6)
41
- dalli (2.7.10)
42
- eventmachine (1.2.7)
43
- hiredis (0.6.3)
44
- i18n (1.8.3)
45
- concurrent-ruby (~> 1.0)
46
- memcached (1.8.0)
47
- minitest (5.14.1)
48
- mocha (1.11.2)
49
- mysql2 (0.5.3)
50
- rake (13.0.1)
51
- redis (4.2.1)
52
- sequel (5.33.0)
53
- thor (1.0.1)
54
- thread_safe (0.3.6)
55
- thread_variables (0.2.0)
56
- tzinfo (1.2.7)
57
- thread_safe (~> 0.1)
58
- zeitwerk (2.3.0)
59
-
60
- PLATFORMS
61
- ruby
62
-
63
- DEPENDENCIES
64
- activerecord (= 6.0.3.2)
65
- activesupport (= 6.0.3.2)
66
- ansi
67
- appraisal
68
- beetle (>= 3.4.1)
69
- byebug
70
- dalli
71
- memcached (~> 1.8.0)
72
- minitest (~> 5.5)
73
- mocha
74
- mysql2
75
- rake
76
- redis
77
- sequel
78
- time_bandits!
79
-
80
- BUNDLED WITH
81
- 2.1.4