mongo-rails-instrumentation 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,20 +1,32 @@
1
1
  require 'mongo/rails/instrumentation'
2
2
 
3
3
  class Mongo::Rails::Instrumentation::LogSubscriber < ActiveSupport::LogSubscriber
4
+ RUNTIME_KEY = name + "#runtime"
5
+ COUNT_KEY = name + "#count"
6
+
4
7
  def self.runtime=(value)
5
- Thread.current["mongo_mongo_runtime"] = value
8
+ Thread.current[RUNTIME_KEY] = value
6
9
  end
7
10
 
8
11
  def self.runtime
9
- Thread.current["mongo_mongo_runtime"] ||= 0
12
+ Thread.current[RUNTIME_KEY] ||= 0
13
+ end
14
+
15
+ def self.count=(value)
16
+ Thread.current[COUNT_KEY] = value
17
+ end
18
+
19
+ def self.count
20
+ Thread.current[COUNT_KEY] ||= 0
10
21
  end
11
22
 
12
23
  def self.reset_runtime
13
- rt, self.runtime = runtime, 0
24
+ rt, self.runtime, self.count = runtime, 0, 0
14
25
  rt
15
26
  end
16
27
 
17
28
  def mongo(event)
18
29
  self.class.runtime += event.duration
30
+ self.class.count += 1
19
31
  end
20
32
  end
@@ -1,7 +1,7 @@
1
1
  module Mongo
2
2
  module Rails
3
3
  module Instrumentation
4
- VERSION = "0.2.2"
4
+ VERSION = '0.2.3'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-rails-instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Ward
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-14 00:00:00 +01:00
18
+ date: 2011-05-17 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21