scout_apm 0.1.3 → 0.1.3.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +5 -0
- data/README.markdown +2 -0
- data/lib/scout_apm/agent.rb +16 -3
- data/lib/scout_apm/environment.rb +8 -1
- data/lib/scout_apm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dd9fa6823ce48d2b2b36ae4238cfaa3152bfd08
|
4
|
+
data.tar.gz: c0916b57ea440cedaf275792089bedf20249ffe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d62355ce9a305aa40ecd58722b1c518a1dc2606e06aa3fd1101b73100bded03a48e51c2a2bcc54907f0eb5da5e3444bdb819cc420766e90823cca19f4d7344bc
|
7
|
+
data.tar.gz: 27c9bc33de0af9d4aff82503ad7e3bb1a8fde34a6448fba5ebe61b84f80d2354a517aecf7ddb7fcf48a059193c3027064c7a159223335156dc74a22cee798056
|
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
data/lib/scout_apm/agent.rb
CHANGED
@@ -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
|
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
|
data/lib/scout_apm/version.rb
CHANGED
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-
|
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:
|