mongo-rails-instrumentation 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -7,6 +7,8 @@ Records how long your rails app spends in Mongo, and outputs it to the log, i.e.
7
7
 
8
8
  To use, just add the gem to your Gemfile and restart your app:
9
9
 
10
- gem 'mongo-rails-instrumentation', '~>0.1'
10
+ gem 'mongo-rails-instrumentation', '~>0.2'
11
11
 
12
- This gem's home is on github at https://github.com/freerange/mongo-rails-instrumentation, so please add comments, suggestions and improvements there.
12
+ It's been tested with rails 3.0, and should work with rails 3.1 too.
13
+
14
+ This gem's home is on github at https://github.com/tomafro/mongo-rails-instrumentation, so please add comments, suggestions and improvements there.
@@ -9,9 +9,9 @@ module Mongo::Rails::Instrumentation
9
9
  attr_internal :mongo_runtime
10
10
 
11
11
  def cleanup_view_runtime
12
- mongo_rt_before_render = LogSubscriber.reset
12
+ mongo_rt_before_render = LogSubscriber.reset_runtime
13
13
  runtime = super
14
- mongo_rt_after_render = LogSubscriber.reset
14
+ mongo_rt_after_render = LogSubscriber.reset_runtime
15
15
  self.mongo_runtime = mongo_rt_before_render + mongo_rt_after_render
16
16
  runtime - mongo_rt_after_render
17
17
  end
@@ -1,33 +1,20 @@
1
1
  require 'mongo/rails/instrumentation'
2
2
 
3
3
  class Mongo::Rails::Instrumentation::LogSubscriber < ActiveSupport::LogSubscriber
4
- PREFIX = self.class.name.freeze
5
- COUNT_KEY = PREFIX + "#count".freeze
6
- RUNTIME_KEY = PREFIX + "#runtime".freeze
7
-
8
4
  def self.runtime=(value)
9
- Thread.current[RUNTIME_KEY] = value
5
+ Thread.current["mongo_mongo_runtime"] = value
10
6
  end
11
7
 
12
8
  def self.runtime
13
- Thread.current[RUNTIME_KEY] ||= 0
14
- end
15
-
16
- def self.count=(value)
17
- Thread.current[COUNT_KEY] = value
18
- end
19
-
20
- def self.count
21
- Thread.current[COUNT_KEY] ||= 0
9
+ Thread.current["mongo_mongo_runtime"] ||= 0
22
10
  end
23
11
 
24
- def self.reset
25
- rt, self.runtime, self.count = runtime, 0, 0
12
+ def self.reset_runtime
13
+ rt, self.runtime = runtime, 0
26
14
  rt
27
15
  end
28
16
 
29
17
  def mongo(event)
30
18
  self.class.runtime += event.duration
31
- self.class.count += 1
32
19
  end
33
20
  end
@@ -1,7 +1,7 @@
1
1
  module Mongo
2
2
  module Rails
3
3
  module Instrumentation
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
6
6
  end
7
7
  end
@@ -9,13 +9,11 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Tom Ward"]
10
10
  s.email = ["tom@popdog.net"]
11
11
  s.homepage = "http://tomafro.net"
12
- s.summary = %q{Record time spent in Mongo and add to request logs}
13
- s.description = %q{Record time spent in Mongo and add to request logs}
12
+ s.summary = %q{Records time spent in mongo and adds to request logs}
13
+ s.description = %q{Records time spent in mongo and adds to request logs}
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
-
20
- s.add_dependency 'rails', '~>3.0.0'
21
19
  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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Ward
@@ -15,26 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-21 00:00:00 +00:00
18
+ date: 2011-05-07 00:00:00 +01:00
19
19
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
- - 0
34
- version: 3.0.0
35
- type: :runtime
36
- version_requirements: *id001
37
- description: Record time spent in Mongo and add to request logs
20
+ dependencies: []
21
+
22
+ description: Records time spent in mongo and adds to request logs
38
23
  email:
39
24
  - tom@popdog.net
40
25
  executables: []
@@ -85,9 +70,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
70
  requirements: []
86
71
 
87
72
  rubyforge_project:
88
- rubygems_version: 1.5.2
73
+ rubygems_version: 1.6.2
89
74
  signing_key:
90
75
  specification_version: 3
91
- summary: Record time spent in Mongo and add to request logs
76
+ summary: Records time spent in mongo and adds to request logs
92
77
  test_files: []
93
78