peek-redis 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3f7c975dcf9f81ba7946229f92cd8d3d6534d37
4
+ data.tar.gz: 45c9f6ee1036f717f204868a0c0bf5b6232b5287
5
+ SHA512:
6
+ metadata.gz: 16be05f5290cc331c9bf7e51535ce898778acb52cdbb5fa23e72b86b56fd251231c09b7f1c23eb1f99db7e2ef28de58611236ca6fc3537de5533b89947597879
7
+ data.tar.gz: 3e330e305135c2418731856e92ad169c75adb3d23da3a94968c3ca0c7805089daa4c20183d92339b33ab720a699097a56173bb9acebdb892e11008ec6bf0ccfc
@@ -9,3 +9,7 @@
9
9
  # 1.1.0
10
10
 
11
11
  - Query count and Query time are now threadsafe.
12
+
13
+ # 1.2.0
14
+
15
+ - Use prepend over chaining in Redis::Client - [#4](https://github.com/peek/peek-redis/pull/4) by @ys
@@ -1,5 +1,5 @@
1
1
  module Peek
2
2
  module Redis
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -2,22 +2,27 @@ require 'redis'
2
2
  require 'atomic'
3
3
 
4
4
  # Instrument Redis time
5
+ module Peek
6
+ module RedisInstrumented
7
+ def call(*args, &block)
8
+ start = Time.now
9
+ super(*args, &block)
10
+ ensure
11
+ duration = (Time.now - start)
12
+ ::Redis::Client.query_time.update { |value| value + duration }
13
+ ::Redis::Client.query_count.update { |value| value + 1 }
14
+ end
15
+ end
16
+ end
17
+
18
+
5
19
  class Redis::Client
20
+ prepend Peek::RedisInstrumented
6
21
  class << self
7
22
  attr_accessor :query_time, :query_count
8
23
  end
9
24
  self.query_count = Atomic.new(0)
10
25
  self.query_time = Atomic.new(0)
11
-
12
- def call_with_timing(*args, &block)
13
- start = Time.now
14
- call_without_timing(*args, &block)
15
- ensure
16
- duration = (Time.now - start)
17
- Redis::Client.query_time.update { |value| value + duration }
18
- Redis::Client.query_count.update { |value| value + 1 }
19
- end
20
- alias_method_chain :call, :timing
21
26
  end
22
27
 
23
28
  module Peek
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peek-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Garrett Bjerkhoel
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-28 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: peek
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: redis
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: atomic
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: 1.0.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.0.0
62
55
  description: Take a peek into the Redis calls made within your Rails application.
@@ -66,7 +59,7 @@ executables: []
66
59
  extensions: []
67
60
  extra_rdoc_files: []
68
61
  files:
69
- - .gitignore
62
+ - ".gitignore"
70
63
  - CHANGELOG.md
71
64
  - Gemfile
72
65
  - LICENSE.txt
@@ -80,26 +73,26 @@ files:
80
73
  - peek-redis.gemspec
81
74
  homepage: https://github.com/peek/peek-redis
82
75
  licenses: []
76
+ metadata: {}
83
77
  post_install_message:
84
78
  rdoc_options: []
85
79
  require_paths:
86
80
  - lib
87
81
  required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
82
  requirements:
90
- - - ! '>='
83
+ - - ">="
91
84
  - !ruby/object:Gem::Version
92
85
  version: '0'
93
86
  required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
87
  requirements:
96
- - - ! '>='
88
+ - - ">="
97
89
  - !ruby/object:Gem::Version
98
90
  version: '0'
99
91
  requirements: []
100
92
  rubyforge_project:
101
- rubygems_version: 1.8.23
93
+ rubygems_version: 2.5.1
102
94
  signing_key:
103
- specification_version: 3
95
+ specification_version: 4
104
96
  summary: Take a peek into the Redis calls made within your Rails application.
105
97
  test_files: []
98
+ has_rdoc: