newrelic_rpm 3.0.0.beta2 → 3.0.0

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.

@@ -845,6 +845,7 @@ module NewRelic
845
845
 
846
846
  def send_request(opts)
847
847
  request = Net::HTTP::Post.new(opts[:uri], 'CONTENT-ENCODING' => opts[:encoding], 'HOST' => opts[:collector].name)
848
+ request['user-agent'] = user_agent
848
849
  request.content_type = "application/octet-stream"
849
850
  request.body = opts[:data]
850
851
 
@@ -897,6 +898,15 @@ module NewRelic
897
898
  uri
898
899
  end
899
900
 
901
+ def user_agent
902
+ ruby_description = ''
903
+ # note the trailing space!
904
+ ruby_description << "(ruby #{::RUBY_VERSION} #{::RUBY_PLATFORM}) " if defined?(::RUBY_VERSION) && defined?(::RUBY_PLATFORM)
905
+ zlib_version = ''
906
+ zlib_version << "zlib/#{Zlib.zlib_version}" if defined?(::Zlib) && Zlib.respond_to?(:zlib_version)
907
+ "NewRelic-RubyAgent/#{NewRelic::VERSION::STRING} #{ruby_description}#{zlib_version}"
908
+ end
909
+
900
910
  # send a message via post
901
911
  def invoke_remote(method, *args)
902
912
  now = Time.now
@@ -314,7 +314,7 @@ module NewRelic
314
314
  "Custom/#{self.name}/#{method_name.to_s}"
315
315
  end
316
316
 
317
- def method_exists?(method_name)
317
+ def newrelic_method_exists?(method_name)
318
318
  exists = method_defined?(method_name) || private_method_defined?(method_name)
319
319
  NewRelic::Control.instance.log.warn("Did not trace #{self.name}##{method_name} because that method does not exist") unless exists
320
320
  exists
@@ -378,7 +378,7 @@ module NewRelic
378
378
  include AddMethodTracer
379
379
 
380
380
  def add_method_tracer(method_name, metric_name_code=nil, options = {})
381
- return unless method_exists?(method_name)
381
+ return unless newrelic_method_exists?(method_name)
382
382
  metric_name_code ||= default_metric_name_code(method_name)
383
383
  return if traced_method_exists?(method_name, metric_name_code)
384
384
 
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 3
5
5
  MINOR = 0
6
6
  TINY = 0
7
- BUILD = 'beta2' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = nil #'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
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "3.0.0.beta2"
8
+ s.version = "3.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser", "Justin George"]
12
- s.date = %q{2011-05-06}
12
+ s.date = %q{2011-05-11}
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
@@ -38,19 +38,19 @@ module NewRelic
38
38
  assert_equal "Custom/#{name}/test_method", default_metric_name_code('test_method')
39
39
  end
40
40
 
41
- def test_method_exists_positive
41
+ def test_newrelic_method_exists_positive
42
42
  self.expects(:method_defined?).returns(true)
43
- assert method_exists?('test_method')
43
+ assert newrelic_method_exists?('test_method')
44
44
  end
45
45
 
46
- def test_method_exists_negative
46
+ def test_newrelic_method_exists_negative
47
47
  self.expects(:method_defined?).returns(false)
48
48
  self.expects(:private_method_defined?).returns(false)
49
49
 
50
50
  fake_log = mock('log')
51
51
  NewRelic::Control.instance.expects(:log).returns(fake_log)
52
52
  fake_log.expects(:warn).with("Did not trace #{name}#test_method because that method does not exist")
53
- assert !method_exists?('test_method')
53
+ assert !newrelic_method_exists?('test_method')
54
54
  end
55
55
 
56
56
  def test_set_deduct_call_time_based_on_metric_positive
@@ -740,7 +740,7 @@ class NewRelic::Agent::TransactionSamplerTest < Test::Unit::TestCase
740
740
  run_sample_trace
741
741
 
742
742
  slowest = @sampler.harvest(nil, 0)[0]
743
- assert((slowest.duration >= 0.1), "expected sample duration >= 0.1, but was: #{slowest.duration.inspect}")
743
+ assert((slowest.duration >= 0.09), "expected sample duration >= 0.09, but was: #{slowest.duration.inspect}")
744
744
  # this assert is here to make sure the test remains valid
745
745
  assert((slowest.duration <= 0.15), "expected sample duration <= 0.15, but was: #{slowest.duration.inspect}")
746
746
 
@@ -749,7 +749,7 @@ class NewRelic::Agent::TransactionSamplerTest < Test::Unit::TestCase
749
749
  not_as_slow = @sampler.harvest(slowest, 0)[0]
750
750
  assert((not_as_slow == slowest), "Should re-harvest the same transaction since it should be slower than the new transaction - expected #{slowest.inspect} but got #{not_as_slow.inspect}")
751
751
 
752
- run_sample_trace { sleep 0.15 }
752
+ run_sample_trace { sleep 0.16 }
753
753
  new_slowest = @sampler.harvest(slowest, 0)[0]
754
754
  assert((new_slowest != slowest), "Should not harvest the same trace since the new one should be slower")
755
755
  assert((new_slowest.duration >= 0.15), "Slowest duration must be >= 0.15, but was: #{new_slowest.duration.inspect}")
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196423
5
- prerelease: 6
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
- - beta
11
- - 2
12
- version: 3.0.0.beta2
10
+ version: 3.0.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Bill Kayser
@@ -18,7 +16,7 @@ autorequire:
18
16
  bindir: bin
19
17
  cert_chain: []
20
18
 
21
- date: 2011-05-06 00:00:00 -07:00
19
+ date: 2011-05-11 00:00:00 -07:00
22
20
  default_executable:
23
21
  dependencies:
24
22
  - !ruby/object:Gem::Dependency