time_bandits 0.10.11 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -4
- data/Appraisals +2 -10
- data/LICENSE.txt +20 -0
- data/README.md +25 -27
- data/Rakefile +1 -0
- data/docker-compose.yml +4 -4
- data/gemfiles/activesupport_5.2.4.3.gemfile +8 -0
- data/gemfiles/activesupport_5.2.4.3.gemfile.lock +81 -0
- data/gemfiles/activesupport_6.0.3.2.gemfile +8 -0
- data/gemfiles/activesupport_6.0.3.2.gemfile.lock +81 -0
- data/lib/time_bandits.rb +2 -6
- data/lib/time_bandits/monkey_patches/action_controller.rb +0 -79
- data/lib/time_bandits/monkey_patches/active_record.rb +18 -98
- data/lib/time_bandits/rack/logger.rb +46 -19
- data/lib/time_bandits/railtie.rb +6 -8
- data/lib/time_bandits/time_consumers/dalli.rb +0 -12
- data/lib/time_bandits/time_consumers/garbage_collection.rb +5 -29
- data/lib/time_bandits/version.rb +1 -1
- data/test/test_helper.rb +2 -10
- data/test/unit/gc_consumer_test.rb +2 -3
- data/test/unit/sequel_test.rb +5 -1
- data/time_bandits.gemspec +6 -3
- metadata +21 -37
- data/gemfiles/activesupport_4.1.16.gemfile +0 -8
- data/gemfiles/activesupport_4.1.16.gemfile.lock +0 -91
- data/gemfiles/activesupport_4.2.8.gemfile +0 -8
- data/gemfiles/activesupport_4.2.8.gemfile.lock +0 -89
- data/gemfiles/activesupport_4.2.9.gemfile +0 -8
- data/gemfiles/activesupport_4.2.9.gemfile.lock +0 -89
- data/gemfiles/activesupport_5.0.3.gemfile +0 -8
- data/gemfiles/activesupport_5.0.3.gemfile.lock +0 -88
- data/gemfiles/activesupport_5.0.4.gemfile +0 -8
- data/gemfiles/activesupport_5.0.4.gemfile.lock +0 -88
- data/gemfiles/activesupport_5.1.1.gemfile +0 -8
- data/gemfiles/activesupport_5.1.1.gemfile.lock +0 -88
- data/gemfiles/activesupport_5.1.2.gemfile +0 -8
- data/gemfiles/activesupport_5.1.2.gemfile.lock +0 -88
- data/gemfiles/activesupport_5.1.5.gemfile +0 -8
- data/gemfiles/activesupport_5.1.5.gemfile.lock +0 -85
- data/gemfiles/activesupport_5.2.0.gemfile +0 -8
- data/gemfiles/activesupport_5.2.0.gemfile.lock +0 -85
- data/lib/time_bandits/monkey_patches/active_support_cache_store.rb +0 -18
- data/lib/time_bandits/rack/logger40.rb +0 -94
- data/rails/init.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b13f621d06b0868cde0ad832603e9a924f4d40ad03a63ded4d98f13e6d5feccd
|
4
|
+
data.tar.gz: 674bfa4c6564f06ee6946d54290e38e0bfe05c2af4acced51f0aac1f8fc182ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a86246746fc6a6465e8b4a4ac1a87001ec815b4bfaa2dae2107edc7e21dc8440a22a5a33625b5dd908ecf408d7c060bc02828b00080f4f209de8b962ad39ae0d
|
7
|
+
data.tar.gz: 046dab1c28efe9c237a87eb7bfc25c1867cd1632c8f2c9b27ff06191845a46f90cea496289466ce5e36e45da195238fe5e3348025b3cf511200d20479267a8d8
|
data/.travis.yml
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
+
dist: bionic
|
1
2
|
language: ruby
|
2
3
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
4
|
+
- 2.5.7
|
5
|
+
- 2.6.5
|
6
|
+
- 2.7.0
|
7
|
+
before_install:
|
8
|
+
- gem install bundler
|
6
9
|
script: "bundle exec rake appraisal:test"
|
7
|
-
sudo: false
|
8
10
|
services:
|
9
11
|
- redis-server
|
10
12
|
- memcached
|
11
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
|
data/Appraisals
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
[
|
2
|
-
"4.
|
3
|
-
"
|
4
|
-
"4.2.9",
|
5
|
-
"5.0.3",
|
6
|
-
"5.0.4",
|
7
|
-
"5.1.1",
|
8
|
-
"5.1.2",
|
9
|
-
"5.1.5",
|
10
|
-
"5.2.0",
|
2
|
+
"5.2.4.3",
|
3
|
+
"6.0.3.2"
|
11
4
|
].each do |rails_version|
|
12
|
-
next if RUBY_VERSION >= "2.4.0" && rails_version < "4.2.8"
|
13
5
|
appraise "activesupport-#{rails_version}" do
|
14
6
|
gem "activesupport", rails_version
|
15
7
|
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,8 @@
|
|
4
4
|
|
5
5
|
Time Bandits is a gem plugin for Rails which enhances Rails' controller/view/db benchmark logging.
|
6
6
|
|
7
|
+
[![Travis](https://travis-ci.org/skaes/time_bandits.svg?branch=master)](https://travis-ci.org/github/skaes/time_bandits)
|
8
|
+
|
7
9
|
## Usage
|
8
10
|
|
9
11
|
Without configuration, the standard Rails 'Completed line' will change
|
@@ -53,16 +55,16 @@ With these two new time consumers, the log line changes to
|
|
53
55
|
b: number of bytes allocated by the ruby x_malloc call (#bytes)
|
54
56
|
l: live data set size after last GC (#slots)
|
55
57
|
|
56
|
-
|
58
|
+
Side note for speakers of German: you can use the word "Gesabbel" (eng: drivel) as a mnemonic here ;-)
|
57
59
|
|
58
|
-
It's
|
60
|
+
It's relatively straightforward to write additional time consumers; the more difficult part of this is
|
59
61
|
monkey patching the code which you want to instrument. Have a look at consumers under
|
60
|
-
lib/time_bandits/time_consumers and the corresponding patches under lib/time_bandits/monkey_patches
|
62
|
+
`lib/time_bandits/time_consumers` and the corresponding patches under `lib/time_bandits/monkey_patches`.
|
61
63
|
|
62
64
|
|
63
65
|
## Prerequisites
|
64
66
|
|
65
|
-
Rails >=
|
67
|
+
ActiveSupport/Rails >= 5.2 is required. The gem will raise an error if you try to use it with an incompatible
|
66
68
|
version.
|
67
69
|
|
68
70
|
You'll need a ruby with the railsexpress GC patches applied, if you want to include GC and heap size
|
@@ -80,10 +82,28 @@ changed so much of the code that is is practically a full rewrite, hence we chan
|
|
80
82
|
|
81
83
|
## Running Tests
|
82
84
|
|
83
|
-
|
85
|
+
Run `docker-compose up` to start Redis, MySQL, RabbitMQ and Memached containers, then run `rake`.
|
86
|
+
|
84
87
|
|
85
88
|
## Release Notes
|
86
89
|
|
90
|
+
## Version 0.12.2
|
91
|
+
- fixed that completed line was logged twice in Rails test environment
|
92
|
+
|
93
|
+
## Version 0.12.1
|
94
|
+
- support having the rails gem in a bundle without activating the time bandits railtie
|
95
|
+
- automatically install the garbage collection time bandit in rails applications
|
96
|
+
|
97
|
+
## Version 0.12.0
|
98
|
+
- drops support for Rails versions before 5.2.0 and Ruby versions before 2.2.0
|
99
|
+
- makes it possible to use individual time bandits without Rails (e.g. in a Sinatra app)
|
100
|
+
|
101
|
+
## Version 0.11.0
|
102
|
+
- supports rails 6.0.0
|
103
|
+
|
104
|
+
## Version 0.10.12
|
105
|
+
- supports rails 5.0.7
|
106
|
+
|
87
107
|
## Version 0.10.11
|
88
108
|
- support rails 5.2.0
|
89
109
|
|
@@ -170,26 +190,4 @@ In order for the test to run you need a running memcached, redis-server and mysq
|
|
170
190
|
- times are all measured in milliseconds internally
|
171
191
|
- added class TimeBandits::TimeConsumers::BaseConsumer to simplify writing custom consumers
|
172
192
|
|
173
|
-
## License
|
174
|
-
|
175
|
-
Copyright (c) 2009-2014 Stefan Kaes <skaes@railsexpress.de>
|
176
|
-
|
177
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
178
|
-
a copy of this software and associated documentation files (the
|
179
|
-
"Software"), to deal in the Software without restriction, including
|
180
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
181
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
182
|
-
permit persons to whom the Software is furnished to do so, subject to
|
183
|
-
the following conditions:
|
184
|
-
|
185
|
-
The above copyright notice and this permission notice shall be
|
186
|
-
included in all copies or substantial portions of the Software.
|
187
|
-
|
188
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
189
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
190
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
191
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
192
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
193
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
194
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
195
193
|
|
data/Rakefile
CHANGED
data/docker-compose.yml
CHANGED
@@ -3,7 +3,7 @@ version: '2'
|
|
3
3
|
services:
|
4
4
|
mysql:
|
5
5
|
container_name: mysql
|
6
|
-
image: mysql:5.
|
6
|
+
image: mysql:5.7
|
7
7
|
ports:
|
8
8
|
- "3601:3306"
|
9
9
|
environment:
|
@@ -11,18 +11,18 @@ services:
|
|
11
11
|
|
12
12
|
memcached:
|
13
13
|
container_name: memcached
|
14
|
-
image: memcached:1.
|
14
|
+
image: memcached:1.6.6
|
15
15
|
ports:
|
16
16
|
- "11211:11211"
|
17
17
|
|
18
18
|
redis:
|
19
19
|
container_name: redis
|
20
|
-
image: redis:
|
20
|
+
image: redis:5.0.9
|
21
21
|
ports:
|
22
22
|
- "6379:6379"
|
23
23
|
|
24
24
|
rabbitmq:
|
25
25
|
container_name: rabbitmq
|
26
|
-
image: rabbitmq:3.
|
26
|
+
image: rabbitmq:3.8.5
|
27
27
|
ports:
|
28
28
|
- "5672:5672"
|
@@ -0,0 +1,81 @@
|
|
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
|
@@ -0,0 +1,81 @@
|
|
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
|
data/lib/time_bandits.rb
CHANGED
@@ -5,11 +5,7 @@ require 'thread_variables'
|
|
5
5
|
module TimeBandits
|
6
6
|
|
7
7
|
module TimeConsumers
|
8
|
-
|
9
|
-
autoload :Database, 'time_bandits/time_consumers/database_rails2'
|
10
|
-
else
|
11
|
-
autoload :Database, 'time_bandits/time_consumers/database'
|
12
|
-
end
|
8
|
+
autoload :Database, 'time_bandits/time_consumers/database'
|
13
9
|
autoload :GarbageCollection, 'time_bandits/time_consumers/garbage_collection'
|
14
10
|
autoload :JMX, 'time_bandits/time_consumers/jmx'
|
15
11
|
autoload :MemCache, 'time_bandits/time_consumers/mem_cache'
|
@@ -20,7 +16,7 @@ module TimeBandits
|
|
20
16
|
autoload :Beetle, 'time_bandits/time_consumers/beetle'
|
21
17
|
end
|
22
18
|
|
23
|
-
require 'time_bandits/railtie' if defined?(Rails)
|
19
|
+
require 'time_bandits/railtie' if defined?(Rails::Railtie)
|
24
20
|
require 'time_bandits/time_consumers/base_consumer'
|
25
21
|
|
26
22
|
mattr_accessor :time_bandits
|
@@ -4,45 +4,6 @@ module ActionController #:nodoc:
|
|
4
4
|
|
5
5
|
module Instrumentation
|
6
6
|
|
7
|
-
# patch to ensure that the completed line is always written to the log.
|
8
|
-
# this is not necessary anymore with Rails 4 and higher.
|
9
|
-
def process_action(action, *args)
|
10
|
-
raw_payload = get_raw_payload
|
11
|
-
ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup)
|
12
|
-
|
13
|
-
exception = nil
|
14
|
-
result = ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
|
15
|
-
begin
|
16
|
-
super
|
17
|
-
rescue Exception => exception
|
18
|
-
response.status = 500
|
19
|
-
nil
|
20
|
-
ensure
|
21
|
-
payload[:status] = response.status
|
22
|
-
append_info_to_payload(payload)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
raise exception if exception
|
26
|
-
result
|
27
|
-
end unless Rails::VERSION::STRING >= "4.0"
|
28
|
-
|
29
|
-
# patch to ensure that render times are always recorded in the log.
|
30
|
-
# this is not necessary anymore with Rails 3 and up.
|
31
|
-
def render(*args)
|
32
|
-
render_output = nil
|
33
|
-
exception = nil
|
34
|
-
self.view_runtime = cleanup_view_runtime do
|
35
|
-
Benchmark.ms do
|
36
|
-
begin
|
37
|
-
render_output = super
|
38
|
-
rescue Exception => exception
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
raise exception if exception
|
43
|
-
render_output
|
44
|
-
end unless Rails::VERSION::STRING >= "3.0"
|
45
|
-
|
46
7
|
def cleanup_view_runtime #:nodoc:
|
47
8
|
consumed_before_rendering = TimeBandits.consumed
|
48
9
|
runtime = yield
|
@@ -52,32 +13,6 @@ module ActionController #:nodoc:
|
|
52
13
|
|
53
14
|
private
|
54
15
|
|
55
|
-
if Rails::VERSION::STRING =~ /\A3\.[01]/
|
56
|
-
def get_raw_payload
|
57
|
-
{
|
58
|
-
:controller => self.class.name,
|
59
|
-
:action => self.action_name,
|
60
|
-
:params => request.filtered_parameters,
|
61
|
-
:formats => request.formats.map(&:to_sym),
|
62
|
-
:method => request.method,
|
63
|
-
:path => (request.fullpath rescue "unknown")
|
64
|
-
}
|
65
|
-
end
|
66
|
-
elsif Rails::VERSION::STRING =~ /\A3\.2/
|
67
|
-
def get_raw_payload
|
68
|
-
{
|
69
|
-
:controller => self.class.name,
|
70
|
-
:action => self.action_name,
|
71
|
-
:params => request.filtered_parameters,
|
72
|
-
:format => request.format.try(:ref),
|
73
|
-
:method => request.method,
|
74
|
-
:path => (request.fullpath rescue "unknown")
|
75
|
-
}
|
76
|
-
end
|
77
|
-
elsif Rails::VERSION::STRING < "3"
|
78
|
-
raise "time_bandits ActionController monkey patch is not compatible with your Rails version"
|
79
|
-
end
|
80
|
-
|
81
16
|
module ClassMethods
|
82
17
|
# patch to log rendering time with more precision
|
83
18
|
def log_process_action(payload) #:nodoc:
|
@@ -101,20 +36,6 @@ module ActionController #:nodoc:
|
|
101
36
|
:time_bandits_completed_info,
|
102
37
|
[ event.duration, additions, payload[:view_runtime], "#{payload[:controller]}##{payload[:action]}" ]
|
103
38
|
)
|
104
|
-
|
105
|
-
# this is an ugly hack to ensure completed lines show up in the test logs
|
106
|
-
# TODO: move this code to some other place
|
107
|
-
return unless Rails.env.test? && Rails::VERSION::STRING >= "3.2"
|
108
|
-
|
109
|
-
status = payload[:status]
|
110
|
-
if status.nil? && payload[:exception].present?
|
111
|
-
exception_class_name = payload[:exception].first
|
112
|
-
status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
|
113
|
-
end
|
114
|
-
message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in %.1fms" % event.duration
|
115
|
-
message << " (#{additions.join(" | ")})" unless additions.blank?
|
116
|
-
|
117
|
-
info(message)
|
118
39
|
end
|
119
40
|
end
|
120
41
|
|