newrelic_rpm 2.12.2.beta → 2.12.2.beta2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,6 +1,7 @@
1
1
  v2.12.2
2
2
  * workaround bug found in some rubies that caused a segv and/or NoMemoryError
3
3
  when deflating content for upload
4
+ * avoid creating connection thread in unicorn/passenger spawners
4
5
 
5
6
  v2.12.1
6
7
  * fix bug in profile mode
@@ -74,14 +74,12 @@ module NewRelic
74
74
  @connected == false or
75
75
  @worker_thread && @worker_thread.alive?
76
76
 
77
- log.debug "Detected that the worker thread is not running in #$$. Restarting."
77
+ log.info "Starting the worker thread in #$$ after forking."
78
78
 
79
79
  # Clear out stats that are left over from parent process
80
80
  reset_stats
81
81
 
82
- # Don't ever check to see if this is a spawner. If we're in a forked process
83
- # I'm pretty sure we're not also forking new instances.
84
- start_worker_thread(options.merge(:check_for_spawner => false))
82
+ start_worker_thread(options)
85
83
  @stats_engine.start_sampler_thread
86
84
  end
87
85
 
@@ -165,7 +163,7 @@ module NewRelic
165
163
 
166
164
  # Start up the agent. This verifies that the agent_enabled? is
167
165
  # true and initializes the sampler based on the current
168
- # controluration settings. Then it will fire up the background
166
+ # configuration settings. Then it will fire up the background
169
167
  # thread for sending data to the server if applicable.
170
168
  def start
171
169
  if started?
@@ -208,20 +206,25 @@ module NewRelic
208
206
  # Initialize transaction sampler
209
207
  @transaction_sampler.random_sampling = @random_sample
210
208
 
211
- if control.monitor_mode?
212
- if !control.license_key
213
- control.log! "No license key found. Please edit your newrelic.yml file and insert your license key.", :error
214
- elsif control.license_key.length != 40
215
- control.log! "Invalid license key: #{control.license_key}", :error
216
- else
217
- # Do the connect in the foreground if we are in sync mode
218
- NewRelic::Agent.disable_all_tracing { connect(:keep_retrying => false) } if control.sync_startup
219
-
220
- # Start the event loop and initiate connection if necessary
221
- start_worker_thread
222
-
223
- # Our shutdown handler needs to run after other shutdown handlers
224
- # that may be doing things like running the app (hello sinatra).
209
+ case
210
+ when !control.monitor_mode?
211
+ log.warn "Agent configured not to send data in this environment - edit newrelic.yml to change this"
212
+ when !control.license_key
213
+ log.error "No license key found. Please edit your newrelic.yml file and insert your license key."
214
+ when control.license_key.length != 40
215
+ log.error "Invalid license key: #{control.license_key}"
216
+ when [:passenger, :unicorn].include?(control.dispatcher)
217
+ log.info "Connecting workers after forking."
218
+ else
219
+ # Do the connect in the foreground if we are in sync mode
220
+ NewRelic::Agent.disable_all_tracing { connect(:keep_retrying => false) } if control.sync_startup
221
+
222
+ # Start the event loop and initiate connection if necessary
223
+ start_worker_thread
224
+
225
+ # Our shutdown handler needs to run after other shutdown handlers
226
+ # that may be doing things like running the app (hello sinatra).
227
+ if control.send_data_on_exit
225
228
  if RUBY_VERSION =~ /rubinius/i
226
229
  list = at_exit { shutdown }
227
230
  # move the shutdown handler to the front of the list, to
@@ -348,11 +351,6 @@ module NewRelic
348
351
  # * <tt>force_reconnect => true</tt> if you want to establish a new connection
349
352
  # to the server before running the worker loop. This means you get a separate
350
353
  # agent run and RPM sees it as a separate instance (default is false).
351
- # * <tt>:check_for_spawner => false</tt> to omit the check to see if we are
352
- # an application spawner. We detect the spawner and stop the agent so we don't
353
- # report stats from a spawner. You don't want to do this check if you _know_
354
- # you are not in a spawner (default is true).
355
-
356
354
  def connect(options)
357
355
  # Don't proceed if we already connected (@connected=true) or if we tried
358
356
  # to connect and were rejected with prejudice because of a license issue
@@ -360,7 +358,6 @@ module NewRelic
360
358
  return if !@connected.nil? && !options[:force_reconnect]
361
359
 
362
360
  keep_retrying = options[:keep_retrying].nil? || options[:keep_retrying]
363
- check_for_spawner = options[:check_for_spawner].nil? || options[:check_for_spawner]
364
361
 
365
362
  # wait a few seconds for the web server to boot, necessary in development
366
363
  connect_retry_period = keep_retrying ? 10 : 0
@@ -368,14 +365,6 @@ module NewRelic
368
365
  @agent_id = nil
369
366
  begin
370
367
  sleep connect_retry_period.to_i
371
- # Running in the Passenger or Unicorn spawners?
372
- if check_for_spawner && $0 =~ /ApplicationSpawner|^unicorn\S* master/
373
- log.debug "Process is master spawner (#$0) -- don't connect to RPM service"
374
- @connected = nil
375
- return
376
- else
377
- log.debug "Connecting Process to RPM: #$0"
378
- end
379
368
  environment = control['send_environment_info'] != false ? control.local_env.snapshot : []
380
369
  log.debug "Connecting with validation seed/token: #{control.validate_seed}/#{control.validate_token}" if control.validate_seed
381
370
  @agent_id ||= invoke_remote :start, @local_host, {
@@ -1,26 +1,22 @@
1
1
  if defined?(PhusionPassenger)
2
2
  NewRelic::Agent.logger.debug "Installing Passenger event hooks."
3
-
3
+
4
4
  PhusionPassenger.on_event(:stopping_worker_process) do
5
5
  NewRelic::Agent.logger.debug "Passenger stopping this process, shutdown the agent."
6
6
  NewRelic::Agent.instance.shutdown
7
7
  end
8
-
8
+
9
9
  PhusionPassenger.on_event(:starting_worker_process) do |forked|
10
- if forked
11
- # We want to reset the stats from the stats engine in case any carried
12
- # over into the spawned process. Don't clear them in case any were
13
- # cached.
14
- NewRelic::Agent.after_fork(:force_reconnect => true)
15
- else
16
- # We're in conservative spawning mode. We don't need to do anything.
17
- end
10
+ # We want to reset the stats from the stats engine in case any carried
11
+ # over into the spawned process. Don't clear them in case any were
12
+ # cached. We do this even in conservative spawning.
13
+ NewRelic::Agent.after_fork(:force_reconnect => true)
18
14
  end
19
-
15
+
20
16
  elsif (defined?(::Passenger) && defined?(::Passenger::AbstractServer)) || defined?(::IN_PHUSION_PASSENGER)
21
17
  # We're on an older version of passenger
22
18
  NewRelic::Agent.logger.warn "An older version of Phusion Passenger has been detected. We recommend using at least release 2.1.1."
23
-
19
+
24
20
  NewRelic::Agent::Instrumentation::MetricFrame.check_server_connection = true
25
21
 
26
22
  end
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 2
5
5
  MINOR = 12
6
6
  TINY = 2
7
- BUILD = 'beta' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 'beta2' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
10
10
 
data/newrelic_rpm.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "2.12.2.beta"
8
+ s.version = "2.12.2.beta2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser"]
12
- s.date = %q{2010-05-28}
12
+ s.date = %q{2010-06-07}
13
13
  s.description = %q{New Relic RPM is a Ruby performance management system, developed by
14
14
  New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
15
15
  information about the performance of your Ruby on Rails or Merb
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 2
7
7
  - 12
8
8
  - 2
9
- - beta
10
- version: 2.12.2.beta
9
+ - beta2
10
+ version: 2.12.2.beta2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bill Kayser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-28 00:00:00 -07:00
18
+ date: 2010-06-07 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency