newrelic_rpm 3.5.3.24 → 3.5.3.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -907,7 +907,9 @@ module NewRelic
907
907
  # metric cache so we can save the collector some work by
908
908
  # sending integers instead of strings
909
909
  def fill_metric_id_cache(pairs_of_specs_and_ids)
910
- Array(pairs_of_specs_and_ids).each do |metric_spec, metric_id|
910
+ Array(pairs_of_specs_and_ids).each do |metric_spec_hash, metric_id|
911
+ metric_spec = MetricSpec.new(metric_spec_hash['name'],
912
+ metric_spec_hash['scope'])
911
913
  @metric_ids[metric_spec] = metric_id
912
914
  end
913
915
  end
@@ -10,9 +10,13 @@ class NewRelic::MetricSpec
10
10
  # Need a "zero-arg" constructor so it can be instantiated from java (using
11
11
  # jruby) for sending responses to ruby agents from the java collector.
12
12
  #
13
- def initialize(metric_name = '', metric_scope = '')
13
+ def initialize(metric_name = '', metric_scope = nil)
14
14
  self.name = (metric_name || '') && metric_name[LENGTH_RANGE]
15
- self.scope = metric_scope && metric_scope[LENGTH_RANGE]
15
+ if metric_scope
16
+ self.scope = metric_scope && metric_scope[LENGTH_RANGE]
17
+ else
18
+ self.scope = ''
19
+ end
16
20
  end
17
21
 
18
22
  # truncates the name and scope to the MAX_LENGTH
data/newrelic_rpm.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  #-*- coding: utf-8 -*-
2
- # GITSHA: 48916edbed1d5be1a0c97ed151453682df8d81ce
2
+ # GITSHA: 9908a46cb27fea14226e996d91fca5d800aab459
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "newrelic_rpm"
6
- s.version = "3.5.3.24"
6
+ s.version = "3.5.3.25"
7
7
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [ "Jason Clark", "Sam Goldstein", "Jon Guymon" ]
9
- s.date = "2012-12-04"
9
+ s.date = "2012-12-05"
10
10
  s.description = <<-EOS
11
11
  New Relic is a performance management system, developed by New Relic,
12
12
  Inc (http://www.newrelic.com). New Relic provides you with deep
@@ -209,6 +209,17 @@ module NewRelic
209
209
  @agent.expects(:log).never
210
210
  @agent.notify_log_file_location
211
211
  end
212
+
213
+ def test_fill_metric_id_cache_from_collect_response
214
+ response = [[{"scope"=>"Controller/blogs/index", "name"=>"Database/SQL/other"}, 1328],
215
+ [{"scope"=>"", "name"=>"WebFrontend/QueueTime"}, 10],
216
+ [{"scope"=>"", "name"=>"ActiveRecord/Blog/find"}, 1017]]
217
+
218
+ @agent.send(:fill_metric_id_cache, response)
219
+ assert_equal 1328, @agent.metric_ids[MetricSpec.new('Database/SQL/other', 'Controller/blogs/index')]
220
+ assert_equal 10, @agent.metric_ids[MetricSpec.new('WebFrontend/QueueTime')]
221
+ assert_equal 1017, @agent.metric_ids[MetricSpec.new('ActiveRecord/Blog/find')]
222
+ end
212
223
  end
213
224
  end
214
225
  end
@@ -86,12 +86,13 @@ class NewRelic::Agent::RpmAgentTest < Test::Unit::TestCase # ActiveSupport::Test
86
86
  # this test fails due to a rubinius bug
87
87
  return if NewRelic::LanguageSupport.using_engine?('rbx')
88
88
  @agent.service = NewRelic::FakeService.new
89
- @agent.service.expects(:metric_data).returns({ NewRelic::MetricSpec.new("/A/b/c") => 1,
90
- NewRelic::MetricSpec.new("/A/b/c", "/X") => 2,
91
- NewRelic::MetricSpec.new("/A/b/d") => 3 }.to_a)
89
+ @agent.service.expects(:metric_data).returns([ [{'name' => '/A/b/c'}, 1],
90
+ [{'name' => '/A/b/c', 'scope' => '/X'}, 2],
91
+ [{'name' => '/A/b/d'}, 3] ])
92
92
  @agent.send :harvest_and_send_timeslice_data
93
93
  assert_equal 3, @agent.metric_ids.size
94
- assert_equal 3, @agent.metric_ids[NewRelic::MetricSpec.new("/A/b/d") ], @agent.metric_ids.inspect
94
+ assert_equal(3, @agent.metric_ids[NewRelic::MetricSpec.new('/A/b/d')],
95
+ @agent.metric_ids.inspect)
95
96
  end
96
97
  should "set_record_sql" do
97
98
  @agent.set_record_sql(false)
@@ -15,7 +15,7 @@ module NewRelic
15
15
  'get_redirect_host' => [200, {'return_value' => 'localhost'}],
16
16
  'connect' => [200, {'return_value' => {"agent_run_id" => agent_run_id}}],
17
17
  'get_agent_commands' => [200, {'return_value' => []}],
18
- 'metric_data' => [200, {'return_value' => {'Some/Metric/Spec' => 1}}],
18
+ 'metric_data' => [200, {'return_value' => [[{'name' => 'Some/Metric/Spec'}, 1]]}],
19
19
  'sql_trace_data' => [200, {'return_value' => nil}],
20
20
  'transaction_sample_data' => [200, {'return_value' => nil}],
21
21
  'error_data' => [200, {'return_value' => nil}],
@@ -15,7 +15,7 @@ module NewRelic
15
15
  'get_redirect_host' => 'localhost',
16
16
  'connect' => { 'agent_run_id' => agent_run_id },
17
17
  'get_agent_commands' => [],
18
- 'metric_data' => { 'Some/Metric/Spec' => 1 },
18
+ 'metric_data' => [[{ 'name' => 'Some/Metric/Spec' }, 1]],
19
19
  'sql_trace_data' => nil,
20
20
  'transaction_sample_data' => nil,
21
21
  'error_data' => nil,
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: 3.5.3.24
4
+ version: 3.5.3.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-04 00:00:00.000000000 Z
14
+ date: 2012-12-05 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: ! 'New Relic is a performance management system, developed by New Relic,
17
17