scout_apm 0.1.3 → 0.1.3.1

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: 5e446ee188c5294111023e7110aa649c3d1e0d6d
4
- data.tar.gz: 28bf8811e6e819ea847b806ae3f5abf62c2531b2
3
+ metadata.gz: 6dd9fa6823ce48d2b2b36ae4238cfaa3152bfd08
4
+ data.tar.gz: c0916b57ea440cedaf275792089bedf20249ffe9
5
5
  SHA512:
6
- metadata.gz: 9b174e8e7a4aa643a6b7ae8491aab27d969b2b64c3513ee32911b2045b2b4d9703cbca2a011404f7fd9c4557c6ed45948dce8d0119f55eafdcbc17950d34a188
7
- data.tar.gz: 292f67f6b0d69de6aaf2582f53dfb1faae882baaf66127431566ba1c30692f1d2b5fd018e45df2fd9da664dacd037013d97d98805f9908880ec898b558ec1af2
6
+ metadata.gz: d62355ce9a305aa40ecd58722b1c518a1dc2606e06aa3fd1101b73100bded03a48e51c2a2bcc54907f0eb5da5e3444bdb819cc420766e90823cca19f4d7344bc
7
+ data.tar.gz: 27c9bc33de0af9d4aff82503ad7e3bb1a8fde34a6448fba5ebe61b84f80d2354a517aecf7ddb7fcf48a059193c3027064c7a159223335156dc74a22cee798056
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.3.1
2
+
3
+ * Adds Puma support
4
+ * Fix for returning true for unicorn? and rainbows? when they are included in the Gemfile but not actually serving the app.
5
+
1
6
  # 0.1.3
2
7
 
3
8
  * Adds capacity calculation via "Instance/Capacity" metric.
data/README.markdown CHANGED
@@ -36,6 +36,8 @@ Your config file should look like:
36
36
  * Thin
37
37
  * WEBrick
38
38
  * Unicorn (make sure to add `preload_app true` to `config/unicorn.rb`)
39
+ * Rainbows
40
+ * Puma
39
41
 
40
42
  ## Help
41
43
 
@@ -66,10 +66,11 @@ module ScoutApm
66
66
  logger.info "Starting monitoring for [#{config.value('name')}]. Framework [#{environment.framework}] App Server [#{environment.app_server}]."
67
67
  start_instruments
68
68
  if !start_background_worker?
69
- logger.debug "Not starting worker thread"
69
+ logger.debug "Not starting worker thread. Will start worker loops after forking."
70
70
  install_passenger_events if environment.app_server == :passenger
71
71
  install_unicorn_worker_loop if environment.app_server == :unicorn
72
72
  install_rainbows_worker_loop if environment.app_server == :rainbows
73
+ install_puma_worker_loop if environment.app_server == :puma
73
74
  return
74
75
  end
75
76
  start_background_worker
@@ -116,11 +117,14 @@ module ScoutApm
116
117
 
117
118
  # The worker thread will automatically start UNLESS:
118
119
  # * A supported application server isn't detected (example: running via Rails console)
119
- # * A supported application server is detected, but it forks (Passenger). In this case,
120
+ # * A supported application server is detected, but it forks. In this case,
120
121
  # the agent is started in the forked process.
121
122
  def start_background_worker?
122
- !environment.forking? or environment.app_server == :thin
123
+ !environment.forking? or environment.app_server == :thin # clarify why Thin is here but not WEBrick
123
124
  end
125
+
126
+ ## TODO - Likely possible to unify starting the worker loop in forking servers by listening for the first transaction
127
+ ## to start and starting the background worker then in that process.
124
128
 
125
129
  def install_passenger_events
126
130
  PhusionPassenger.on_event(:starting_worker_process) do |forked|
@@ -155,6 +159,15 @@ module ScoutApm
155
159
  old.bind(self).call(worker)
156
160
  end
157
161
  end
162
+ end
163
+
164
+ def install_puma_worker_loop
165
+ Puma.cli_config.options[:before_worker_boot] << Proc.new do
166
+ logger.debug "Installing Puma worker loop."
167
+ ScoutApm::Agent.instance.start_background_worker
168
+ end
169
+ rescue
170
+ logger.warn "Unable to install Puma worker loop: #{$!.message}"
158
171
  end
159
172
 
160
173
  # Creates the worker thread. The worker thread is a loop that runs continuously. It sleeps for +Agent#period+ and when it wakes,
@@ -73,6 +73,7 @@ module ScoutApm
73
73
  @app_server ||= if passenger? then :passenger
74
74
  elsif rainbows? then :rainbows
75
75
  elsif unicorn? then :unicorn
76
+ elsif puma? then :puma
76
77
  elsif thin? then :thin
77
78
  elsif webrick? then :webrick
78
79
  else nil
@@ -103,6 +104,7 @@ module ScoutApm
103
104
  def rainbows?
104
105
  if defined?(::Rainbows) && defined?(::Rainbows::HttpServer)
105
106
  ObjectSpace.each_object(::Rainbows::HttpServer) { |x| return true }
107
+ false
106
108
  end
107
109
  end
108
110
 
@@ -110,13 +112,18 @@ module ScoutApm
110
112
  if defined?(::Unicorn) && defined?(::Unicorn::HttpServer)
111
113
  # Ensure Unicorn is actually initialized. It could just be required and not running.
112
114
  ObjectSpace.each_object(::Unicorn::HttpServer) { |x| return true }
115
+ false
113
116
  end
114
117
  end
118
+
119
+ def puma?
120
+ defined?(::Puma) && File.basename($0) == 'puma'
121
+ end
115
122
 
116
123
  # If forking, don't start worker thread in the master process. Since it's started as a Thread, it won't survive
117
124
  # the fork.
118
125
  def forking?
119
- passenger? or unicorn? or rainbows?
126
+ passenger? or unicorn? or rainbows? or puma?
120
127
  end
121
128
 
122
129
  ### ruby checks
@@ -1,3 +1,3 @@
1
1
  module ScoutApm
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-03 00:00:00.000000000 Z
12
+ date: 2015-08-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Monitors Ruby apps and reports detailed metrics on performance to Scout.
15
15
  email: