peek-pg 1.1.0 → 1.2.0
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 +7 -0
- data/CHANGELOG.md +5 -0
- data/lib/peek-pg/version.rb +1 -1
- data/lib/peek/views/pg.rb +13 -3
- data/peek-pg.gemspec +2 -1
- metadata +31 -25
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a4b8b39eb826148ef4db4087c6db736fc225b701
|
|
4
|
+
data.tar.gz: 15093cd921a8b0974eda9f8c1a065b38bf471c02
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1a55bd096a426a836610854bb4694bc57db67d9ca231f50202cb7f1a4f4a80b3b4cdab207aae9828bcfdb4a4ec354b06c013513c4100e30fe141a862fb1bcba0
|
|
7
|
+
data.tar.gz: ef6c892b1f5d53613e51717fda662490de64203596b69abce225fd7b11f8def14da1135c472e1bd15ebd73f8a312d251499c1bbb18363484f75853b72f3db1f3
|
data/CHANGELOG.md
CHANGED
|
@@ -5,3 +5,8 @@
|
|
|
5
5
|
# 1.1.0
|
|
6
6
|
|
|
7
7
|
- Query count and Query time are now threadsafe.
|
|
8
|
+
|
|
9
|
+
# 1.2.0
|
|
10
|
+
|
|
11
|
+
- Use concurrent-ruby gem in favor of deprecated atomic gem. - [#4](https://github.com/peek/peek-pg/pull/4) [@lucasmazza](https://github.com/lucasmazza)
|
|
12
|
+
- Instrument prepared statements. - [#5](https://github.com/peek/peek-pg/pull/5) [@lucasmazza](https://github.com/lucasmazza)
|
data/lib/peek-pg/version.rb
CHANGED
data/lib/peek/views/pg.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require 'pg'
|
|
2
|
-
require '
|
|
2
|
+
require 'concurrent/atomics'
|
|
3
3
|
|
|
4
4
|
# Instrument SQL time
|
|
5
5
|
class PG::Connection
|
|
6
6
|
class << self
|
|
7
7
|
attr_accessor :query_time, :query_count
|
|
8
8
|
end
|
|
9
|
-
self.query_count =
|
|
10
|
-
self.query_time =
|
|
9
|
+
self.query_count = Concurrent::AtomicReference.new(0)
|
|
10
|
+
self.query_time = Concurrent::AtomicReference.new(0)
|
|
11
11
|
|
|
12
12
|
def exec_with_timing(*args)
|
|
13
13
|
start = Time.now
|
|
@@ -28,6 +28,16 @@ class PG::Connection
|
|
|
28
28
|
PG::Connection.query_count.update { |value| value + 1 }
|
|
29
29
|
end
|
|
30
30
|
alias_method_chain :async_exec, :timing
|
|
31
|
+
|
|
32
|
+
def exec_prepared_with_timing(*args)
|
|
33
|
+
start = Time.now
|
|
34
|
+
exec_prepared_without_timing(*args)
|
|
35
|
+
ensure
|
|
36
|
+
duration = (Time.now - start)
|
|
37
|
+
PG::Connection.query_time.update { |value| value + duration }
|
|
38
|
+
PG::Connection.query_count.update { |value| value + 1 }
|
|
39
|
+
end
|
|
40
|
+
alias_method_chain :exec_prepared, :timing
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
module Peek
|
data/peek-pg.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,64 +1,71 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: peek-pg
|
|
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: 2016-03-04 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: pg
|
|
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 Postgres queries made during your application's
|
|
63
70
|
requests.
|
|
64
71
|
email:
|
|
@@ -67,7 +74,7 @@ executables: []
|
|
|
67
74
|
extensions: []
|
|
68
75
|
extra_rdoc_files: []
|
|
69
76
|
files:
|
|
70
|
-
- .gitignore
|
|
77
|
+
- ".gitignore"
|
|
71
78
|
- CHANGELOG.md
|
|
72
79
|
- Gemfile
|
|
73
80
|
- LICENSE.txt
|
|
@@ -81,26 +88,25 @@ files:
|
|
|
81
88
|
- peek-pg.gemspec
|
|
82
89
|
homepage: https://github.com/peek/peek-pg
|
|
83
90
|
licenses: []
|
|
91
|
+
metadata: {}
|
|
84
92
|
post_install_message:
|
|
85
93
|
rdoc_options: []
|
|
86
94
|
require_paths:
|
|
87
95
|
- lib
|
|
88
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
97
|
requirements:
|
|
91
|
-
- -
|
|
98
|
+
- - ">="
|
|
92
99
|
- !ruby/object:Gem::Version
|
|
93
100
|
version: '0'
|
|
94
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
|
-
none: false
|
|
96
102
|
requirements:
|
|
97
|
-
- -
|
|
103
|
+
- - ">="
|
|
98
104
|
- !ruby/object:Gem::Version
|
|
99
105
|
version: '0'
|
|
100
106
|
requirements: []
|
|
101
107
|
rubyforge_project:
|
|
102
|
-
rubygems_version:
|
|
108
|
+
rubygems_version: 2.5.1
|
|
103
109
|
signing_key:
|
|
104
|
-
specification_version:
|
|
110
|
+
specification_version: 4
|
|
105
111
|
summary: Take a peek into the Postgres queries made during your application's requests.
|
|
106
112
|
test_files: []
|