rorvswild 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rorvswild/version.rb +1 -1
- data/lib/rorvswild.rb +14 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c19e1237b3b9c450b21a294e2c13f7aa2d5ff2ee
|
4
|
+
data.tar.gz: 485ddeb9246497e3994ee81805b2ba3e26f084a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f36090b6aa9a61a8846cc7c6a3ade26ed05181a18b088cc88b8ae78c3cd8ec83496749bffa7a5947edd531e9eb87f1c5bb2b618360bc4bfe8897642a60a549b7
|
7
|
+
data.tar.gz: 5330075509becd02e23b9fa0599426ee8ba05d46fe8f9524cb483315662aac8d21591fa865151b3b980cb50c716893c01d5ff0fb3e3f305e5789e8c7443e3538
|
data/lib/rorvswild/version.rb
CHANGED
data/lib/rorvswild.rb
CHANGED
@@ -61,7 +61,7 @@ module RorVsWild
|
|
61
61
|
sql, file, line, method = payload[:sql], "Unknow", 0, "Unknow" if !file
|
62
62
|
sql = payload[:sql] if runtime >= log_sql_threshold
|
63
63
|
plan = explain(payload[:sql], payload[:binds]) if runtime >= explain_sql_threshold
|
64
|
-
|
64
|
+
push_query(file: file, line: line, method: method, sql: sql, plan: plan, runtime: runtime, times: 1)
|
65
65
|
rescue => exception
|
66
66
|
log_error(exception)
|
67
67
|
end
|
@@ -107,6 +107,19 @@ module RorVsWild
|
|
107
107
|
@views
|
108
108
|
end
|
109
109
|
|
110
|
+
def push_query(query)
|
111
|
+
if query[:sql] || query[:plan]
|
112
|
+
queries << query
|
113
|
+
else
|
114
|
+
if hash = queries.find { |hash| hash[:line] == query[:line] && hash[:file] == query[:file] }
|
115
|
+
hash[:runtime] += query[:runtime]
|
116
|
+
hash[:times] += 1
|
117
|
+
else
|
118
|
+
queries << query
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
110
123
|
def slowest_views
|
111
124
|
views.values.sort { |h1, h2| h2[:runtime] <=> h1[:runtime] }[0, 25]
|
112
125
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rorvswild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|