newrelic_rpm 2.8.6 → 2.8.7

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.

Potentially problematic release.


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

@@ -20,7 +20,8 @@ require 'new_relic/agent/error_collector'
20
20
  require 'set'
21
21
  require 'sync'
22
22
  require 'thread'
23
- require 'resolv'
23
+ require 'resolv'
24
+ require 'timeout'
24
25
 
25
26
 
26
27
  module NewRelic::Agent
@@ -176,7 +176,7 @@ module NewRelic::Agent
176
176
  @identifier = identifier && identifier.to_s
177
177
  if @identifier
178
178
  start_reporting(force)
179
- config.log! "New Relic RPM Agent #{NewRelic::VERSION::STRING} Initialized: pid = #{$$}"
179
+ config.log! "New Relic RPM Agent #{NewRelic::VERSION::STRING} Initialized: pid = #{$$}, handler = #{@environment}"
180
180
  config.log! "Agent Log is found in #{NewRelic::Config.instance.log_file}"
181
181
  return true
182
182
  else
@@ -660,7 +660,6 @@ module NewRelic::Agent
660
660
  # pay a little more CPU.
661
661
  post_data = Zlib::Deflate.deflate(Marshal.dump(args), Zlib::BEST_SPEED)
662
662
  http = config.http_connection
663
- http.read_timeout = @request_timeout
664
663
 
665
664
  # params = {:method => method, :license_key => license_key, :protocol_version => PROTOCOL_VERSION }
666
665
  # uri = "/agent_listener/invoke_raw_method?#{params.to_query}"
@@ -673,7 +672,16 @@ module NewRelic::Agent
673
672
 
674
673
  log.debug "#{uri}"
675
674
 
676
- response = http.request(request)
675
+ response = nil
676
+
677
+ begin
678
+ timeout(@request_timeout) do
679
+ response = http.request(request)
680
+ end
681
+ rescue Timeout::Error
682
+ log.warn "Timed out trying to post data to RPM (timeout = #{@request_timeout} seconds)"
683
+ raise IgnoreSilentlyException
684
+ end
677
685
 
678
686
  if response.is_a? Net::HTTPSuccess
679
687
  body = nil
@@ -66,7 +66,7 @@ class NewRelic::Config::Rails < NewRelic::Config
66
66
  # a webserver process
67
67
  if local_env.identifier
68
68
  port = local_env.identifier.to_s =~ /^\d+/ ? ":#{local_env.identifier}" : ":port"
69
- to_stderr "NewRelic Agent (Developer Mode) enabled."
69
+ to_stderr "NewRelic Agent Developer Mode enabled."
70
70
  to_stderr "To view performance information, go to http://localhost#{port}/newrelic"
71
71
  end
72
72
  end
@@ -14,7 +14,7 @@ module NewRelic
14
14
  # Note: log won't be available yet.
15
15
  @identifier = nil
16
16
  @environment = :unknown
17
- environments = %w[merb jruby webrick mongrel thin litespeed passenger daemon]
17
+ environments = %w[merb jruby webrick thin mongrel litespeed passenger fastcgi daemon]
18
18
  while environments.any? && @identifier.nil?
19
19
  send 'check_for_'+(environments.shift)
20
20
  end
@@ -22,28 +22,45 @@ module NewRelic
22
22
  def to_s
23
23
  "LocalEnvironment[#{environment}:#{identifier}]"
24
24
  end
25
+ def check_for_fastcgi
26
+ return unless defined? FCGI
27
+ @environment = :fastcgi
28
+ @identifier = 'fastcgi'
29
+ end
25
30
  def check_for_merb
26
31
  if config.app == :merb
27
32
  @identifier = 'merb'
28
33
  end
29
34
  end
30
35
  def check_for_webrick
31
- if defined?(OPTIONS) && OPTIONS.respond_to?(:fetch)
36
+ return unless defined?(WEBrick)
37
+ @environment = :webrick
38
+ if defined?(OPTIONS) && ::OPTIONS.respond_to?(:fetch)
32
39
  # OPTIONS is set by script/server
33
40
  @identifier = OPTIONS.fetch(:port)
34
- @environment = :webrick
35
41
  end
42
+ @identifier = default_port unless @identifier
36
43
  end
37
-
38
44
  # this case covers starting by mongrel_rails
39
45
  def check_for_mongrel
40
- if defined? Mongrel::HttpServer
41
- ObjectSpace.each_object(Mongrel::HttpServer) do |mongrel|
42
- next if not mongrel.respond_to? :port
43
- @environment = :mongrel
44
- @identifier = mongrel.port
46
+ return unless defined?(Mongrel::HttpServer)
47
+ @environment = :mongrel
48
+
49
+ # Get the port from the server if it's started
50
+ ObjectSpace.each_object(Mongrel::HttpServer) do |mongrel|
51
+ next if not mongrel.respond_to? :port
52
+ @identifier = mongrel.port.to_s
53
+ end
54
+
55
+ # Get the port from the configurator if one was created
56
+ if @identifier.nil? && defined?(Mongrel::Configurator)
57
+ ObjectSpace.each_object(Mongrel::Configurator) do |mongrel|
58
+ @identifier = mongrel.defaults[:port] && mongrel.defaults[:port].to_s
45
59
  end
46
60
  end
61
+
62
+ # Still can't find the port. Let's look at ARGV to fall back
63
+ @identifier = default_port if @identifier.nil?
47
64
  end
48
65
 
49
66
  def check_for_thin
@@ -104,5 +121,16 @@ module NewRelic
104
121
  def config
105
122
  NewRelic::Config.instance
106
123
  end
124
+
125
+ def default_port
126
+ require 'optparse'
127
+ # If nothing else is found, use the 3000 default
128
+ default_port = 3000
129
+ ARGV.clone.options do |opts|
130
+ opts.on("-p", "--port=port", String) { | default_port | }
131
+ opts.parse!
132
+ end
133
+ default_port
134
+ end
107
135
  end
108
136
  end
@@ -3,7 +3,7 @@ module NewRelic
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 2
5
5
  MINOR = 8
6
- TINY = 6
6
+ TINY = 7
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  def self.changes
9
9
  puts "NewRelic RPM Plugin Version: #{NewRelic::VERSION::STRING}"
@@ -11,6 +11,11 @@ module NewRelic
11
11
  end
12
12
 
13
13
  CHANGELOG = <<EOF
14
+ 2009-03-20 version 2.8.7
15
+ * fix for ssl connection hanging problems
16
+ * fix problem recognizing mongrel in rails 2.3.2
17
+ * fastcgi support in rails 2.3.2
18
+ * put back webrick support
14
19
  2009-03-16 version 2.8.6
15
20
  * fix for capture_params when using file uploads in controller actions
16
21
  * use Resolv::getaddress rather than allowing the default DNS to stall
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.6
4
+ version: 2.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Kayser
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-18 00:00:00 -07:00
12
+ date: 2009-03-23 00:00:00 -07:00
13
13
  default_executable: newrelic_cmd
14
14
  dependencies: []
15
15