time_bandits 0.12.7 → 0.13.1

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: 4b8b86f7d1fd439347f33ce1a814afe78f6bb4b81f287821d1cafa710d685cc7
4
- data.tar.gz: bd4914bd9edc10e9af70e9d642de6f4f29a6718f2405121f1d7e64155e90920b
3
+ metadata.gz: e14e3f3974575197ad97649241f327dbf69824c354044bde8bd55ff421d9c21a
4
+ data.tar.gz: 4115bb4f9820a3227a62d6b4ea66c5f045c59cacb019fd89be71ff9da6b2f790
5
5
  SHA512:
6
- metadata.gz: 2be85317edc8af9c48c7aa319c6725bc1fad3f734190a83742995926c9bb90f82ce88d2c9f87abea92c6e96f85235176a896ea7449fd8ed03615dd7c2ae85a57
7
- data.tar.gz: 7566807416012598e58e9528a8196fba0bfefa9841a32052792a23070b9cae8e98844455f73edd25644ec09eca12f3e4a895010347724e5cc9fffd184f9f7413
6
+ metadata.gz: abc74cb6ae11bdf9388f8d113a3df89d61e6403cd614ebdd8d73aaa5be84c8a2d9d50d746b57a2eb4079140e1a34c9e1e3c172428e1065d15893ad94e99330b6
7
+ data.tar.gz: bd2347a6f49613abd7359524c1a08cb609acf501180b1deeb5b093318b664ff330c7a0bd8b2a577b1dee303d62ea8481162485b704d4f9041000cc58b3dd77a2
@@ -13,10 +13,10 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- ruby-version: [3.1.2, 3.0.4, 2.7.6]
16
+ ruby-version: [3.2.0, 3.1.3, 3.0.5, 2.7.7]
17
17
 
18
18
  steps:
19
- - uses: actions/checkout@v2
19
+ - uses: actions/checkout@v3
20
20
 
21
21
  - name: Start containers
22
22
  run: docker-compose -f docker-compose.yml up -d
data/Appraisals CHANGED
@@ -1,14 +1,17 @@
1
1
  appraisals = [
2
- "6.0.4.7",
3
- "6.1.5",
2
+ "6.0.6",
3
+ "6.1.6",
4
4
  ]
5
5
 
6
- appraisals.insert(0, "5.2.6") if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
7
- appraisals << "7.0.2.3" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
6
+ appraisals.insert(0, "5.2.8.1") if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
7
+ appraisals << "7.0.4" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
8
8
 
9
9
  appraisals.each do |rails_version|
10
- appraise "activesupport-#{rails_version}" do
11
- gem "activesupport", rails_version
12
- gem "activerecord", rails_version
10
+ %w(4.0 5.0).each do |redis_version|
11
+ appraise "activesupport-#{rails_version}-redis-#{redis_version}" do
12
+ gem "redis", "~> #{redis_version}"
13
+ gem "activesupport", rails_version
14
+ gem "activerecord", rails_version
15
+ end
13
16
  end
14
17
  end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
- ## Version 0.12.6
3
+ ## 0.13.1
4
+ * Fixed last place that tried to log a monotonic clock timestamp
5
+ instead of a Time instance.
6
+
7
+ ## 0.13.0
8
+ * Support redis 5.0.
9
+
10
+ ## Version 0.12.7
4
11
  * logging start time requires a real time, not a monotonic clock
5
12
 
6
13
  ## Version 0.12.6
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in time_bandits.gemspec
4
4
  gemspec
5
+
6
+ gem "hiredis-client"
7
+
8
+ # Use patched appraisal gem until it is fixed upstream.
9
+ gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", ref: "0c855ae0da89fec74b4d1a01801c55b0e72496d4"
data/docker-compose.yml CHANGED
@@ -17,7 +17,7 @@ services:
17
17
 
18
18
  redis:
19
19
  container_name: redis
20
- image: redis:5.0
20
+ image: redis:6.0
21
21
  ports:
22
22
  - "6379:6379"
23
23
 
@@ -1,12 +1,36 @@
1
1
  require 'redis'
2
- class Redis
3
- class Client
4
- alias :old_logging :logging
5
2
 
6
- def logging(commands, &block)
7
- ActiveSupport::Notifications.instrument('request.redis', commands: commands) do
8
- old_logging(commands, &block)
3
+ if Redis::VERSION < "5.0"
4
+
5
+ class Redis
6
+ class Client
7
+ alias :old_logging :logging
8
+
9
+ def logging(commands, &block)
10
+ ActiveSupport::Notifications.instrument('request.redis', commands: commands) do
11
+ old_logging(commands, &block)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ else
18
+
19
+ module TimeBandits
20
+ module RedisInstrumentation
21
+ def call(command, redis_config)
22
+ ActiveSupport::Notifications.instrument("request.redis", commands: [command]) do
23
+ super
24
+ end
25
+ end
26
+
27
+ def call_pipelined(commands, redis_config)
28
+ ActiveSupport::Notifications.instrument("request.redis", commands: commands) do
29
+ super
30
+ end
9
31
  end
10
32
  end
11
33
  end
34
+ RedisClient.register(TimeBandits::RedisInstrumentation)
35
+
12
36
  end
@@ -28,7 +28,7 @@ module TimeBandits
28
28
 
29
29
  def call_app(request, env)
30
30
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
31
- start(request, start_time)
31
+ start(request, Time.now)
32
32
  resp = @app.call(env)
33
33
  resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
34
34
  resp
@@ -16,7 +16,7 @@ module TimeBandits
16
16
  def request(event)
17
17
  i = Redis.instance
18
18
  i.time += event.duration
19
- i.calls += 1 #count redis round trips, not calls
19
+ i.calls += 1 # count redis round trips, not calls
20
20
 
21
21
  return unless logger.debug?
22
22
 
@@ -1,3 +1,3 @@
1
1
  module TimeBandits
2
- VERSION = "0.12.7"
2
+ VERSION = "0.13.1"
3
3
  end
@@ -54,10 +54,10 @@ class RedisTest < Test::Unit::TestCase
54
54
  private
55
55
  def pipelined_work(type = :pipelined)
56
56
  TimeBandits.reset
57
- @redis.send(type) do
58
- @redis.get("foo")
59
- @redis.set("bar", 1)
60
- @redis.hgetall("baz")
57
+ @redis.send(type) do |transaction|
58
+ transaction.get("foo")
59
+ transaction.set("bar", 1)
60
+ transaction.hgetall("baz")
61
61
  end
62
62
  end
63
63
 
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", "< 5.0")
36
+ s.add_development_dependency("redis")
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.7
4
+ version: 0.13.1
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-08-31 00:00:00.000000000 Z
11
+ date: 2023-01-28 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: '5.0'
173
+ version: '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: '5.0'
180
+ version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: sequel
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -289,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  - !ruby/object:Gem::Version
290
290
  version: '0'
291
291
  requirements: []
292
- rubygems_version: 3.3.19
292
+ rubygems_version: 3.4.1
293
293
  signing_key:
294
294
  specification_version: 4
295
295
  summary: Custom performance logging for Rails