time_bandits 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -4
  3. data/Appraisals +2 -16
  4. data/README.md +11 -6
  5. data/Rakefile +1 -0
  6. data/docker-compose.yml +4 -4
  7. data/gemfiles/{activesupport_5.0.4.gemfile → activesupport_5.2.4.3.gemfile} +2 -2
  8. data/gemfiles/{activesupport_5.2.3.gemfile.lock → activesupport_5.2.4.3.gemfile.lock} +29 -31
  9. data/gemfiles/{activesupport_4.2.9.gemfile → activesupport_6.0.3.2.gemfile} +2 -2
  10. data/gemfiles/{activesupport_5.1.7.gemfile.lock → activesupport_6.0.3.2.gemfile.lock} +31 -33
  11. data/lib/time_bandits.rb +2 -6
  12. data/lib/time_bandits/monkey_patches/action_controller.rb +1 -66
  13. data/lib/time_bandits/monkey_patches/active_record.rb +18 -116
  14. data/lib/time_bandits/rack/logger.rb +46 -19
  15. data/lib/time_bandits/railtie.rb +2 -6
  16. data/lib/time_bandits/time_consumers/dalli.rb +0 -12
  17. data/lib/time_bandits/time_consumers/garbage_collection.rb +5 -29
  18. data/lib/time_bandits/version.rb +1 -1
  19. data/test/test_helper.rb +2 -10
  20. data/test/unit/gc_consumer_test.rb +2 -3
  21. data/test/unit/sequel_test.rb +5 -1
  22. data/time_bandits.gemspec +6 -3
  23. metadata +20 -46
  24. data/gemfiles/activesupport_4.1.16.gemfile +0 -8
  25. data/gemfiles/activesupport_4.1.16.gemfile.lock +0 -91
  26. data/gemfiles/activesupport_4.2.8.gemfile +0 -8
  27. data/gemfiles/activesupport_4.2.8.gemfile.lock +0 -85
  28. data/gemfiles/activesupport_4.2.9.gemfile.lock +0 -85
  29. data/gemfiles/activesupport_5.0.3.gemfile +0 -8
  30. data/gemfiles/activesupport_5.0.3.gemfile.lock +0 -83
  31. data/gemfiles/activesupport_5.0.4.gemfile.lock +0 -83
  32. data/gemfiles/activesupport_5.0.7.2.gemfile +0 -8
  33. data/gemfiles/activesupport_5.0.7.2.gemfile.lock +0 -83
  34. data/gemfiles/activesupport_5.0.7.gemfile +0 -8
  35. data/gemfiles/activesupport_5.0.7.gemfile.lock +0 -83
  36. data/gemfiles/activesupport_5.1.1.gemfile +0 -8
  37. data/gemfiles/activesupport_5.1.1.gemfile.lock +0 -83
  38. data/gemfiles/activesupport_5.1.2.gemfile +0 -8
  39. data/gemfiles/activesupport_5.1.2.gemfile.lock +0 -83
  40. data/gemfiles/activesupport_5.1.5.gemfile +0 -8
  41. data/gemfiles/activesupport_5.1.5.gemfile.lock +0 -83
  42. data/gemfiles/activesupport_5.1.7.gemfile +0 -8
  43. data/gemfiles/activesupport_5.2.0.gemfile +0 -8
  44. data/gemfiles/activesupport_5.2.0.gemfile.lock +0 -83
  45. data/gemfiles/activesupport_5.2.3.gemfile +0 -8
  46. data/gemfiles/activesupport_6.0.0.gemfile +0 -8
  47. data/gemfiles/activesupport_6.0.0.gemfile.lock +0 -83
  48. data/lib/time_bandits/monkey_patches/active_support_cache_store.rb +0 -18
  49. data/lib/time_bandits/rack/logger40.rb +0 -94
  50. data/rails/init.rb +0 -1
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "5.1.5"
6
- gem "activerecord", "5.1.5"
7
-
8
- gemspec path: "../"
@@ -1,83 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- time_bandits (0.10.12)
5
- activesupport (>= 2.3.2)
6
- thread_variables
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activemodel (5.1.5)
12
- activesupport (= 5.1.5)
13
- activerecord (5.1.5)
14
- activemodel (= 5.1.5)
15
- activesupport (= 5.1.5)
16
- arel (~> 8.0)
17
- activesupport (5.1.5)
18
- concurrent-ruby (~> 1.0, >= 1.0.2)
19
- i18n (~> 0.7)
20
- minitest (~> 5.1)
21
- tzinfo (~> 1.1)
22
- amq-protocol (2.3.0)
23
- amqp (1.8.0)
24
- amq-protocol (>= 2.2.0)
25
- eventmachine
26
- ansi (1.5.0)
27
- appraisal (2.2.0)
28
- bundler
29
- rake
30
- thor (>= 0.14.0)
31
- arel (8.0.0)
32
- beetle (3.3.1)
33
- activesupport (>= 2.3.4)
34
- amq-protocol (= 2.3.0)
35
- amqp (= 1.8.0)
36
- bunny (~> 0.7.12)
37
- hiredis (>= 0.4.5)
38
- redis (>= 2.2.2)
39
- bunny (0.7.12)
40
- byebug (11.0.1)
41
- concurrent-ruby (1.1.5)
42
- dalli (2.7.10)
43
- eventmachine (1.2.7)
44
- hiredis (0.6.3)
45
- i18n (0.9.5)
46
- concurrent-ruby (~> 1.0)
47
- memcached (1.8.0)
48
- metaclass (0.0.4)
49
- minitest (5.11.3)
50
- mocha (1.9.0)
51
- metaclass (~> 0.0.1)
52
- mysql2 (0.5.2)
53
- rake (10.5.0)
54
- redis (4.1.2)
55
- sequel (5.23.0)
56
- thor (0.20.3)
57
- thread_safe (0.3.6)
58
- thread_variables (0.2.0)
59
- tzinfo (1.2.5)
60
- thread_safe (~> 0.1)
61
-
62
- PLATFORMS
63
- ruby
64
-
65
- DEPENDENCIES
66
- activerecord (= 5.1.5)
67
- activesupport (= 5.1.5)
68
- ansi
69
- appraisal
70
- beetle (>= 0.4.6)
71
- byebug
72
- dalli
73
- memcached (~> 1.8.0)
74
- minitest (~> 5.5)
75
- mocha
76
- mysql2
77
- rake (~> 10.5.0)
78
- redis
79
- sequel
80
- time_bandits!
81
-
82
- BUNDLED WITH
83
- 1.17.3
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "5.1.7"
6
- gem "activerecord", "5.1.7"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "5.2.0"
6
- gem "activerecord", "5.2.0"
7
-
8
- gemspec path: "../"
@@ -1,83 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- time_bandits (0.10.12)
5
- activesupport (>= 2.3.2)
6
- thread_variables
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activemodel (5.2.0)
12
- activesupport (= 5.2.0)
13
- activerecord (5.2.0)
14
- activemodel (= 5.2.0)
15
- activesupport (= 5.2.0)
16
- arel (>= 9.0)
17
- activesupport (5.2.0)
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.0)
23
- amqp (1.8.0)
24
- amq-protocol (>= 2.2.0)
25
- eventmachine
26
- ansi (1.5.0)
27
- appraisal (2.2.0)
28
- bundler
29
- rake
30
- thor (>= 0.14.0)
31
- arel (9.0.0)
32
- beetle (3.3.1)
33
- activesupport (>= 2.3.4)
34
- amq-protocol (= 2.3.0)
35
- amqp (= 1.8.0)
36
- bunny (~> 0.7.12)
37
- hiredis (>= 0.4.5)
38
- redis (>= 2.2.2)
39
- bunny (0.7.12)
40
- byebug (11.0.1)
41
- concurrent-ruby (1.1.5)
42
- dalli (2.7.10)
43
- eventmachine (1.2.7)
44
- hiredis (0.6.3)
45
- i18n (1.6.0)
46
- concurrent-ruby (~> 1.0)
47
- memcached (1.8.0)
48
- metaclass (0.0.4)
49
- minitest (5.11.3)
50
- mocha (1.9.0)
51
- metaclass (~> 0.0.1)
52
- mysql2 (0.5.2)
53
- rake (10.5.0)
54
- redis (4.1.2)
55
- sequel (5.23.0)
56
- thor (0.20.3)
57
- thread_safe (0.3.6)
58
- thread_variables (0.2.0)
59
- tzinfo (1.2.5)
60
- thread_safe (~> 0.1)
61
-
62
- PLATFORMS
63
- ruby
64
-
65
- DEPENDENCIES
66
- activerecord (= 5.2.0)
67
- activesupport (= 5.2.0)
68
- ansi
69
- appraisal
70
- beetle (>= 0.4.6)
71
- byebug
72
- dalli
73
- memcached (~> 1.8.0)
74
- minitest (~> 5.5)
75
- mocha
76
- mysql2
77
- rake (~> 10.5.0)
78
- redis
79
- sequel
80
- time_bandits!
81
-
82
- BUNDLED WITH
83
- 1.17.3
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "5.2.3"
6
- gem "activerecord", "5.2.3"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activesupport", "6.0.0"
6
- gem "activerecord", "6.0.0"
7
-
8
- gemspec path: "../"
@@ -1,83 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- time_bandits (0.10.12)
5
- activesupport (>= 2.3.2)
6
- thread_variables
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activemodel (6.0.0)
12
- activesupport (= 6.0.0)
13
- activerecord (6.0.0)
14
- activemodel (= 6.0.0)
15
- activesupport (= 6.0.0)
16
- activesupport (6.0.0)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.1, >= 2.1.8)
22
- amq-protocol (2.3.0)
23
- amqp (1.8.0)
24
- amq-protocol (>= 2.2.0)
25
- eventmachine
26
- ansi (1.5.0)
27
- appraisal (2.2.0)
28
- bundler
29
- rake
30
- thor (>= 0.14.0)
31
- beetle (3.3.1)
32
- activesupport (>= 2.3.4)
33
- amq-protocol (= 2.3.0)
34
- amqp (= 1.8.0)
35
- bunny (~> 0.7.12)
36
- hiredis (>= 0.4.5)
37
- redis (>= 2.2.2)
38
- bunny (0.7.12)
39
- byebug (11.0.1)
40
- concurrent-ruby (1.1.5)
41
- dalli (2.7.10)
42
- eventmachine (1.2.7)
43
- hiredis (0.6.3)
44
- i18n (1.6.0)
45
- concurrent-ruby (~> 1.0)
46
- memcached (1.8.0)
47
- metaclass (0.0.4)
48
- minitest (5.11.3)
49
- mocha (1.9.0)
50
- metaclass (~> 0.0.1)
51
- mysql2 (0.5.2)
52
- rake (10.5.0)
53
- redis (4.1.2)
54
- sequel (5.23.0)
55
- thor (0.20.3)
56
- thread_safe (0.3.6)
57
- thread_variables (0.2.0)
58
- tzinfo (1.2.5)
59
- thread_safe (~> 0.1)
60
- zeitwerk (2.1.9)
61
-
62
- PLATFORMS
63
- ruby
64
-
65
- DEPENDENCIES
66
- activerecord (= 6.0.0)
67
- activesupport (= 6.0.0)
68
- ansi
69
- appraisal
70
- beetle (>= 0.4.6)
71
- byebug
72
- dalli
73
- memcached (~> 1.8.0)
74
- minitest (~> 5.5)
75
- mocha
76
- mysql2
77
- rake (~> 10.5.0)
78
- redis
79
- sequel
80
- time_bandits!
81
-
82
- BUNDLED WITH
83
- 1.17.3
@@ -1,18 +0,0 @@
1
- require "active_support/cache"
2
-
3
- # Rails 4 builtin mem_cache_store broke hit reporting for fetch.
4
- # This has been fixed in Rails 5.
5
- # The dalli time consumer makes sure to require this file only for Rails 4.
6
-
7
- class ActiveSupport::Cache::Store
8
- private
9
- # only called by fetch
10
- def find_cached_entry(key, name, options)
11
- instrument(:read, name, options) do |payload|
12
- payload[:super_operation] = :fetch if payload
13
- res = read_entry(key, options)
14
- payload[:hit] = !!res if payload
15
- res
16
- end
17
- end
18
- end
@@ -1,94 +0,0 @@
1
- require 'active_support/core_ext/time/conversions'
2
- require 'active_support/core_ext/object/blank'
3
- require 'active_support/log_subscriber'
4
- require 'action_dispatch/http/request'
5
- require 'rack/body_proxy'
6
-
7
- module TimeBandits
8
- module Rack
9
- # Sets log tags, logs the request, calls the app, and flushes the logs.
10
- class Logger < ActiveSupport::LogSubscriber
11
- def initialize(app, taggers = nil)
12
- @app = app
13
- @taggers = taggers || Rails.application.config.log_tags || []
14
- @instrumenter = ActiveSupport::Notifications.instrumenter
15
- end
16
-
17
- def call(env)
18
- request = ActionDispatch::Request.new(env)
19
-
20
- if logger.respond_to?(:tagged) && !@taggers.empty?
21
- logger.tagged(compute_tags(request)) { call_app(request, env) }
22
- else
23
- call_app(request, env)
24
- end
25
- end
26
-
27
- protected
28
-
29
- def call_app(request, env)
30
- start_time = Time.now
31
- start(request, start_time)
32
- resp = @app.call(env)
33
- resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
34
- resp
35
- rescue
36
- finish(request)
37
- raise
38
- ensure
39
- completed(request, (Time.now - start_time) * 1000, resp)
40
- ActiveSupport::LogSubscriber.flush_all!
41
- end
42
-
43
- # Started GET "/session/new" for 127.0.0.1 at 2012-09-26 14:51:42 -0700
44
- def started_request_message(request, start_time=Time.now)
45
- 'Started %s "%s" for %s at %s' % [
46
- request.request_method,
47
- request.filtered_path,
48
- request.ip,
49
- start_time.to_default_s ]
50
- end
51
-
52
- def compute_tags(request)
53
- @taggers.collect do |tag|
54
- case tag
55
- when Proc
56
- tag.call(request)
57
- when Symbol
58
- request.send(tag)
59
- else
60
- tag
61
- end
62
- end
63
- end
64
-
65
- private
66
-
67
- def start(request, start_time)
68
- TimeBandits.reset
69
- Thread.current.thread_variable_set(:time_bandits_completed_info, nil)
70
- @instrumenter.start 'action_dispatch.request', request: request
71
-
72
- logger.debug ""
73
- logger.info started_request_message(request, start_time)
74
- end
75
-
76
- def completed(request, run_time, resp)
77
- status = resp ? resp.first.to_i : 500
78
- completed_info = Thread.current.thread_variable_get(:time_bandits_completed_info)
79
- additions = completed_info[1] if completed_info
80
- message = "Completed #{status} #{::Rack::Utils::HTTP_STATUS_CODES[status]} in %.1fms" % run_time
81
- message << " (#{additions.join(' | ')})" unless additions.blank?
82
- logger.info message
83
- end
84
-
85
- def finish(request)
86
- @instrumenter.finish 'action_dispatch.request', request: request
87
- end
88
-
89
- def logger
90
- @logger ||= Rails.logger
91
- end
92
- end
93
- end
94
- end
@@ -1 +0,0 @@
1
- require File.expand_path('../../init.rb', __FILE__)