scout_apm 0.9.6 → 0.9.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +6 -0
- data/lib/scout_apm.rb +9 -1
- data/lib/scout_apm/agent.rb +3 -3
- data/lib/scout_apm/app_server_load.rb +1 -0
- data/lib/scout_apm/config.rb +1 -0
- data/lib/scout_apm/environment.rb +16 -3
- data/lib/scout_apm/middleware.rb +16 -0
- data/lib/scout_apm/server_integrations/webrick.rb +2 -0
- data/lib/scout_apm/version.rb +1 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98536a2a26a3dcd0f508a214ff53710d434787ac
|
4
|
+
data.tar.gz: fd7667d714f25b323c5e05d76ef358f8cbcebf01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e27f3d446948abc9683e773ae753d0bc22e84035f5e23edf3b934e68e46eb0c3864f8b90359d226ccd4c2600f0b935333d388f78f3963463ceb204179e19661d
|
7
|
+
data.tar.gz: 4d6f0bee9eb790d984e1a54dbbfc395120b12c4fb0a8e1dae339bd39a6f8d44790024828cdc7d23462a2b9d1cae154f4779608ecc9ddf1631aff8c0ba4b33f30
|
data/CHANGELOG.markdown
CHANGED
data/lib/scout_apm.rb
CHANGED
@@ -85,11 +85,19 @@ require 'scout_apm/serializers/directive_serializer'
|
|
85
85
|
require 'scout_apm/serializers/app_server_load_serializer'
|
86
86
|
require 'scout_apm/serializers/deploy_serializer'
|
87
87
|
|
88
|
-
|
88
|
+
require 'scout_apm/middleware'
|
89
|
+
|
90
|
+
if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR >= 3
|
89
91
|
module ScoutApm
|
90
92
|
class Railtie < Rails::Railtie
|
91
93
|
initializer "scout_apm.start" do |app|
|
94
|
+
# Attempt to start right away, this will work best for preloading apps, Unicorn & Puma & similar
|
92
95
|
ScoutApm::Agent.instance.start
|
96
|
+
|
97
|
+
# And attempt to start on first-request, which is a good catch-all for
|
98
|
+
# Webrick, and Passenger and similar, where we can't detect the running app server
|
99
|
+
# until actual requests come in.
|
100
|
+
app.middleware.use ScoutApm::Middleware
|
93
101
|
end
|
94
102
|
end
|
95
103
|
end
|
data/lib/scout_apm/agent.rb
CHANGED
@@ -47,7 +47,7 @@ module ScoutApm
|
|
47
47
|
config.value('monitor') and !@options[:force]
|
48
48
|
end
|
49
49
|
|
50
|
-
def preconditions_met?
|
50
|
+
def preconditions_met?(options={})
|
51
51
|
if !apm_enabled?
|
52
52
|
logger.warn "Monitoring isn't enabled for the [#{environment.env}] environment."
|
53
53
|
return false
|
@@ -58,7 +58,7 @@ module ScoutApm
|
|
58
58
|
return false
|
59
59
|
end
|
60
60
|
|
61
|
-
if !environment.app_server_integration.found?
|
61
|
+
if !environment.app_server_integration(true).found? && !options[:skip_app_server_check]
|
62
62
|
logger.warn "Couldn't find a supported app server. Not starting agent."
|
63
63
|
return false
|
64
64
|
end
|
@@ -88,7 +88,7 @@ module ScoutApm
|
|
88
88
|
return environment.deploy_integration.install
|
89
89
|
end
|
90
90
|
|
91
|
-
return false unless preconditions_met?
|
91
|
+
return false unless preconditions_met?(options)
|
92
92
|
|
93
93
|
@started = true
|
94
94
|
|
@@ -37,6 +37,7 @@ module ScoutApm
|
|
37
37
|
:database_engine => ScoutApm::Environment.instance.database_engine,
|
38
38
|
:application_name => ScoutApm::Environment.instance.application_name,
|
39
39
|
:libraries => ScoutApm::Utils::InstalledGems.new.run,
|
40
|
+
:paas => ScoutApm::Environment.instance.pass
|
40
41
|
}
|
41
42
|
end
|
42
43
|
end
|
data/lib/scout_apm/config.rb
CHANGED
@@ -92,8 +92,20 @@ module ScoutApm
|
|
92
92
|
ENV['DYNO']
|
93
93
|
end
|
94
94
|
|
95
|
+
def cloud_foundry?
|
96
|
+
ENV['VCAP_APPLICATION']
|
97
|
+
end
|
98
|
+
|
99
|
+
def paas
|
100
|
+
if heroku?
|
101
|
+
'Heroku'
|
102
|
+
elsif cloud_foundry?
|
103
|
+
'Cloud Foundry'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
95
107
|
def hostname
|
96
|
-
@hostname ||= heroku? ? ENV['DYNO'] :
|
108
|
+
@hostname ||= heroku? ? ENV['DYNO'] : Agent.instance.config.value("hostname")
|
97
109
|
end
|
98
110
|
|
99
111
|
|
@@ -102,8 +114,9 @@ module ScoutApm
|
|
102
114
|
# ever is checked first becomes the designated app server.
|
103
115
|
#
|
104
116
|
# Next step: (1) list out all detected app servers (2) install hooks for those that need it (passenger, rainbows, unicorn).
|
105
|
-
def app_server_integration
|
106
|
-
@app_server =
|
117
|
+
def app_server_integration(force=false)
|
118
|
+
@app_server = nil if force
|
119
|
+
@app_server ||= SERVER_INTEGRATIONS.detect{ |integration| integration.present? }
|
107
120
|
end
|
108
121
|
|
109
122
|
# App server's name (symbol)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ScoutApm
|
2
|
+
class Middleware
|
3
|
+
def initialize(app)
|
4
|
+
@app = app
|
5
|
+
@started = false
|
6
|
+
end
|
7
|
+
|
8
|
+
# If we get a web request in, then we know we're running in some sort of app server
|
9
|
+
def call(env)
|
10
|
+
ScoutApm::Agent.instance.start(:skip_app_server_check => true) unless @started
|
11
|
+
|
12
|
+
@started = true
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
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.9.
|
4
|
+
version: 0.9.7.pre
|
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-
|
12
|
+
date: 2015-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/scout_apm/layaway_file.rb
|
98
98
|
- lib/scout_apm/metric_meta.rb
|
99
99
|
- lib/scout_apm/metric_stats.rb
|
100
|
+
- lib/scout_apm/middleware.rb
|
100
101
|
- lib/scout_apm/reporter.rb
|
101
102
|
- lib/scout_apm/serializers/app_server_load_serializer.rb
|
102
103
|
- lib/scout_apm/serializers/deploy_serializer.rb
|
@@ -145,14 +146,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
148
|
requirements:
|
148
|
-
- - "
|
149
|
+
- - ">"
|
149
150
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
151
|
+
version: 1.3.1
|
151
152
|
requirements: []
|
152
153
|
rubyforge_project: scout_apm
|
153
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.4.8
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
157
|
summary: Ruby application performance monitoring
|
157
|
-
test_files:
|
158
|
-
|
158
|
+
test_files:
|
159
|
+
- test/data/config_test_1.yml
|
160
|
+
- test/test_helper.rb
|
161
|
+
- test/unit/config_test.rb
|
162
|
+
- test/unit/environment_test.rb
|
163
|
+
- test/unit/instruments/active_record_instruments_test.rb
|
164
|
+
- test/unit/sql_sanitizer_test.rb
|