newrelic_rpm 3.14.1.311 → 3.14.2.312
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +174 -11
- data/CHANGELOG +22 -0
- data/Rakefile +5 -0
- data/lib/new_relic/agent/agent.rb +22 -7
- data/lib/new_relic/agent/aws_info.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +19 -44
- data/lib/new_relic/agent/error_event_aggregator.rb +11 -103
- data/lib/new_relic/agent/event_aggregator.rb +130 -0
- data/lib/new_relic/agent/event_buffer.rb +7 -0
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +18 -2
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +12 -4
- data/lib/new_relic/agent/new_relic_service.rb +6 -4
- data/lib/new_relic/agent/sampled_buffer.rb +9 -6
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +1 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +2 -1
- data/lib/new_relic/agent/supported_versions.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +52 -0
- data/lib/new_relic/agent/synthetics_event_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction.rb +14 -7
- data/lib/new_relic/agent/transaction/request_attributes.rb +7 -2
- data/lib/new_relic/agent/transaction_error_primitive.rb +72 -0
- data/lib/new_relic/agent/transaction_event_aggregator.rb +33 -210
- data/lib/new_relic/agent/transaction_event_primitive.rb +106 -0
- data/lib/new_relic/agent/transaction_event_recorder.rb +48 -0
- data/lib/new_relic/agent/transaction_metrics.rb +9 -1
- data/lib/new_relic/agent/transction_event_recorder.rb +35 -0
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/versions.html.erb +13 -11
- data/lib/tasks/versions.postface.html +8 -0
- data/lib/tasks/versions.preface.html +3 -0
- data/lib/tasks/versions.rake +15 -5
- data/test/agent_helper.rb +1 -1
- data/test/environments/rails31/Gemfile +2 -0
- data/test/environments/rails32/Gemfile +2 -0
- data/test/environments/rails32/Rakefile +2 -1
- data/test/environments/rails32/config/database.yml +1 -6
- data/test/multiverse/suites/active_record/Envfile +1 -0
- data/test/multiverse/suites/agent_only/agent_attributes_test.rb +18 -0
- data/test/multiverse/suites/agent_only/custom_analytics_events_test.rb +21 -6
- data/test/multiverse/suites/agent_only/error_events_test.rb +14 -6
- data/test/multiverse/suites/agent_only/transaction_events_test.rb +31 -0
- data/test/multiverse/suites/agent_only/utilization_data_collection_test.rb +2 -0
- data/test/multiverse/suites/capistrano/Envfile +9 -3
- data/test/multiverse/suites/capistrano2/Envfile +4 -0
- data/test/multiverse/suites/config_file_loading/Envfile +1 -1
- data/test/multiverse/suites/curb/Envfile +1 -1
- data/test/multiverse/suites/datamapper/Envfile +3 -0
- data/test/multiverse/suites/deferred_instrumentation/sinatra_test.rb +7 -3
- data/test/multiverse/suites/grape/grape_test.rb +2 -0
- data/test/multiverse/suites/padrino/Envfile +4 -3
- data/test/multiverse/suites/padrino/config/newrelic.yml +2 -0
- data/test/multiverse/suites/rack/config/newrelic.yml +18 -0
- data/test/multiverse/suites/rack/nested_non_rack_app_test.rb +1 -1
- data/test/multiverse/suites/rack/puma_rack_builder_test.rb +17 -14
- data/test/multiverse/suites/rack/rack_auto_instrumentation_test.rb +16 -13
- data/test/multiverse/suites/rack/rack_unsupported_version_test.rb +1 -1
- data/test/multiverse/suites/rails/Envfile +5 -0
- data/test/multiverse/suites/rails/parameter_capture_test.rb +9 -0
- data/test/multiverse/suites/rake/Envfile +2 -1
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +1 -1
- data/test/multiverse/suites/sidekiq/Envfile +18 -0
- data/test/multiverse/suites/sidekiq/sidekiq_instrumentation_test.rb +11 -10
- data/test/multiverse/suites/sidekiq/test_model.rb +12 -0
- data/test/multiverse/suites/sinatra/ignoring_test.rb +43 -25
- data/test/multiverse/suites/sinatra/nested_middleware_test.rb +10 -2
- data/test/multiverse/suites/sinatra/sinatra_classic_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +8 -2
- data/test/multiverse/suites/sinatra/sinatra_modular_test.rb +4 -0
- data/test/multiverse/suites/sinatra/sinatra_parameter_capture_test.rb +2 -0
- data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +79 -10
- data/test/new_relic/agent/agent_test.rb +3 -3
- data/test/new_relic/agent/aws_info_test.rb +1 -2
- data/test/new_relic/agent/configuration/orphan_configuration_test.rb +2 -0
- data/test/new_relic/agent/custom_event_aggregator_test.rb +43 -4
- data/test/new_relic/agent/error_collector_test.rb +1 -1
- data/test/new_relic/agent/error_event_aggregator_test.rb +13 -81
- data/test/new_relic/agent/event_aggregator_test.rb +178 -0
- data/test/new_relic/agent/event_buffer_test_cases.rb +16 -0
- data/test/new_relic/agent/instrumentation/sinatra/transaction_namer_test.rb +7 -0
- data/test/new_relic/agent/new_relic_service_test.rb +7 -1
- data/test/new_relic/agent/pipe_channel_manager_test.rb +45 -3
- data/test/new_relic/agent/rpm_agent_test.rb +1 -0
- data/test/new_relic/agent/stats_engine/stats_hash_test.rb +2 -2
- data/test/new_relic/agent/synthetics_event_aggregator_test.rb +179 -0
- data/test/new_relic/agent/transaction/request_attributes_test.rb +8 -0
- data/test/new_relic/agent/transaction_error_primitive_test.rb +117 -0
- data/test/new_relic/agent/transaction_event_aggregator_test.rb +148 -374
- data/test/new_relic/agent/transaction_event_primitive_test.rb +195 -0
- data/test/new_relic/agent/transaction_event_recorder_test.rb +80 -0
- data/test/new_relic/agent/transaction_metrics_test.rb +7 -7
- data/test/new_relic/agent/transaction_test.rb +4 -4
- data/test/new_relic/agent/utilization_data_test.rb +7 -7
- data/test/new_relic/fake_collector.rb +10 -17
- data/test/new_relic/license_test.rb +2 -0
- data/test/new_relic/marshalling_test_cases.rb +1 -1
- data/test/nullverse/default_source_require_test.rb +21 -0
- data/test/nullverse/nullverse_helper.rb +10 -0
- data/test/performance/suites/active_record.rb +1 -1
- data/test/performance/suites/sql_obfuscation.rb +7 -6
- data/test/script/ci.sh +10 -165
- data/test/script/install_mongodb.sh +6 -0
- metadata +21 -6
- data/test/script/build_test_gem.sh +0 -57
- data/test/script/ci_agent-tests_runner.sh +0 -82
- data/test/script/ci_bench.sh +0 -52
- data/test/script/ci_multiverse_runner.sh +0 -63
@@ -0,0 +1,195 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
|
+
require 'new_relic/agent/attribute_filter'
|
7
|
+
require 'new_relic/agent/transaction/attributes'
|
8
|
+
require 'new_relic/agent/transaction_event_primitive'
|
9
|
+
|
10
|
+
module NewRelic
|
11
|
+
module Agent
|
12
|
+
class TransactionEventPrimitiveTest < Minitest::Test
|
13
|
+
def setup
|
14
|
+
freeze_time
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_creates_intrinsics
|
18
|
+
intrinsics, *_ = TransactionEventPrimitive.create generate_payload
|
19
|
+
|
20
|
+
assert_equal "Transaction", intrinsics['type']
|
21
|
+
assert_in_delta Time.now.to_f, intrinsics['timestamp'], 0.001
|
22
|
+
assert_equal "Controller/whatever", intrinsics['name']
|
23
|
+
assert_equal false, intrinsics['error']
|
24
|
+
assert_equal 0.1, intrinsics['duration']
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_event_includes_synthetics
|
28
|
+
payload = generate_payload 'whatever', {
|
29
|
+
:synthetics_resource_id=>3,
|
30
|
+
:synthetics_job_id=>4,
|
31
|
+
:synthetics_monitor_id=>5
|
32
|
+
}
|
33
|
+
|
34
|
+
intrinsics, *_ = TransactionEventPrimitive.create payload
|
35
|
+
|
36
|
+
assert_equal '3', intrinsics['nr.syntheticsResourceId']
|
37
|
+
assert_equal '4', intrinsics['nr.syntheticsJobId']
|
38
|
+
assert_equal '5', intrinsics['nr.syntheticsMonitorId']
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_custom_attributes_in_event_are_normalized_to_string_keys
|
42
|
+
attributes.merge_custom_attributes(:bing => 2, 1 => 3)
|
43
|
+
_, custom_attributes, _ = TransactionEventPrimitive.create generate_payload('whatever')
|
44
|
+
|
45
|
+
assert_equal 2, custom_attributes['bing']
|
46
|
+
assert_equal 3, custom_attributes['1']
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_agent_attributes_in_event_are_normalized_to_string_keys
|
50
|
+
attributes.add_agent_attribute(:yahoo, 7, NewRelic::Agent::AttributeFilter::DST_ALL)
|
51
|
+
attributes.add_agent_attribute(4, 2, NewRelic::Agent::AttributeFilter::DST_ALL)
|
52
|
+
_, _, agent_attrs = TransactionEventPrimitive.create generate_payload('puce')
|
53
|
+
|
54
|
+
assert_equal 7, agent_attrs[:yahoo]
|
55
|
+
assert_equal 2, agent_attrs[4]
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_error_is_included_in_event_data
|
59
|
+
event_data, *_ = TransactionEventPrimitive.create generate_payload('whatever', :error => true)
|
60
|
+
|
61
|
+
assert event_data['error']
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_includes_custom_attributes_in_event
|
65
|
+
attributes.merge_custom_attributes('bing' => 2)
|
66
|
+
_, custom_attrs, _ = TransactionEventPrimitive.create generate_payload
|
67
|
+
assert_equal 2, custom_attrs['bing']
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_includes_agent_attributes_in_event
|
71
|
+
attributes.add_agent_attribute('bing', 2, NewRelic::Agent::AttributeFilter::DST_ALL)
|
72
|
+
|
73
|
+
_, _, agent_attrs = TransactionEventPrimitive.create generate_payload
|
74
|
+
assert_equal 2, agent_attrs['bing']
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_doesnt_include_custom_attributes_in_event_when_configured_not_to
|
78
|
+
with_config('transaction_events.attributes.enabled' => false) do
|
79
|
+
attributes.merge_custom_attributes('bing' => 2)
|
80
|
+
_, custom_attrs, _ = TransactionEventPrimitive.create generate_payload
|
81
|
+
assert_empty custom_attrs
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_doesnt_include_agent_attributes_in_event_when_configured_not_to
|
86
|
+
with_config('transaction_events.attributes.enabled' => false) do
|
87
|
+
attributes.add_agent_attribute('bing', 2, NewRelic::Agent::AttributeFilter::DST_ALL)
|
88
|
+
|
89
|
+
_, _, agent_attrs = TransactionEventPrimitive.create generate_payload
|
90
|
+
assert_empty agent_attrs
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_doesnt_include_custom_attributes_in_event_when_configured_not_to_with_legacy_setting
|
95
|
+
with_config('analytics_events.capture_attributes' => false) do
|
96
|
+
attributes.merge_custom_attributes('bing' => 2)
|
97
|
+
|
98
|
+
_, custom_attrs, _ = TransactionEventPrimitive.create generate_payload
|
99
|
+
assert_empty custom_attrs
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_doesnt_include_agent_attributes_in_event_when_configured_not_to_with_legacy_setting
|
104
|
+
with_config('analytics_events.capture_attributes' => false) do
|
105
|
+
attributes.add_agent_attribute('bing', 2, NewRelic::Agent::AttributeFilter::DST_ALL)
|
106
|
+
|
107
|
+
_, _, agent_attrs = TransactionEventPrimitive.create generate_payload
|
108
|
+
assert_empty agent_attrs
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_custom_attributes_in_event_cant_override_reserved_attributes
|
113
|
+
metrics = NewRelic::Agent::TransactionMetrics.new()
|
114
|
+
metrics.record_unscoped('HttpDispatcher', 0.01)
|
115
|
+
|
116
|
+
attributes.merge_custom_attributes('type' => 'giraffe', 'duration' => 'hippo')
|
117
|
+
event, custom_attrs, _ = TransactionEventPrimitive.create generate_payload('whatever', :metrics => metrics)
|
118
|
+
|
119
|
+
assert_equal 'Transaction', event['type']
|
120
|
+
assert_equal 0.1, event['duration']
|
121
|
+
|
122
|
+
assert_equal 'giraffe', custom_attrs['type']
|
123
|
+
assert_equal 'hippo', custom_attrs['duration']
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_samples_on_transaction_finished_event_includes_expected_web_metrics
|
127
|
+
txn_metrics = NewRelic::Agent::TransactionMetrics.new
|
128
|
+
txn_metrics.record_unscoped('WebFrontend/QueueTime', 13)
|
129
|
+
txn_metrics.record_unscoped('External/allWeb', 14)
|
130
|
+
txn_metrics.record_unscoped('Datastore/all', 15)
|
131
|
+
txn_metrics.record_unscoped("GC/Transaction/all", 16)
|
132
|
+
|
133
|
+
event_data, *_ = TransactionEventPrimitive.create generate_payload('name', :metrics => txn_metrics)
|
134
|
+
assert_equal 13, event_data["queueDuration"]
|
135
|
+
assert_equal 14, event_data["externalDuration"]
|
136
|
+
assert_equal 15, event_data["databaseDuration"]
|
137
|
+
assert_equal 16, event_data["gcCumulative"]
|
138
|
+
|
139
|
+
assert_equal 1, event_data["externalCallCount"]
|
140
|
+
assert_equal 1, event_data["databaseCallCount"]
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_samples_on_transaction_finished_includes_expected_background_metrics
|
144
|
+
txn_metrics = NewRelic::Agent::TransactionMetrics.new
|
145
|
+
txn_metrics.record_unscoped('External/allOther', 12)
|
146
|
+
txn_metrics.record_unscoped('Datastore/all', 13)
|
147
|
+
txn_metrics.record_unscoped("GC/Transaction/all", 14)
|
148
|
+
|
149
|
+
event_data, *_ = TransactionEventPrimitive.create generate_payload('name', :metrics => txn_metrics)
|
150
|
+
|
151
|
+
assert_equal 12, event_data["externalDuration"]
|
152
|
+
assert_equal 13, event_data["databaseDuration"]
|
153
|
+
assert_equal 14, event_data["gcCumulative"]
|
154
|
+
|
155
|
+
assert_equal 1, event_data["databaseCallCount"]
|
156
|
+
assert_equal 1, event_data["externalCallCount"]
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_samples_on_transaction_finished_event_include_apdex_perf_zone
|
160
|
+
event_data, *_ = TransactionEventPrimitive.create generate_payload('name', :apdex_perf_zone => 'S')
|
161
|
+
|
162
|
+
assert_equal 'S', event_data['nr.apdexPerfZone']
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_samples_on_transaction_finished_event_includes_guid
|
166
|
+
event_data, *_ = TransactionEventPrimitive.create generate_payload('name', :guid => "GUID")
|
167
|
+
assert_equal "GUID", event_data["nr.guid"]
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_samples_on_transaction_finished_event_includes_referring_transaction_guid
|
171
|
+
event_data, *_ = TransactionEventPrimitive.create generate_payload('name', :referring_transaction_guid=> "REFER")
|
172
|
+
assert_equal "REFER", event_data["nr.referringTransactionGuid"]
|
173
|
+
end
|
174
|
+
|
175
|
+
def generate_payload name = 'whatever', options = {}
|
176
|
+
{
|
177
|
+
:name => "Controller/#{name}",
|
178
|
+
:type => :controller,
|
179
|
+
:start_timestamp => options[:timestamp] || Time.now.to_f,
|
180
|
+
:duration => 0.1,
|
181
|
+
:attributes => attributes,
|
182
|
+
:error => false
|
183
|
+
}.merge(options)
|
184
|
+
end
|
185
|
+
|
186
|
+
def attributes
|
187
|
+
@attributes ||= begin
|
188
|
+
filter = NewRelic::Agent::AttributeFilter.new(NewRelic::Agent.config)
|
189
|
+
NewRelic::Agent::Transaction::Attributes.new(filter)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
|
5
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
6
|
+
require 'new_relic/agent/transaction_event_recorder'
|
7
|
+
|
8
|
+
module NewRelic
|
9
|
+
module Agent
|
10
|
+
class TransactionEventRecorderTest < Minitest::Test
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@recorder = TransactionEventRecorder.new
|
14
|
+
@attributes = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_synthetics_events_overflow_to_transaction_buffer
|
18
|
+
with_config :'synthetics.events_limit' => 10 do
|
19
|
+
20.times do
|
20
|
+
generate_request
|
21
|
+
end
|
22
|
+
|
23
|
+
_, txn_events = harvest_transaction_events!
|
24
|
+
_, syn_events = harvest_synthetics_events!
|
25
|
+
|
26
|
+
assert_equal 10, txn_events.size
|
27
|
+
assert_equal 10, syn_events.size
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_synthetics_events_timestamp_bumps_go_to_main_buffer
|
32
|
+
with_config :'synthetics.events_limit' => 10 do
|
33
|
+
10.times do |i|
|
34
|
+
generate_request("syn_#{i}", :timestamp => i + 10)
|
35
|
+
end
|
36
|
+
|
37
|
+
generate_request("syn_10", :timestamp => 1)
|
38
|
+
|
39
|
+
_, txn_events = harvest_transaction_events!
|
40
|
+
_, syn_events = harvest_synthetics_events!
|
41
|
+
|
42
|
+
assert_equal 10, syn_events.size
|
43
|
+
assert_equal 10.0, syn_events[0][0]["timestamp"]
|
44
|
+
assert_equal 1, txn_events.size
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def generate_request name='whatever', options={}
|
49
|
+
payload = {
|
50
|
+
:name => "Controller/#{name}",
|
51
|
+
:type => :controller,
|
52
|
+
:start_timestamp => options[:timestamp] || Time.now.to_f,
|
53
|
+
:duration => 0.1,
|
54
|
+
:synthetics_resource_id => 100,
|
55
|
+
:attributes => attributes,
|
56
|
+
:error => false
|
57
|
+
}.merge(options)
|
58
|
+
|
59
|
+
@recorder.record payload
|
60
|
+
end
|
61
|
+
|
62
|
+
def attributes
|
63
|
+
if @attributes.nil?
|
64
|
+
filter = NewRelic::Agent::AttributeFilter.new(NewRelic::Agent.config)
|
65
|
+
@attributes = NewRelic::Agent::Transaction::Attributes.new(filter)
|
66
|
+
end
|
67
|
+
|
68
|
+
@attributes
|
69
|
+
end
|
70
|
+
|
71
|
+
def harvest_transaction_events!
|
72
|
+
@recorder.transaction_event_aggregator.harvest!
|
73
|
+
end
|
74
|
+
|
75
|
+
def harvest_synthetics_events!
|
76
|
+
@recorder.synthetics_event_aggregator.harvest!
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -10,8 +10,8 @@ class TransactionMetricsTest < Minitest::Test
|
|
10
10
|
@metrics = NewRelic::Agent::TransactionMetrics.new
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
@metrics.
|
13
|
+
def test_record_scoped_and_unscoped_should_record_a_scoped_metric
|
14
|
+
@metrics.record_scoped_and_unscoped('foo', 42, 12)
|
15
15
|
assert_scoped_metrics(@metrics, ['foo'], {
|
16
16
|
:call_count => 1,
|
17
17
|
:total_call_time => 42,
|
@@ -20,8 +20,8 @@ class TransactionMetricsTest < Minitest::Test
|
|
20
20
|
assert_unscoped_metrics(@metrics, [])
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
@metrics.
|
23
|
+
def test_record_scoped_and_unscoped_should_take_multiple_metrics
|
24
|
+
@metrics.record_scoped_and_unscoped(['foo', 'bar'], 42, 12)
|
25
25
|
assert_scoped_metrics(@metrics, ['foo', 'bar'], {
|
26
26
|
:call_count => 1,
|
27
27
|
:total_call_time => 42,
|
@@ -30,8 +30,8 @@ class TransactionMetricsTest < Minitest::Test
|
|
30
30
|
assert_unscoped_metrics(@metrics, [])
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
@metrics.
|
33
|
+
def test_record_scoped_and_unscoped_should_take_a_block
|
34
|
+
@metrics.record_scoped_and_unscoped('foo') do |stats|
|
35
35
|
stats.call_count = 3
|
36
36
|
stats.total_call_time = 2
|
37
37
|
stats.total_exclusive_time = 1
|
@@ -80,7 +80,7 @@ class TransactionMetricsTest < Minitest::Test
|
|
80
80
|
|
81
81
|
def test_square_brackets_look_up_unscoped_metrics
|
82
82
|
@metrics.record_unscoped('foo', 42, 12)
|
83
|
-
@metrics.
|
83
|
+
@metrics.record_scoped_and_unscoped('foo', 2, 1)
|
84
84
|
assert_equal(42, @metrics['foo'].total_call_time)
|
85
85
|
end
|
86
86
|
|
@@ -1441,7 +1441,7 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
|
|
1441
1441
|
txn = in_transaction do
|
1442
1442
|
end
|
1443
1443
|
|
1444
|
-
refute txn.
|
1444
|
+
refute txn.payload[:error], "Did not expected error to be recorded"
|
1445
1445
|
end
|
1446
1446
|
|
1447
1447
|
def test_error_recorded_predicate_true_when_error_recorded
|
@@ -1449,7 +1449,7 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
|
|
1449
1449
|
t.notice_error StandardError.new "Sorry!"
|
1450
1450
|
end
|
1451
1451
|
|
1452
|
-
assert txn.
|
1452
|
+
assert txn.payload[:error], "Expected error to be recorded"
|
1453
1453
|
end
|
1454
1454
|
|
1455
1455
|
def test_error_recorded_predicate_abides_by_ignore_filter
|
@@ -1462,7 +1462,7 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
|
|
1462
1462
|
t.notice_error StandardError.new "Sorry!"
|
1463
1463
|
end
|
1464
1464
|
|
1465
|
-
refute txn.
|
1465
|
+
refute txn.payload[:error], "Expected error to be apologetic"
|
1466
1466
|
end
|
1467
1467
|
end
|
1468
1468
|
|
@@ -1478,7 +1478,7 @@ class NewRelic::Agent::TransactionTest < Minitest::Test
|
|
1478
1478
|
t.notice_error StandardError.new "Sorry!"
|
1479
1479
|
end
|
1480
1480
|
|
1481
|
-
assert txn.
|
1481
|
+
assert txn.payload[:error], "Expected error to be recorded"
|
1482
1482
|
end
|
1483
1483
|
end
|
1484
1484
|
end
|
@@ -21,14 +21,12 @@ module NewRelic::Agent
|
|
21
21
|
utilization_data = UtilizationData.new
|
22
22
|
|
23
23
|
expected = {
|
24
|
-
:
|
25
|
-
|
26
|
-
|
27
|
-
:zone => "us-west-2b"
|
28
|
-
}
|
24
|
+
:id => "i-e7e85ce1",
|
25
|
+
:type => "m3.medium",
|
26
|
+
:zone => "us-west-2b"
|
29
27
|
}
|
30
28
|
|
31
|
-
assert_equal expected, utilization_data.to_collector_hash[:vendors]
|
29
|
+
assert_equal expected, utilization_data.to_collector_hash[:vendors][:aws]
|
32
30
|
end
|
33
31
|
|
34
32
|
def test_aws_information_is_omitted_when_available_but_disabled_by_config
|
@@ -38,7 +36,7 @@ module NewRelic::Agent
|
|
38
36
|
:availability_zone => "us-west-2b"
|
39
37
|
)
|
40
38
|
|
41
|
-
with_config(:'utilization.detect_aws' => false) do
|
39
|
+
with_config(:'utilization.detect_aws' => false, :'utilization.detect_docker' => false) do
|
42
40
|
utilization_data = UtilizationData.new
|
43
41
|
assert_nil utilization_data.to_collector_hash[:vendors]
|
44
42
|
end
|
@@ -103,6 +101,8 @@ module NewRelic::Agent
|
|
103
101
|
end
|
104
102
|
|
105
103
|
def test_vendor_information_is_omitted_if_unavailable
|
104
|
+
NewRelic::Agent::SystemInfo.stubs(:docker_container_id).returns(nil)
|
105
|
+
|
106
106
|
utilization_data = UtilizationData.new
|
107
107
|
|
108
108
|
assert_nil utilization_data.to_collector_hash[:vendors]
|
@@ -192,7 +192,7 @@ module NewRelic
|
|
192
192
|
when 'analytic_event_data'
|
193
193
|
AnalyticEventDataPost.new(opts)
|
194
194
|
when 'custom_event_data'
|
195
|
-
|
195
|
+
CustomEventDataPost.new(opts)
|
196
196
|
when 'error_data'
|
197
197
|
ErrorDataPost.new(opts)
|
198
198
|
when 'error_event_data'
|
@@ -338,17 +338,20 @@ module NewRelic
|
|
338
338
|
end
|
339
339
|
end
|
340
340
|
|
341
|
-
class
|
342
|
-
|
343
|
-
attr_reader :events
|
341
|
+
class ReservoirSampledContainerPost < AgentPost
|
342
|
+
attr_reader :reservoir_metadata, :events
|
344
343
|
|
345
|
-
def initialize
|
344
|
+
def initialize opts={}
|
346
345
|
super
|
347
|
-
|
348
|
-
@events =
|
346
|
+
@reservoir_metadata = body[1]
|
347
|
+
@events = body[2]
|
349
348
|
end
|
350
349
|
end
|
351
350
|
|
351
|
+
class AnalyticEventDataPost < ReservoirSampledContainerPost; end
|
352
|
+
class CustomEventDataPost < ReservoirSampledContainerPost; end
|
353
|
+
class ErrorEventDataPost < ReservoirSampledContainerPost; end
|
354
|
+
|
352
355
|
class ErrorDataPost < AgentPost
|
353
356
|
|
354
357
|
attr_reader :errors
|
@@ -383,15 +386,5 @@ module NewRelic
|
|
383
386
|
@params["intrinsics"]
|
384
387
|
end
|
385
388
|
end
|
386
|
-
|
387
|
-
class ErrorEventDataPost < AgentPost
|
388
|
-
attr_reader :reservoir_metadata, :error_events
|
389
|
-
|
390
|
-
def initialize opts={}
|
391
|
-
super
|
392
|
-
@reservoir_metadata = body[1]
|
393
|
-
@error_events = body[2]
|
394
|
-
end
|
395
|
-
end
|
396
389
|
end
|
397
390
|
end
|
@@ -70,6 +70,8 @@ class LicenseTest < Minitest::Test
|
|
70
70
|
File.expand_path(__FILE__) == path ||
|
71
71
|
# skip rpm_test_app and other stuff that ends up in tmp
|
72
72
|
path.include?(gem_root + '/tmp/') ||
|
73
|
+
# skip vendor/bundle
|
74
|
+
path.include?(gem_root + '/vendor/bundle') ||
|
73
75
|
# skip the auto-generated build.rb file
|
74
76
|
path =~ %r{lib/new_relic/build\.rb} ||
|
75
77
|
# skip tags file
|