time_bandits 0.12.5 → 0.12.6

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: be90aa917ea9d4256501dc921da7fea5c9f1c9608f89fc7e5e5dace634b0353f
4
- data.tar.gz: 29d87ff61dfa62a3202434df9d687ae9dc8e9d5e6e4b9e0ef4709049b7abee51
3
+ metadata.gz: 9bb0e53a2ec6be050ceb69100a522491c7c9aada6ab0571143702cdcb791c952
4
+ data.tar.gz: ad9782ffb7fefd0080059322c79bf9fee94fb604dad425d781d533149cfa99be
5
5
  SHA512:
6
- metadata.gz: e6692b8d8d10889442cc67f583fb6b98535f6a7ab3b060698c9dfef256f933bb976670dd1e672ba16a63d085d5238ade7704e7c1e9240ffc3da67d60e9a33435
7
- data.tar.gz: b98ab1c3669dd66162199ad6a78bf113a598b8836a0a793404fa1dd28248fc43751ad32439ae03b3732a16f7476ad2109cacdc2c9cc7b57eec24ecb07475c460
6
+ metadata.gz: 41bfddd9121b5c1bd645135b4a83fcd9172039b6fd8f119e46ae37cea60c032fac9be880ecfa2c6e085254384d033e0e1d16eb7953730301a72342ab1caf23c5
7
+ data.tar.gz: b432bb568909ed75a43e7a8b84b78cdacd7557529e06a43e3e47c221860dae00a87bb88250a878eaa2846c233db3fa58b2cef926be6d0a2fd3153213cf22eba4
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- ruby-version: [3.1.0, 3.0.3, 2.7.5, 2.6.9]
16
+ ruby-version: [3.1.2, 3.0.4, 2.7.6]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
data/Appraisals CHANGED
@@ -1,10 +1,10 @@
1
1
  appraisals = [
2
- "6.0.4.4",
3
- "6.1.4.4",
2
+ "6.0.4.7",
3
+ "6.1.5",
4
4
  ]
5
5
 
6
6
  appraisals.insert(0, "5.2.6") if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
7
- appraisals << "7.0.1" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
7
+ appraisals << "7.0.2.3" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
8
8
 
9
9
  appraisals.each do |rails_version|
10
10
  appraise "activesupport-#{rails_version}" do
data/CHANGELOG.md ADDED
@@ -0,0 +1,318 @@
1
+ # CHANGELOG
2
+
3
+ ## Version 0.12.6
4
+ * use ruby 3.1.1 in GitHub actions
5
+ * updated appraisals
6
+ * restrict Redis gem to a version before 5.0 until 5.x has become
7
+ stable
8
+ * use monotonic clocks for time measurements
9
+
10
+ ## Version 0.12.5
11
+ * use GC.stat(:malloc_increase_bytes) to measure allocated bytes as fallback
12
+ * support ruby 3.1.0 GC.total_time
13
+ * ruby 3.1.0 needs rails 7.0.1 to run the tests
14
+ * include ruby-3.1.0 on GitHub actions
15
+
16
+ ## Version 0.12.4
17
+ * rails 7.0.0 compatibility
18
+ * only test Rails 3.0.0 with Ruby >= 2.7.0
19
+ * updated Appraisals
20
+ * use safe ruby version to run tests on GitHub
21
+ * switched to GitHub actions (#19)
22
+ * try to fix travis
23
+ * updated appraisals
24
+ * remove gemfiles created by appraisals and git ignore them
25
+
26
+ ## Version 0.12.3
27
+ * relax minitest dependency
28
+ * suppress Ruby 2.7 warnings in action controller tests
29
+ * updated test container versions
30
+
31
+ ## Version 0.12.2
32
+ * fixed that completed line was logged twice in Rails test environment
33
+ * split license into separate file
34
+ * added travis badge
35
+
36
+ ## Version 0.12.1
37
+ * install GC time bandit automatically inRails applications
38
+ * only load railtie if class Rails::Railtie is defined
39
+
40
+ ## Version 0.12.0
41
+ * removed leftover from old Rails plugin times
42
+ * don't need sudo on travis
43
+ * Merge pull request #15 from toy/patch-1
44
+ * try to fix travis build
45
+ * doc rephrasing
46
+ * updated README
47
+ * relax active support version requirement to 5.2.0
48
+ * updated travis build matrix
49
+ * dropped support for old rails and ruby versions
50
+ * silence ruby warnings
51
+ * updated docker images
52
+ * require at least version 5.2.4.3 for activesupport
53
+ * updated appraisals to only test supported Rails versions
54
+ * damn travis
55
+ * travis fu
56
+ * updated ruby versions
57
+ * trying to fix travis
58
+
59
+ ## Version 0.11.0
60
+ * added and updated appraisals
61
+ * support rails 6
62
+ * Add changelog url to gemspec
63
+
64
+ ## Version 0.10.12
65
+ * updated README
66
+ * also support future 5.0.x versions
67
+ * added appraisal for rails 5.0.7
68
+ * Merge pull request #14 from mediafinger/master
69
+ * Call type_casted_binds with only one argument in Rails 5.0.7
70
+
71
+ ## Version 0.10.11
72
+ * prepare 0.10.11 release
73
+ * clarified how TimeBanditry gets activated in railtie
74
+ * test rails 5.2.0 compatibility
75
+ * Merge pull request #13 from sghosh23/update_rails_version_active_record_monkey_patch
76
+ * add rails version 5.2 to support active record monkey patch
77
+ * fix test failures on ActiveRecord 4.1.16
78
+ * reinstalled appraisals
79
+ * try to fix travis builds
80
+
81
+ ## Version 0.10.10
82
+ * make sure sql method can be executed on logsubscriber
83
+ * updated appraisals
84
+
85
+ ## Version 0.10.8
86
+ * added specialized activerecord logging for Rails >= 5.1.5
87
+
88
+ ## Version 0.10.8
89
+ * rails has changed render_bind in 5.0.3
90
+ * updated README
91
+ * added rabbitmq as a service for travis
92
+ * added more rails versions to test against
93
+ * abort rake task when system calls fail
94
+ * fixed deprecation warning for ruby 2.4.1
95
+
96
+ ## Version 0.10.7
97
+ * changed README format to markdown
98
+ * Merge pull request #11 from manveru/patch-1
99
+ * Adapt log_sql_statement for Rails 5.1
100
+ * changed travis command
101
+
102
+ ## Version 0.10.6
103
+ * updated reales notes
104
+ * Merge pull request #9 from pinglamb/master
105
+ * added .travis.yml
106
+ * updated rails versions for appraisals
107
+
108
+ ## Version 0.10.5
109
+ * make activerecord monkey patch available for rails 5.1
110
+
111
+ ## Version 0.10.4
112
+ * protect against Rails 5 firing on_load handlers multiple times
113
+
114
+ ## Version 0.10.3
115
+ * fixed activerecord logging monkey patch
116
+
117
+ ## Version 0.10.2
118
+ * go back to using alias_method to enable testing with rspec
119
+
120
+ ## Version 0.10.1
121
+ * fixed broken module.prepend
122
+
123
+ ## Version 0.10.0
124
+ * updated release notes
125
+ * rebased on master
126
+ * added docker compose file to start redis, memcached, mysql and rabbitmq for testing
127
+ * added rails 5 to appraisals
128
+ * active record log subscriber changes to support rails 5
129
+ * checked and updated action controller hacks for rails 5
130
+ * rails 5 fixed the memcache store stats bug on fetch
131
+ * rails 5 deprecated alias_method_chain, used Module.prepend instead
132
+ * rails 5 deprecated string values for middlewares
133
+
134
+ ## Version 0.9.2
135
+ * fixed sequel gem monkey patch
136
+ * I really hate the stupid decision by rake to force ruby -w on everyone
137
+ * updated rails versions in appraisals
138
+
139
+ ## Version 0.9.1
140
+ * redis time consumer: make sure to log ASCII in debug mode
141
+
142
+ ## Version 0.9.0
143
+ * added beetle time consumer
144
+ * Multiply 1000 to get the actual millisecond
145
+
146
+ ## Version 0.8.1
147
+ * make sure every consumer has a current_runtime methods (duh)
148
+
149
+ ## Version 0.8.0
150
+ * access current database runtime including not yet consumed time
151
+
152
+ ## Version 0.7.4
153
+ * fixed that actions without render showed zero db time
154
+ * removed .lock files
155
+ * use appraisal for testing against multiple active support versions
156
+ * test with rails 4.2.4
157
+
158
+ ## Version 0.7.3
159
+ * in rails 4.2 dalli is always instrumented
160
+ * monkey patches seem to be compatible with rails 4.2
161
+
162
+ ## Version 0.7.2
163
+ * updated to support ruby 2.2.0
164
+
165
+ ## Version 0.7.1
166
+ * style change
167
+ * updated README
168
+ * measure time and calls with sequel
169
+
170
+ ## Version 0.7.0
171
+ * make the most out of an unpatched ruby
172
+
173
+ ## Version 0.6.7
174
+ * fixed wrong nesting of public :sql
175
+
176
+ ## Version 0.6.6
177
+ * fixed duplicate log lines for active record monkey patch and rails 4.1
178
+ * Count redis round trips not calls
179
+
180
+ ## Version 0.6.5
181
+ * rails monkey patches are compatible with 4.1
182
+
183
+ ## Version 0.6.4
184
+ * make sure not to call 'instrument=' if a rails 4 app uses :dalli_store instead of :mem_cache_store
185
+
186
+ ## Version 0.6.3
187
+ * rails 3.2 columns don't understand binary?
188
+
189
+ ## Version 0.6.2
190
+ * rails 4.0 updates to active_record monkey_patch
191
+
192
+ ## Version 0.6.1
193
+ * support for ruby 2.1
194
+ * added test for GC time consumer
195
+
196
+ ## Version 0.6.0
197
+ * updated README
198
+ * added tests for dalli and redis and new completed line behavior
199
+ * patched dalli consumer to work correctly with rails 4
200
+ * added redis time consumer
201
+ * don't include bandits in the the completed line which haven't measured anything
202
+
203
+ ## Version 0.5.1
204
+ * added license information to gemspec
205
+
206
+ ## Version 0.5.0
207
+ * ugly hack to ensure Completed lines are logged in the test environment
208
+ * reset time bandits before running controller tests
209
+ * renamed RailsCache consumer to dalli and rely on dalli for logging
210
+ * avoid calling logger in production
211
+ * install some gems for debugging
212
+ * updated README
213
+ * we're all milliseconds now
214
+ * we are thread safe now. lose the Rack::Lock middleware
215
+ * drop rails 2 support
216
+ * switch database consumer to use base_consumer
217
+ * added a general rails cache consumer (can be used to replace memcache consumers)
218
+ * make memcache consumers threadsafe
219
+ * use structs instead of hashes for counters
220
+ * more groundwork for thread safe time bandits
221
+ * added some tests
222
+
223
+ ## Version 0.4.1
224
+ * added rake dev dependency
225
+ * we can't rely on Rack::Sendfile to be around
226
+
227
+ ## Version 0.4.0
228
+ * rails 4.0 and tagged logging support
229
+
230
+ ## Version 0.3.1
231
+ * need to call TimeBandits.consumed to get correct db time stats
232
+
233
+ ## Version 0.3.0
234
+ * use thread local variables gem
235
+ * make use of thread_local_variable_access gem
236
+
237
+ ## Version 0.2.2
238
+ * enable GC stats after passenger has forked a new worker process
239
+ * reset time bandits after rails initialization process has been completed
240
+
241
+ ## Version 0.2.1
242
+ * use the correct rails version specific code to extract raw_payload
243
+
244
+ ## Version 0.2.0
245
+ * basic rails 3.1 and 32. compatibility
246
+
247
+ ## Version 0.1.4
248
+ * fixed bug related to mixing seconds and millicesonds
249
+
250
+ ## Version 0.1.3
251
+ * db time is already measured in milliseconds
252
+
253
+ ## Version 0.1.2
254
+ * the Rails 3 database consumer no longer uses instance variables for the statistics
255
+
256
+ ## Version 0.1.1
257
+ * use own middlware logger and provide viewtime and action for logjam_agent
258
+
259
+ ## Version 0.1.0
260
+ * ignore some files
261
+ * the version numbering is ridiculous
262
+ * add a bit of backtrace info
263
+ * removed last traces of agent suport
264
+ * provide metrics for rack middlewares
265
+ * metrics for rails2 database adapter
266
+ * improved metrics for memcached
267
+
268
+ ## Version 0.0.9
269
+
270
+ * Relax Rails version check, still running fine on 2.3.14
271
+ * metrics agent support for rails 2
272
+
273
+ ## Version 0.0.8
274
+ * gem compatibility for rails 2.3.x
275
+ * updated README
276
+
277
+ ## Version 0.0.7
278
+ * git ignore the Gemfile.lock
279
+ * Assume status 500 in case of an exception being raised
280
+ * Fail gracefully if an exception occurs during before_dispatch
281
+
282
+ ## Version 0.0.6
283
+ * updated gemspec to pin to the right branch on github
284
+
285
+ ## Version 0.0.5
286
+ * prepare new version (now with activerecord support)
287
+ * updated readme
288
+ * database consumer is now thread safe
289
+ * initial version of ActiveRecord time consumer
290
+
291
+
292
+ ## Version 0.0.4
293
+ * oh man. concentrate!
294
+
295
+ ## Version 0.0.3
296
+ * oops
297
+
298
+ ## Version 0.0.2
299
+ * refactored rack logger
300
+
301
+ ## Version 0.0.1
302
+ * now a proper rails3 gem plugin
303
+ * removed log ouput
304
+ * don't install time bandits per default (app needs control over order of bandits in completed line)
305
+ * use the more accurate timing info
306
+ * Merge branch 'master' into rails3
307
+ * deleted unused file
308
+ * Merge branch 'master' into rails3
309
+ * checked in some xing modifications
310
+ * first stab at supporting rails3
311
+ * JRuby support for GC and memory statistics, using the jmx gem.
312
+ * during initialization, enable memcache and GC stats if they are available
313
+ * we are compatible to activerecord 2.3.5
314
+ * Merge branch 'master' of github.com:skaes/time_bandits
315
+ * time bandits registration interface changed and got a new method for creating log lines outside ActionController
316
+ * added Rakefile with rdoc task
317
+ * removed Rakefile
318
+ * initial import
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in time_bandits.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -84,114 +84,3 @@ changed so much of the code that is is practically a full rewrite, hence we chan
84
84
  ## Running Tests
85
85
 
86
86
  Run `docker-compose up` to start Redis, MySQL, RabbitMQ and Memached containers, then run `rake`.
87
-
88
-
89
- ## Release Notes
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
-
101
- ## Version 0.12.0
102
- - drops support for Rails versions before 5.2.0 and Ruby versions before 2.2.0
103
- - makes it possible to use individual time bandits without Rails (e.g. in a Sinatra app)
104
-
105
- ## Version 0.11.0
106
- - supports rails 6.0.0
107
-
108
- ## Version 0.10.12
109
- - supports rails 5.0.7
110
-
111
- ## Version 0.10.11
112
- - support rails 5.2.0
113
-
114
- ## Version 0.10.10
115
- - fixed regression introduced in 0.10.9
116
-
117
- ### Version 0.10.9
118
- - added specialized activerecord logging for Rails >= 5.1.5
119
-
120
- ### Version 0.10.8
121
- - rails has changed render_bind in 5.0.3
122
-
123
- ### Version 0.10.7
124
- - fixed bug in activerecord monkeypatch for Rails 5.1
125
-
126
- ### Version 0.10.6
127
- - fixed time calculation for rails 4
128
-
129
- ### Version 0.10.5
130
- - enabled activerecord monkeypatch for rails 5.1
131
-
132
- ### Version 0.10.4
133
- - protect against Rails 5 firing on_load handlers multiple times
134
-
135
- ### Version 0.10.3
136
- - fixed activerecord monkeypatch
137
-
138
- ### Version 0.10.2
139
- - controller testing fixed for rspec
140
-
141
- ### Version 0.10.1
142
- - fixed incorrect module prepend which broke controller testing
143
-
144
- ### Version 0.10.0
145
- - support rails 5
146
-
147
- ### Version 0.9.2
148
- - sequel gem changes broke sequel time consumer
149
-
150
- ### Version 0.9.1
151
- - make sure redis times consumer logs keys in ASCII
152
-
153
- ### Version 0.9.0
154
- - added beetle time consumer
155
-
156
- ### Version 0.8.1
157
- - bugfix
158
-
159
- ### Version 0.8.0
160
- - support retrieving current runtime including not yet consumed time
161
-
162
- ### Version 0.7.4
163
- - use appraisal for testing against multiple rails versions
164
- - bugfix for actions without render
165
-
166
- ### Version 0.7.3
167
- - bugfix dalli consumer for rails 4.2
168
-
169
- ### Version 0.7.2
170
- - support ruby 2.2.0
171
-
172
- ### Version 0.7.1
173
- - support measuring sequel gem
174
-
175
- ### Version 0.7.0
176
- - switched to byebug (debugger does not fully support 2.0 and 2.1 not at all)
177
- - adapted garbage collection statistics to work for 2.1
178
- - improved rails 4.x compatibility
179
- - GC time consumer now tries to make the most out of an unpatched ruby
180
-
181
- ### Version 0.6.0
182
- - added redis time consumer
183
- - fixed rails 4.0 problems with builtin mem_cache_store
184
- - now only consumers which measured something are added to the completed line
185
-
186
- ### Version 0.5.1
187
- - added license file
188
-
189
- ### Version 0.5
190
- - has dropped rails 2 support
191
- - relies on ActiveSupport::Notifications
192
- - is supposedly thread safe
193
- - all measurements are thread local (except GC statistics)
194
- - times are all measured in milliseconds internally
195
- - added class TimeBandits::TimeConsumers::BaseConsumer to simplify writing custom consumers
196
-
197
-
@@ -12,10 +12,11 @@ Sequel::Database.class_eval do
12
12
 
13
13
  def log_connection_yield(*args, &block)
14
14
  begin
15
- start = Time.now
15
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
16
16
  _orig_log_connection_yield(*args, &block)
17
17
  ensure
18
- ActiveSupport::Notifications.instrument('duration.sequel', durationInSeconds: Time.now - start)
18
+ end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
+ ActiveSupport::Notifications.instrument('duration.sequel', durationInSeconds: end_time - start_time)
19
20
  end
20
21
  end
21
22
 
@@ -25,10 +26,11 @@ Sequel::Database.class_eval do
25
26
 
26
27
  def log_yield(*args, &block)
27
28
  begin
28
- start = Time.now
29
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
29
30
  _orig_log_yield(*args, &block)
30
31
  ensure
31
- ActiveSupport::Notifications.instrument('duration.sequel', durationInSeconds: Time.now - start)
32
+ end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
33
+ ActiveSupport::Notifications.instrument('duration.sequel', durationInSeconds: end_time - start_time)
32
34
  end
33
35
  end
34
36
 
@@ -27,7 +27,7 @@ module TimeBandits
27
27
  protected
28
28
 
29
29
  def call_app(request, env)
30
- start_time = Time.now
30
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
31
31
  start(request, start_time)
32
32
  resp = @app.call(env)
33
33
  resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
@@ -36,12 +36,13 @@ module TimeBandits
36
36
  finish(request)
37
37
  raise
38
38
  ensure
39
- completed(request, (Time.now - start_time) * 1000, resp)
39
+ end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
40
+ completed(request, (end_time - start_time) * 1000, resp)
40
41
  ActiveSupport::LogSubscriber.flush_all!
41
42
  end
42
43
 
43
44
  # 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
+ def started_request_message(request, start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC))
45
46
  'Started %s "%s" for %s at %s' % [
46
47
  request.request_method,
47
48
  request.filtered_path,
@@ -1,3 +1,3 @@
1
1
  module TimeBandits
2
- VERSION = "0.12.5"
2
+ VERSION = "0.12.6"
3
3
  end
data/time_bandits.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency("mocha")
34
34
  s.add_development_dependency("mysql2")
35
35
  s.add_development_dependency("rake")
36
- s.add_development_dependency("redis")
36
+ s.add_development_dependency("redis", "< 5.0")
37
37
  s.add_development_dependency("sequel")
38
38
  s.add_development_dependency("activerecord")
39
39
  s.add_development_dependency("beetle", ">= 3.4.1")
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.5
4
+ version: 0.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread_variables
@@ -168,16 +168,16 @@ dependencies:
168
168
  name: redis
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - "<"
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: '5.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - "<"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: '5.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: sequel
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -230,6 +230,7 @@ files:
230
230
  - ".github/workflows/run-tests.yml"
231
231
  - ".gitignore"
232
232
  - Appraisals
233
+ - CHANGELOG.md
233
234
  - Gemfile
234
235
  - LICENSE.txt
235
236
  - README.md
@@ -288,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
289
  - !ruby/object:Gem::Version
289
290
  version: '0'
290
291
  requirements: []
291
- rubygems_version: 3.2.33
292
+ rubygems_version: 3.3.19
292
293
  signing_key:
293
294
  specification_version: 4
294
295
  summary: Custom performance logging for Rails