peek-mysql2 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4 -0
- data/lib/peek-mysql2/timing.rb +15 -0
- data/lib/peek-mysql2/version.rb +1 -1
- data/lib/peek/views/mysql2.rb +17 -12
- data/peek-mysql2.gemspec +3 -1
- metadata +34 -26
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ee53493c776374c07c77390ac98d76ca24e23496
|
4
|
+
data.tar.gz: 74bfa39967913d656e169825edf831108bef5ab4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8770d130da99acb7917883e0a5be57b6b75d482eb79c2960d9b36a23dc8c4143c46c9fa5754d6bfc80ed238431bb78a94164868c0b60c684cb7a4acdb924781c
|
7
|
+
data.tar.gz: 03fe0064756b56672b390f62be6653501b41f0fa92c2b548376c4186c739674412eb2178592b265e1a0f5800a2cbbc5860fa3b4a70df3aa06aee35bccefcf788
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Peek
|
2
|
+
module Mysql2
|
3
|
+
module Timing
|
4
|
+
def query(*args)
|
5
|
+
start = Time.now
|
6
|
+
super(*args)
|
7
|
+
ensure
|
8
|
+
duration = (Time.now - start)
|
9
|
+
::Mysql2::Client.query_time.update { |value| value + duration }
|
10
|
+
::Mysql2::Client.query_count.update { |value| value + 1 }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
data/lib/peek-mysql2/version.rb
CHANGED
data/lib/peek/views/mysql2.rb
CHANGED
@@ -1,23 +1,28 @@
|
|
1
1
|
require 'mysql2'
|
2
|
-
require '
|
2
|
+
require 'concurrent/atomics'
|
3
3
|
|
4
4
|
# Instrument SQL time
|
5
5
|
class Mysql2::Client
|
6
6
|
class << self
|
7
7
|
attr_accessor :query_time, :query_count
|
8
8
|
end
|
9
|
-
self.query_count =
|
10
|
-
self.query_time =
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
self.query_count = Concurrent::AtomicReference.new(0)
|
10
|
+
self.query_time = Concurrent::AtomicReference.new(0)
|
11
|
+
|
12
|
+
if defined? Rails::VERSION::MAJOR && Rails::VERSION::MAJOR >= 5
|
13
|
+
require 'peek-mysql2/timing'
|
14
|
+
prepend ::Peek::Mysql2::Timing
|
15
|
+
else
|
16
|
+
def call_with_timing(*args, &block)
|
17
|
+
start = Time.now
|
18
|
+
call_without_timing(*args, &block)
|
19
|
+
ensure
|
20
|
+
duration = (Time.now - start)
|
21
|
+
Mysql2::Client.query_time.update { |value| value + duration }
|
22
|
+
Mysql2::Client.query_count.update { |value| value + 1 }
|
23
|
+
end
|
24
|
+
alias_method_chain :call, :timing
|
19
25
|
end
|
20
|
-
alias_method_chain :query, :timing
|
21
26
|
end
|
22
27
|
|
23
28
|
module Peek
|
data/peek-mysql2.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Take a peek into the MySQL queries made during your application's requests.}
|
12
12
|
gem.summary = %q{Take a peek into the MySQL queries made during your application's requests.}
|
13
13
|
gem.homepage = 'https://github.com/peek/peek-mysql2'
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -19,5 +20,6 @@ Gem::Specification.new do |gem|
|
|
19
20
|
|
20
21
|
gem.add_dependency 'peek'
|
21
22
|
gem.add_dependency 'mysql2'
|
22
|
-
gem.add_dependency '
|
23
|
+
gem.add_dependency 'concurrent-ruby'
|
24
|
+
gem.add_dependency 'concurrent-ruby-ext'
|
23
25
|
end
|
metadata
CHANGED
@@ -1,64 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peek-mysql2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
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:
|
11
|
+
date: 2017-06-21 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: mysql2
|
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
|
-
name:
|
42
|
+
name: concurrent-ruby
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: '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
|
-
version:
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: concurrent-ruby-ext
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
62
69
|
description: Take a peek into the MySQL queries made during your application's requests.
|
63
70
|
email:
|
64
71
|
- me@garrettbjerkhoel.com
|
@@ -66,7 +73,7 @@ executables: []
|
|
66
73
|
extensions: []
|
67
74
|
extra_rdoc_files: []
|
68
75
|
files:
|
69
|
-
- .gitignore
|
76
|
+
- ".gitignore"
|
70
77
|
- CHANGELOG.md
|
71
78
|
- Gemfile
|
72
79
|
- LICENSE.txt
|
@@ -75,31 +82,32 @@ files:
|
|
75
82
|
- app/views/peek/views/_mysql2.html.erb
|
76
83
|
- lib/peek-mysql2.rb
|
77
84
|
- lib/peek-mysql2/railtie.rb
|
85
|
+
- lib/peek-mysql2/timing.rb
|
78
86
|
- lib/peek-mysql2/version.rb
|
79
87
|
- lib/peek/views/mysql2.rb
|
80
88
|
- peek-mysql2.gemspec
|
81
89
|
homepage: https://github.com/peek/peek-mysql2
|
82
|
-
licenses:
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
83
93
|
post_install_message:
|
84
94
|
rdoc_options: []
|
85
95
|
require_paths:
|
86
96
|
- lib
|
87
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
98
|
requirements:
|
90
|
-
- -
|
99
|
+
- - ">="
|
91
100
|
- !ruby/object:Gem::Version
|
92
101
|
version: '0'
|
93
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
103
|
requirements:
|
96
|
-
- -
|
104
|
+
- - ">="
|
97
105
|
- !ruby/object:Gem::Version
|
98
106
|
version: '0'
|
99
107
|
requirements: []
|
100
108
|
rubyforge_project:
|
101
|
-
rubygems_version:
|
109
|
+
rubygems_version: 2.4.5.2
|
102
110
|
signing_key:
|
103
|
-
specification_version:
|
111
|
+
specification_version: 4
|
104
112
|
summary: Take a peek into the MySQL queries made during your application's requests.
|
105
113
|
test_files: []
|