scout_rails 1.0.1 → 1.0.2.pre

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.
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.2.pre
2
+
3
+ * Net::HTTP instrumentation
4
+
1
5
  # 1.0.1
2
6
 
3
7
  * Unicorn support (requires "preload_app true" in unicorn config file)
@@ -6,7 +10,7 @@
6
10
 
7
11
  # 1.0.0
8
12
 
9
- Release!
13
+ * Release!
10
14
 
11
15
  # 0.0.6.pre
12
16
 
@@ -32,8 +36,8 @@ Release!
32
36
 
33
37
  # 0.0.2
34
38
 
35
- Doesn't prevent app from loading if no configuration exists for the current environment.
39
+ * Doesn't prevent app from loading if no configuration exists for the current environment.
36
40
 
37
41
  # 0.0.1
38
42
 
39
- Boom! Initial Release.
43
+ * Boom! Initial Release.
@@ -290,6 +290,7 @@ module ScoutRails
290
290
  require File.expand_path(File.join(File.dirname(__FILE__),'instruments/sinatra_instruments.rb'))
291
291
  end
292
292
  require File.expand_path(File.join(File.dirname(__FILE__),'instruments/active_record_instruments.rb'))
293
+ require File.expand_path(File.join(File.dirname(__FILE__),'instruments/net_http.rb'))
293
294
  rescue
294
295
  logger.warn "Exception loading instruments:"
295
296
  logger.warn $!.message
@@ -0,0 +1,14 @@
1
+ if defined?(::Net) && defined?(Net::HTTP)
2
+ ScoutRails::Agent.instance.logger.debug "Instrumenting Net::HTTP"
3
+ Net::HTTP.class_eval do
4
+ include ScoutRails::Tracer
5
+
6
+ def request_with_scout_instruments(*args,&block)
7
+ self.class.instrument("HTTP/request", :desc => "#{(@address+args.first.path.split('?').first)[0..99]}") do
8
+ request_without_scout_instruments(*args,&block)
9
+ end
10
+ end
11
+ alias request_without_scout_instruments request
12
+ alias request request_with_scout_instruments
13
+ end
14
+ end
@@ -27,6 +27,11 @@ module ScoutRails::Tracer
27
27
  # - :scope => If specified, sets the sub-scope for the metric. We allow additional scope level. This is used
28
28
  # when rendering the transaction tree in the UI.
29
29
  def instrument(metric_name, options={}, &block)
30
+ # don't instrument if (1) NOT inside a transaction and (2) NOT a Controller metric.
31
+ if !Thread::current[:scout_scope_name] and metric_name !~ /\AController\//
32
+ ScoutRails::Agent.instance.logger.debug "Not instrumenting [#{metric_name}] - no scope."
33
+ return yield
34
+ end
30
35
  if options.delete(:scope)
31
36
  Thread::current[:scout_sub_scope] = metric_name
32
37
  end
@@ -1,3 +1,3 @@
1
1
  module ScoutRails
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2.pre"
3
3
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.0.2.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Derek Haynes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-20 00:00:00.000000000 Z
13
+ date: 2012-07-22 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Monitors a Ruby on Rails application and reports detailed metrics on
16
16
  performance to Scout, a hosted monitoring service.
@@ -31,6 +31,7 @@ files:
31
31
  - lib/scout_rails/config.rb
32
32
  - lib/scout_rails/environment.rb
33
33
  - lib/scout_rails/instruments/active_record_instruments.rb
34
+ - lib/scout_rails/instruments/net_http.rb
34
35
  - lib/scout_rails/instruments/process/process_cpu.rb
35
36
  - lib/scout_rails/instruments/process/process_memory.rb
36
37
  - lib/scout_rails/instruments/rails/action_controller_instruments.rb
@@ -61,9 +62,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
62
  required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  none: false
63
64
  requirements:
64
- - - ! '>='
65
+ - - ! '>'
65
66
  - !ruby/object:Gem::Version
66
- version: '0'
67
+ version: 1.3.1
67
68
  requirements: []
68
69
  rubyforge_project: scout_rails
69
70
  rubygems_version: 1.8.10