scout_rails 1.0.1.pre → 1.0.1.pre2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  # 1.0.1.pre
2
2
 
3
3
  * Unicorn support (requires "preload_app true" in unicorn config file)
4
+ * Fix for Thin detection - ensure it's actually running
4
5
 
5
6
  # 1.0.0
6
7
 
@@ -10,7 +10,17 @@ Install the gem:
10
10
 
11
11
  gem install scout_rails
12
12
 
13
- Signup for a [Scout](https://scoutapp.com) account and copy the config file to RAILS_ROOT/config/scout_rails.yml.
13
+ Signup for a [Scout](https://scoutapp.com) account and copy the config file to `RAILS_ROOT/config/scout_rails.yml`.
14
+
15
+ Your config file should look like:
16
+
17
+ common: &defaults
18
+ name: YOUR_APPLICATION_NAME
19
+ key: YOUR_APPLICATION_KEY
20
+ monitor: true
21
+
22
+ production:
23
+ <<: *defaults
14
24
 
15
25
  ## Supported Frameworks
16
26
 
@@ -27,6 +37,7 @@ Signup for a [Scout](https://scoutapp.com) account and copy the config file to R
27
37
  * Phusion Passenger
28
38
  * Thin
29
39
  * WEBrick
40
+ * Unicorn (make sure to add `preload_app true` to `config/unicorn.rb`)
30
41
 
31
42
  ## Help
32
43
 
@@ -66,8 +66,8 @@ module ScoutRails
66
66
  start_instruments
67
67
  if !start_worker_thread?
68
68
  logger.debug "Not starting worker thread"
69
- install_passenger_worker_process_event if environment.passenger?
70
- install_unicorn_worker_loop if environment.unicorn?
69
+ install_passenger_worker_process_event if environment.app_server == :passenger
70
+ install_unicorn_worker_loop if environment.app_server == :unicorn
71
71
  return
72
72
  end
73
73
  start_worker_thread
@@ -108,7 +108,7 @@ module ScoutRails
108
108
  # * A supported application server is detected, but it forks (Passenger). In this case,
109
109
  # the agent is started in the forked process.
110
110
  def start_worker_thread?
111
- !environment.forking? or environment.thin?
111
+ !environment.forking? or environment.app_server == :thin
112
112
  end
113
113
 
114
114
  def install_passenger_worker_process_event
@@ -47,7 +47,19 @@ module ScoutRails
47
47
  ### app server related-checks
48
48
 
49
49
  def thin?
50
- defined?(::Thin) && defined?(::Thin::Server)
50
+ if defined?(::Thin) && defined?(::Thin::Server)
51
+ # Ensure Thin is actually initialized. It could just be required and not running.
52
+ ObjectSpace.each_object(Thin::Server) { |x| return true }
53
+ false
54
+ end
55
+ end
56
+
57
+ def unicorn?
58
+ if defined?(::Unicorn) && defined?(::Unicorn::HttpServer)
59
+ # Ensure Unicorn is actually initialized. It could just be required and not running.
60
+ ObjectSpace.each_object(::Unicorn::HttpServer) { |x| return true }
61
+ false
62
+ end
51
63
  end
52
64
 
53
65
  # Called via +#forking?+ since Passenger forks. Adds an event listener to start the worker thread
@@ -1,3 +1,3 @@
1
1
  module ScoutRails
2
- VERSION = "1.0.1.pre"
2
+ VERSION = "1.0.1.pre2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.pre
4
+ version: 1.0.1.pre2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-17 00:00:00.000000000 Z
13
+ date: 2012-07-18 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.