rorvswild 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47434f40b26bb65cd43bc65e5735b33fb6624560
4
- data.tar.gz: 94283ce7790741fbaa8d4ab10bf8ce478fd6b4bb
3
+ metadata.gz: d83c8de22b205606b6ca1d8a70edb9994361af2f
4
+ data.tar.gz: e8de8fd1f28219a40a5e525dc1d77b9ba8865542
5
5
  SHA512:
6
- metadata.gz: 49e13a2b68cadaf2b20b132a41e800f17f18cdb2bd980e5f3387ed9f8a44ff31ff48046460e308bd78a3a34d67db164735d02e03b9389a64acffbd43a14063ac
7
- data.tar.gz: daed92dd9864158ba31ac777849944bc07c1c6c08aa54f4a568fd48abea3a298994169fdf07bacc304577310571564cd6396f37cf1f73bb2cefdef2fab9e3f98
6
+ metadata.gz: c7c1f11d63d3ddfc0763ae333ba6978307bba99b0c8ea1774779ee822738334be82986684b3f7b043b5403db73441094e9f03c7555ec3e65c5ce3baedd7de63d
7
+ data.tar.gz: c2fb3ad205b3e98fc72c2017987d91b94c14bb4ef0a259fdf957ffc07ff8f7a9ef3fc85bfe00c782a2f8624a0d74d861dd4f91c2735775092f7e4a44a74ecdc3
@@ -1,3 +1,3 @@
1
1
  module RorVsWild
2
- VERSION = "0.1.5".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
data/lib/rorvswild.rb CHANGED
@@ -66,6 +66,7 @@ module RorVsWild
66
66
 
67
67
  Resque::Job.send(:extend, ResquePlugin) if defined?(Resque::Job)
68
68
  Delayed::Worker.lifecycle.around(:invoke_job, &method(:around_delayed_job)) if defined?(Delayed::Worker)
69
+ Sidekiq.configure_server { |config| config.server_middleware { |chain| chain.add(SidekiqPlugin) } } if defined?(Sidekiq)
69
70
  end
70
71
 
71
72
  def before_http_request(name, start, finish, id, payload)
@@ -206,10 +207,10 @@ module RorVsWild
206
207
  queries.sort { |h1, h2| h2[:runtime] <=> h1[:runtime] }[0, 25]
207
208
  end
208
209
 
210
+ SELECT_REGEX = /\Aselect/i.freeze
211
+
209
212
  def explain(sql, binds)
210
- rows = ActiveRecord::Base.connection.exec_query("EXPLAIN " + sql, "EXPLAIN", binds)
211
- rows.map { |row| row["QUERY PLAN"] }.join("\n")
212
- rescue => ex
213
+ ActiveRecord::Base.connection.explain(sql, binds) if (sql =~ SELECT_REGEX) == 0
213
214
  end
214
215
 
215
216
  def post_request(attributes)
@@ -307,4 +308,10 @@ module RorVsWild
307
308
  RorVsWild.measure_block(to_s + "#perform", &block)
308
309
  end
309
310
  end
311
+
312
+ class SidekiqPlugin
313
+ def call(worker, item, queue, &block)
314
+ RorVsWild.measure_block(item["class"] + "#perform", &block)
315
+ end
316
+ end
310
317
  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.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler