scout_apm 0.9.7 → 0.9.8.pre1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fbe19693982b47df3fa964a2325395e90bad24d
4
- data.tar.gz: 7716bd3ba18e6d5878a96167c91a7b378aed41f9
3
+ metadata.gz: 762ca5628e64b9bce6fe92c2f6b8c20dc8a72a8d
4
+ data.tar.gz: 4d44f9031d323ed77e6bb41a0bde90dd8886d1f4
5
5
  SHA512:
6
- metadata.gz: 84cc9ce20d82be3291f00e371858ffafcf09a4c40fdbd186836985b9b68ebc17bdf9a7f722ff36902bc72b0f1c5f7b92e6fee7ab063180aee59f463ae403775b
7
- data.tar.gz: 0a5863f1be563fcf7c5a6e0611bf38a209968b6122034d88933417b50583572504019dc91f8bceddf893b01d03056b9b8bd3f99c42818e6f1b33e759bdd846c0
6
+ metadata.gz: ea5bdc27aade86543d95fe6bd542508fbf1e4ade054a245fe78e2b3b5fa7cd340d8d0d680344dc5baf3a75358a4afd23e54c55f44ba72af4ea3148e524a4db47
7
+ data.tar.gz: 4a1e4ffb4fa3e023e5bbdd194a3a1577c519da5ef6c3df9d4d524034443138e33373a7bbb3ebae0413897e392609f2c44c84756ddb00016372e2e77a4bafbcc1
@@ -2,7 +2,6 @@
2
2
  module ScoutApm
3
3
  class Agent
4
4
  module Logging
5
-
6
5
  def default_log_path
7
6
  "#{environment.root}/log"
8
7
  end
@@ -49,9 +48,10 @@ module ScoutApm
49
48
  end
50
49
 
51
50
  def wants_stdout?
52
- config.value('log_file_path').to_s.upcase == 'STDOUT' || environment.heroku?
51
+ config.value('log_file_path').to_s.upcase == 'STDOUT' || environment.platform_integration.log_to_stdout?
53
52
  end
54
- end # module Logging
53
+ end
55
54
  include Logging
56
- end # class Agent
57
- end # moudle ScoutApm
55
+ end
56
+ end
57
+
@@ -94,7 +94,7 @@ module ScoutApm
94
94
 
95
95
  logger.info "Starting monitoring for [#{environment.application_name}]. Framework [#{environment.framework}] App Server [#{environment.app_server}]."
96
96
 
97
- load_instruments if should_load_instruments?
97
+ load_instruments if should_load_instruments?(options)
98
98
 
99
99
  @samplers = [
100
100
  ScoutApm::Instruments::Process::ProcessCpu.new(environment.processors, logger),
@@ -177,7 +177,9 @@ module ScoutApm
177
177
  end
178
178
  end
179
179
 
180
- def should_load_instruments?
180
+ # If we want to skip the app_server_check, then we must load it.
181
+ def should_load_instruments?(options={})
182
+ return true if options[:skip_app_server_check]
181
183
  environment.app_server_integration.found?
182
184
  end
183
185
 
@@ -37,7 +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.paas
40
+ :paas => ScoutApm::Environment.instance.platform_integration.name
41
41
  }
42
42
  end
43
43
  end
@@ -7,6 +7,7 @@ require 'scout_apm/environment'
7
7
  #
8
8
  # application_root - override the detected directory of the application
9
9
  # data_file - override the default temporary storage location. Must be a location in a writable directory
10
+ # hostname - override the default hostname detection. Default varies by environment - either system hostname, or PAAS hostname
10
11
  # key - the account key with Scout APM. Found in Settings in the Web UI
11
12
  # log_file_path - either a directory or "STDOUT".
12
13
  # log_level - DEBUG / INFO / WARN as usual
@@ -21,7 +22,6 @@ module ScoutApm
21
22
  DEFAULTS = {
22
23
  'host' => 'https://checkin.scoutapp.com',
23
24
  'log_level' => 'info',
24
- 'hostname' => Socket.gethostname,
25
25
  'stackprof_interval' => 20000 # microseconds, 1000 = 1 millisecond, so 20k == 20 milliseconds
26
26
  }.freeze
27
27
 
@@ -5,14 +5,14 @@ module ScoutApm
5
5
  class Environment
6
6
  include Singleton
7
7
 
8
- # I've put Thin and Webrick last as they are often used in development and included in Gemfiles
9
- # but less likely used in production.
10
8
  STDOUT_LOGGER = begin
11
9
  l = Logger.new(STDOUT)
12
10
  l.level = ENV["SCOUT_LOG_LEVEL"] || Logger::INFO
13
11
  l
14
12
  end
15
13
 
14
+ # I've put Thin and Webrick last as they are often used in development and included in Gemfiles
15
+ # but less likely used in production.
16
16
  SERVER_INTEGRATIONS = [
17
17
  ScoutApm::ServerIntegrations::Passenger.new(STDOUT_LOGGER),
18
18
  ScoutApm::ServerIntegrations::Unicorn.new(STDOUT_LOGGER),
@@ -30,6 +30,12 @@ module ScoutApm
30
30
  ScoutApm::FrameworkIntegrations::Ruby.new, # Fallback if none match
31
31
  ]
32
32
 
33
+ PLATFORM_INTEGRATIONS = [
34
+ ScoutApm::PlatformIntegrations::Heroku.new,
35
+ ScoutApm::PlatformIntegrations::CloudFoundry.new,
36
+ ScoutApm::PlatformIntegrations::Server.new,
37
+ ]
38
+
33
39
  DEPLOY_INTEGRATIONS = [
34
40
  ScoutApm::DeployIntegrations::Capistrano3.new(STDOUT_LOGGER),
35
41
  # ScoutApm::DeployIntegrations::Capistrano2.new(STDOUT_LOGGER),
@@ -47,6 +53,10 @@ module ScoutApm
47
53
  @framework ||= FRAMEWORK_INTEGRATIONS.detect{ |integration| integration.present? }
48
54
  end
49
55
 
56
+ def platform_integration
57
+ @platform ||= PLATFORM_INTEGRATIONS.detect{ |integration| integration.present? }
58
+ end
59
+
50
60
  def application_name
51
61
  Agent.instance.config.value("name") || framework_integration.application_name
52
62
  end
@@ -88,27 +98,10 @@ module ScoutApm
88
98
  end
89
99
  end
90
100
 
91
- def heroku?
92
- ENV['DYNO']
93
- end
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
-
107
101
  def hostname
108
- @hostname ||= heroku? ? ENV['DYNO'] : Agent.instance.config.value("hostname")
102
+ @hostname ||= Agent.instance.config.value("hostname") || platform_integration.hostname
109
103
  end
110
104
 
111
-
112
105
  # Returns the whole integration object
113
106
  # This needs to be improved. Frequently, multiple app servers gem are present and which
114
107
  # ever is checked first becomes the designated app server.
@@ -0,0 +1,23 @@
1
+ module ScoutApm
2
+ module PlatformIntegrations
3
+ class CloudFoundry
4
+ def present?
5
+ !! ENV['VCAP_APPLICATION']
6
+ end
7
+
8
+ def name
9
+ "Cloud Foundry"
10
+ end
11
+
12
+ # TODO: Which is easier for users by defualt? STDOUT or our log/scout_apm.log file?
13
+ def log_to_stdout?
14
+ true
15
+ end
16
+
17
+ # TODO: Is there a better way to get a hostname from Cloud Foundry?
18
+ def hostname
19
+ Socket.gethostname
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ module ScoutApm
2
+ module PlatformIntegrations
3
+ class Heroku
4
+ def present?
5
+ !! ENV['DYNO']
6
+ end
7
+
8
+ def name
9
+ "Heroku"
10
+ end
11
+
12
+ def log_to_stdout?
13
+ true
14
+ end
15
+
16
+ def hostname
17
+ ENV['DYNO']
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ # Classic hosting where you rent a server, then put your app on it.
2
+ # Used as fallback
3
+
4
+ module ScoutApm
5
+ module PlatformIntegrations
6
+ class Server
7
+ def present?
8
+ true
9
+ end
10
+
11
+ def name
12
+ "Server"
13
+ end
14
+
15
+ def log_to_stdout?
16
+ false
17
+ end
18
+
19
+ def hostname
20
+ Socket.gethostname
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8.pre1"
3
3
  end
4
4
 
data/lib/scout_apm.rb CHANGED
@@ -40,6 +40,10 @@ require 'scout_apm/framework_integrations/rails_3_or_4'
40
40
  require 'scout_apm/framework_integrations/sinatra'
41
41
  require 'scout_apm/framework_integrations/ruby'
42
42
 
43
+ require 'scout_apm/platform_integrations/heroku'
44
+ require 'scout_apm/platform_integrations/cloud_foundry'
45
+ require 'scout_apm/platform_integrations/server'
46
+
43
47
  require 'scout_apm/deploy_integrations/capistrano_3'
44
48
  #require 'scout_apm/deploy_integrations/capistrano_2'
45
49
 
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.7
4
+ version: 0.9.8.pre1
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-11-10 00:00:00.000000000 Z
12
+ date: 2015-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -98,6 +98,9 @@ files:
98
98
  - lib/scout_apm/metric_meta.rb
99
99
  - lib/scout_apm/metric_stats.rb
100
100
  - lib/scout_apm/middleware.rb
101
+ - lib/scout_apm/platform_integrations/cloud_foundry.rb
102
+ - lib/scout_apm/platform_integrations/heroku.rb
103
+ - lib/scout_apm/platform_integrations/server.rb
101
104
  - lib/scout_apm/reporter.rb
102
105
  - lib/scout_apm/serializers/app_server_load_serializer.rb
103
106
  - lib/scout_apm/serializers/deploy_serializer.rb
@@ -146,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
149
  version: '0'
147
150
  required_rubygems_version: !ruby/object:Gem::Requirement
148
151
  requirements:
149
- - - ">="
152
+ - - ">"
150
153
  - !ruby/object:Gem::Version
151
- version: '0'
154
+ version: 1.3.1
152
155
  requirements: []
153
156
  rubyforge_project: scout_apm
154
157
  rubygems_version: 2.2.2