newrelic_rpm 2.8.5 → 2.8.6

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.

@@ -20,6 +20,8 @@ require 'new_relic/agent/error_collector'
20
20
  require 'set'
21
21
  require 'sync'
22
22
  require 'thread'
23
+ require 'resolv'
24
+
23
25
 
24
26
  module NewRelic::Agent
25
27
 
@@ -15,17 +15,8 @@ module NewRelic::Agent::CollectionHelper
15
15
  new_params[truncate(normalize_params(key),32)] = normalize_params(value)
16
16
  end
17
17
  new_params
18
- when Enumerable
19
- # We only want the first 20 values of any enumerable. Invoking to_a.first(20) works but
20
- # the to_a call might be expensive, so we'll just build it manually, even though it's
21
- # more verbose.
22
- new_values = []
23
- count = 1
24
- params.each do | item |
25
- new_values << normalize_params(item)
26
- break if (count += 1) > 20
27
- end
28
- new_values
18
+ when Array
19
+ params.first(20).map{|item| normalize_params(item)}
29
20
  else
30
21
  truncate(flatten(params))
31
22
  end
@@ -97,7 +97,7 @@ module NewRelic
97
97
 
98
98
  def server
99
99
  @remote_server ||=
100
- NewRelic::Config::Server.new fetch('host', 'collector.newrelic.com'), fetch('port', use_ssl? ? 443 : 80).to_i
100
+ NewRelic::Config::Server.new convert_to_ip_address(fetch('host', 'collector.newrelic.com')), fetch('port', use_ssl? ? 443 : 80).to_i
101
101
  end
102
102
 
103
103
  def api_server
@@ -107,9 +107,10 @@ module NewRelic
107
107
 
108
108
  def proxy_server
109
109
  @proxy_server ||=
110
- NewRelic::Config::ProxyServer.new fetch('proxy_host', nil), fetch('proxy_port', nil),
110
+ NewRelic::Config::ProxyServer.new convert_to_ip_address(fetch('proxy_host', nil)), fetch('proxy_port', nil),
111
111
  fetch('proxy_user', nil), fetch('proxy_pass', nil)
112
- end
112
+ end
113
+
113
114
 
114
115
  # Return the Net::HTTP with proxy configuration given the NewRelic::Config::Server object.
115
116
  # Default is the collector but for api calls you need to pass api_server
@@ -176,6 +177,24 @@ module NewRelic
176
177
  end
177
178
 
178
179
  protected
180
+
181
+ def convert_to_ip_address(host)
182
+ return nil unless host
183
+ if host.downcase == "localhost"
184
+ ip_address = host
185
+ else
186
+ begin
187
+ ip_address = Resolv.getaddress(host)
188
+ rescue => e
189
+ log.error "DNS Error: #{e}"
190
+ raise NewRelic::Agent::IgnoreSilentlyException.new
191
+ end
192
+ end
193
+
194
+ log.info "Resolved #{host} to #{ip_address}"
195
+ ip_address
196
+ end
197
+
179
198
  # Collect miscellaneous interesting info about the environment
180
199
  # Called when the agent is started
181
200
  def gather_info
@@ -3,7 +3,7 @@ module NewRelic
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 2
5
5
  MINOR = 8
6
- TINY = 5
6
+ TINY = 6
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,10 @@ module NewRelic
11
11
  end
12
12
 
13
13
  CHANGELOG = <<EOF
14
+ 2009-03-16 version 2.8.6
15
+ * fix for capture_params when using file uploads in controller actions
16
+ * use Resolv::getaddress rather than allowing the default DNS to stall
17
+ the VM
14
18
  2009-02-22 version 2.8.5
15
19
  * fix reference to CommandError which was breaking some cap scripts
16
20
  * fix incompatibility with Rails 2.0 in the server API
@@ -80,9 +80,17 @@ class NewRelic::Agent::CollectionHelperTests < Test::Unit::TestCase
80
80
  custom_params = { :one => {:hash => { :a => :b}, :myenum => e }}
81
81
  nh = normalize_params(custom_params)
82
82
  myenum = nh[:one][:myenum]
83
- assert_equal ["1"], myenum
83
+ assert_match /MyEnumerable/, myenum
84
84
  end
85
85
 
86
+ def test_stringio
87
+ # make sure stringios aren't affected
88
+ s = StringIO.new "start" + ("foo bar bat " * 1000)
89
+ v = normalize_params({ :foo => s })
90
+ val = ""
91
+ s.each { | val | break }
92
+ assert_match /^startfoo bar/, val
93
+ end
86
94
 
87
95
  def test_object
88
96
  assert_equal ["foo", '#<OpenStruct z="q">'], normalize_params(['foo', OpenStruct.new('z'=>'q')])
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.5
4
+ version: 2.8.6
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-04 00:00:00 -08:00
12
+ date: 2009-03-18 00:00:00 -07:00
13
13
  default_executable: newrelic_cmd
14
14
  dependencies: []
15
15