newrelic_rpm 3.6.9.171 → 3.7.0.174.beta
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +9 -0
- data/lib/new_relic/agent.rb +15 -21
- data/lib/new_relic/agent/beacon_configuration.rb +1 -81
- data/lib/new_relic/agent/browser_monitoring.rb +82 -49
- data/lib/new_relic/agent/configuration/default_source.rb +31 -12
- data/lib/new_relic/agent/request_sampler.rb +17 -10
- data/lib/new_relic/agent/transaction.rb +10 -17
- data/lib/new_relic/coerce.rb +26 -0
- data/lib/new_relic/rack/browser_monitoring.rb +43 -39
- data/lib/new_relic/version.rb +2 -2
- data/lib/tasks/install.rake +1 -0
- data/test/agent_helper.rb +2 -2
- data/test/environments/rails40/Gemfile +1 -1
- data/test/multiverse/lib/multiverse/suite.rb +11 -1
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +19 -12
- data/test/multiverse/suites/rails/Envfile +1 -5
- data/test/multiverse/suites/rails/queue_time_test.rb +3 -2
- data/test/multiverse/suites/rails/request_statistics_test.rb +29 -0
- data/test/multiverse/suites/sidekiq/Envfile +10 -1
- data/test/multiverse/suites/sinatra/Envfile +3 -7
- data/test/new_relic/agent/beacon_configuration_test.rb +9 -76
- data/test/new_relic/agent/browser_monitoring_test.rb +204 -96
- data/test/new_relic/agent/request_sampler_test.rb +41 -1
- data/test/new_relic/agent/transaction_test.rb +47 -0
- data/test/new_relic/coerce_test.rb +24 -0
- data/test/new_relic/rack/browser_monitoring_test.rb +38 -6
- data/test/performance/suites/rum_autoinsertion.rb +0 -1
- data/test/rum/basic.result.html +2 -2
- data/test/rum/comments1.result.html +2 -2
- data/test/rum/comments2.result.html +2 -2
- data/test/rum/gt_in_quotes1.result.html +2 -2
- data/test/rum/gt_in_quotes2.result.html +2 -2
- data/test/rum/gt_in_quotes_mismatch.result.html +2 -2
- data/test/rum/gt_in_single_quotes1.result.html +2 -2
- data/test/rum/gt_in_single_quotes_mismatch.result.html +2 -2
- data/test/rum/incomplete_non_meta_tags.result.html +2 -2
- data/test/rum/no_header.result.html +2 -2
- data/test/rum/no_html_and_no_header.result.html +2 -2
- data/test/rum/no_start_header.result.html +2 -2
- data/test/rum/script1.result.html +2 -2
- data/test/rum/script2.result.html +2 -2
- data/test/rum/x_ua_meta_tag.result.html +2 -2
- data/test/rum/x_ua_meta_tag_multiline.result.html +2 -2
- data/test/rum/x_ua_meta_tag_with_others.result.html +2 -2
- data/test/rum/x_ua_meta_tag_with_spaces.result.html +2 -2
- metadata +8 -24
- metadata.gz.sig +0 -0
@@ -9,21 +9,16 @@ require 'base64'
|
|
9
9
|
|
10
10
|
class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
11
11
|
include NewRelic::Agent::BrowserMonitoring
|
12
|
-
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
13
12
|
|
14
13
|
def setup
|
15
|
-
NewRelic::Agent.manual_start
|
16
14
|
@config = {
|
17
15
|
:beacon => 'beacon',
|
18
16
|
:browser_key => 'browserKey',
|
19
17
|
:application_id => '5, 6', # collector can return app multiple ids
|
20
18
|
:'rum.enabled' => true,
|
21
|
-
:
|
22
|
-
:'rum.jsonp' => true,
|
23
|
-
:license_key => 'a' * 40
|
19
|
+
:license_key => "\0" # no-op obfuscation key
|
24
20
|
}
|
25
21
|
NewRelic::Agent.config.apply_config(@config)
|
26
|
-
@episodes_file = "this_is_my_file"
|
27
22
|
NewRelic::Agent.instance.instance_eval do
|
28
23
|
@beacon_configuration = NewRelic::Agent::BeaconConfiguration.new
|
29
24
|
end
|
@@ -40,6 +35,22 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
40
35
|
mocha_teardown
|
41
36
|
end
|
42
37
|
|
38
|
+
def test_js_errors_beta_default_gets_default_loader
|
39
|
+
assert_equal "rum", NewRelic::Agent.config[:'browser_monitoring.loader']
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_js_errors_beta_gets_full_loader
|
43
|
+
with_config(:js_errors_beta => true) do
|
44
|
+
assert_equal "full", NewRelic::Agent.config[:'browser_monitoring.loader']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_js_errors_beta_off_gets_default_loader
|
49
|
+
with_config(:js_errors_beta => false) do
|
50
|
+
assert_equal "rum", NewRelic::Agent.config[:'browser_monitoring.loader']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
43
54
|
def test_auto_instrumentation_config_defaults_to_enabled
|
44
55
|
assert NewRelic::Agent.config[:'browser_monitoring.auto_instrument']
|
45
56
|
end
|
@@ -68,82 +79,68 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
68
79
|
|
69
80
|
def test_browser_timing_header_with_no_beacon_configuration
|
70
81
|
NewRelic::Agent.instance.stubs(:beacon_configuration).returns( nil)
|
71
|
-
|
72
|
-
assert_equal "", header
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_browser_timing_header
|
76
|
-
header = browser_timing_header
|
77
|
-
assert_equal "<script type=\"text/javascript\">var NREUMQ=NREUMQ||[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);</script>", header
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_browser_timing_header_with_rum_enabled_not_specified
|
81
|
-
NewRelic::Agent.instance.stubs(:beacon_configuration).returns( NewRelic::Agent::BeaconConfiguration.new)
|
82
|
-
header = browser_timing_header
|
83
|
-
assert_equal "<script type=\"text/javascript\">var NREUMQ=NREUMQ||[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);</script>", header
|
82
|
+
assert_equal "", browser_timing_header
|
84
83
|
end
|
85
84
|
|
86
85
|
def test_browser_timing_header_with_rum_enabled_false
|
87
86
|
with_config(:'rum.enabled' => false) do
|
88
|
-
NewRelic::Agent.instance.stubs(:beacon_configuration).returns(
|
89
|
-
|
90
|
-
assert_equal "", header
|
87
|
+
NewRelic::Agent.instance.stubs(:beacon_configuration).returns(NewRelic::Agent::BeaconConfiguration.new)
|
88
|
+
assert_equal "", browser_timing_header
|
91
89
|
end
|
92
90
|
end
|
93
91
|
|
94
92
|
def test_browser_timing_header_disable_all_tracing
|
95
|
-
header = nil
|
96
93
|
NewRelic::Agent.disable_all_tracing do
|
97
|
-
|
94
|
+
assert_equal "", browser_timing_header
|
98
95
|
end
|
99
|
-
assert_equal "", header
|
100
96
|
end
|
101
97
|
|
102
98
|
def test_browser_timing_header_disable_transaction_tracing
|
103
|
-
header = nil
|
104
99
|
NewRelic::Agent.disable_transaction_tracing do
|
105
|
-
|
100
|
+
assert_equal "", browser_timing_header
|
106
101
|
end
|
107
|
-
assert_equal "", header
|
108
102
|
end
|
109
103
|
|
110
|
-
def
|
111
|
-
with_config(:js_agent_loader => '
|
112
|
-
|
113
|
-
assert_equal("<script type=\"text/javascript\">var NREUMQ=NREUMQ||[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);</script>", header,
|
114
|
-
"expected old RUM header but saw '#{header}'")
|
104
|
+
def test_browser_timing_header_without_loader
|
105
|
+
with_config(:js_agent_loader => '') do
|
106
|
+
assert_equal "", browser_timing_header
|
115
107
|
end
|
116
108
|
end
|
117
109
|
|
118
|
-
def
|
119
|
-
with_config(:
|
120
|
-
|
121
|
-
assert_equal("<script type=\"text/javascript\">var NREUMQ=NREUMQ||[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);</script>", header,
|
122
|
-
"expected old RUM header but saw '#{header}'")
|
110
|
+
def test_browser_timing_header_without_rum_enabled
|
111
|
+
with_config(:js_agent_loader => 'loader', :'rum.enabled' => false) do
|
112
|
+
assert_equal "", browser_timing_header
|
123
113
|
end
|
124
114
|
end
|
125
115
|
|
126
|
-
def
|
127
|
-
with_config(:
|
128
|
-
|
129
|
-
assert_equal("\n<script type=\"text/javascript\">loader</script>", header,
|
130
|
-
"expected new JS agent loader 'loader' but saw '#{header}'")
|
116
|
+
def test_browser_timing_header_with_loader
|
117
|
+
with_config(:js_agent_loader => 'loader') do
|
118
|
+
assert_has_js_agent_loader(browser_timing_header)
|
131
119
|
end
|
132
120
|
end
|
133
121
|
|
122
|
+
def assert_has_js_agent_loader(header)
|
123
|
+
assert_equal("\n<script type=\"text/javascript\">loader</script>",
|
124
|
+
header,
|
125
|
+
"expected new JS agent loader 'loader' but saw '#{header}'")
|
126
|
+
end
|
127
|
+
|
128
|
+
BEGINNING_OF_FOOTER = '<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info='
|
129
|
+
END_OF_FOOTER = '}</script>'
|
130
|
+
|
134
131
|
def test_browser_timing_footer
|
135
132
|
with_config(:license_key => 'a' * 13) do
|
136
|
-
NewRelic::Agent::TransactionState.reset
|
137
133
|
browser_timing_header
|
138
134
|
footer = browser_timing_footer
|
139
|
-
|
140
|
-
|
141
|
-
var e=document.createElement("script");'
|
142
|
-
assert(footer.include?(snippet),
|
143
|
-
"Expected footer to include snippet: #{snippet}, but instead was #{footer}")
|
135
|
+
assert_has_text(BEGINNING_OF_FOOTER, footer)
|
136
|
+
assert_has_text(END_OF_FOOTER, footer)
|
144
137
|
end
|
145
138
|
end
|
146
139
|
|
140
|
+
def assert_has_text(snippet, footer)
|
141
|
+
assert(footer.include?(snippet), "Expected footer to include snippet: #{snippet}, but instead was #{footer}")
|
142
|
+
end
|
143
|
+
|
147
144
|
def test_browser_timing_footer_with_no_browser_key_rum_enabled
|
148
145
|
with_config(:browser_key => '') do
|
149
146
|
browser_timing_header
|
@@ -156,36 +153,17 @@ var e=document.createElement("script");'
|
|
156
153
|
def test_browser_timing_footer_with_no_browser_key_rum_disabled
|
157
154
|
with_config(:'rum.enabled' => false) do
|
158
155
|
browser_timing_header
|
159
|
-
NewRelic::Agent.instance.stubs(:beacon_configuration)
|
160
|
-
.returns(NewRelic::Agent::BeaconConfiguration.new)
|
156
|
+
NewRelic::Agent.instance.stubs(:beacon_configuration).returns(NewRelic::Agent::BeaconConfiguration.new)
|
161
157
|
footer = browser_timing_footer
|
162
158
|
assert_equal "", footer
|
163
159
|
end
|
164
160
|
end
|
165
161
|
|
166
|
-
def setup_beacon_config
|
167
|
-
NewRelic::Agent::TransactionState.reset
|
168
|
-
browser_timing_header
|
169
|
-
|
170
|
-
license_bytes = [];
|
171
|
-
("a" * 13).each_byte {|byte| license_bytes << byte}
|
172
|
-
config = NewRelic::Agent::BeaconConfiguration.new
|
173
|
-
config.expects(:license_bytes).returns(license_bytes).at_least_once
|
174
|
-
NewRelic::Agent.instance.stubs(:beacon_configuration).returns(config).at_least_once
|
175
|
-
end
|
176
|
-
|
177
162
|
def test_browser_timing_footer_with_rum_enabled_not_specified
|
178
|
-
setup_beacon_config
|
179
|
-
|
180
163
|
footer = browser_timing_footer
|
181
|
-
beginning_snippet =
|
182
|
-
|
183
|
-
|
184
|
-
ending_snippet = "]);}</script>"
|
185
|
-
assert(footer.include?(beginning_snippet),
|
186
|
-
"expected footer to include beginning snippet: #{beginning_snippet}, but was #{footer}")
|
187
|
-
assert(footer.include?(ending_snippet),
|
188
|
-
"expected footer to include ending snippet: #{ending_snippet}, but was #{footer}")
|
164
|
+
beginning_snippet = BEGINNING_OF_FOOTER
|
165
|
+
assert_has_text(BEGINNING_OF_FOOTER, footer)
|
166
|
+
assert_has_text(END_OF_FOOTER, footer)
|
189
167
|
end
|
190
168
|
|
191
169
|
def test_browser_timing_footer_with_no_beacon_configuration
|
@@ -239,10 +217,8 @@ var e=document.createElement("script");'
|
|
239
217
|
end
|
240
218
|
end
|
241
219
|
|
242
|
-
def
|
243
|
-
with_config(:
|
244
|
-
setup_beacon_config
|
245
|
-
|
220
|
+
def test_browser_timing_footer_with_loader
|
221
|
+
with_config(:js_agent_loader => 'loader') do
|
246
222
|
footer = browser_timing_footer
|
247
223
|
beginning_snippet = "\n<script type=\"text/javascript\">window.NREUM||(NREUM={});NREUM.info={\""
|
248
224
|
ending_snippet = '}</script>'
|
@@ -275,7 +251,7 @@ var e=document.createElement("script");'
|
|
275
251
|
|
276
252
|
def test_browser_monitoring_transaction_name_when_tt_disabled
|
277
253
|
with_config(:'transaction_tracer.enabled' => false) do
|
278
|
-
|
254
|
+
in_transaction('disabled_transactions') do
|
279
255
|
self.class.inspect
|
280
256
|
end
|
281
257
|
|
@@ -284,27 +260,159 @@ var e=document.createElement("script");'
|
|
284
260
|
end
|
285
261
|
end
|
286
262
|
|
287
|
-
def
|
263
|
+
def test_extra_data
|
264
|
+
in_transaction do
|
265
|
+
with_config(ANALYTICS_TXN_IN_PAGE => true) do
|
266
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
267
|
+
assert_equal({:boo => "hoo"}, extra_data)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def test_extra_data_outside_transaction
|
273
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
274
|
+
assert extra_data.empty?
|
275
|
+
end
|
276
|
+
|
277
|
+
def test_format
|
278
|
+
assert_formatted({:a => "1", "b" => 2}, "a=1", "b=#2")
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_format_extra_data_escaping
|
282
|
+
assert_formatted({"semi;colon" => "gets;escaped"}, "semi:colon=gets:escaped")
|
283
|
+
assert_formatted({"equal=key" => "equal=value"}, "equal-key=equal-value")
|
284
|
+
assert_formatted({'"quoted"' => '"marks"'}, %Q['quoted'='marks'])
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_format_extra_data_disallowed_types
|
288
|
+
assert_formatted_empty({"nested" => { "hashes?" => "nope" }})
|
289
|
+
assert_formatted_empty({"lists" => ["are", "they", "allowed?", "nope"]})
|
290
|
+
end
|
291
|
+
|
292
|
+
def assert_formatted(data, *expected)
|
293
|
+
result = format_extra_data(data).split(";")
|
294
|
+
expected.each do |expect|
|
295
|
+
assert_includes(result, expect)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
def assert_formatted_empty(data)
|
300
|
+
result = format_extra_data(data)
|
301
|
+
assert_equal("", result)
|
302
|
+
end
|
303
|
+
|
304
|
+
def test_footer_js_data
|
288
305
|
freeze_time
|
289
306
|
in_transaction do
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
307
|
+
with_config(ANALYTICS_TXN_IN_PAGE => true) do
|
308
|
+
NewRelic::Agent.set_user_attributes(:user => "user")
|
309
|
+
|
310
|
+
txn = NewRelic::Agent::Transaction.current
|
311
|
+
txn.stubs(:queue_time).returns(0)
|
312
|
+
txn.stubs(:start_time).returns(Time.now - 10)
|
313
|
+
txn.name = 'most recent transaction'
|
314
|
+
|
315
|
+
state = NewRelic::Agent::TransactionState.get
|
316
|
+
state.request_token = '0123456789ABCDEF'
|
317
|
+
state.request_guid = 'ABC'
|
318
|
+
|
319
|
+
data = js_data(NewRelic::Agent.instance.beacon_configuration)
|
320
|
+
expected = {
|
321
|
+
"beacon" => "beacon",
|
322
|
+
"errorBeacon" => nil,
|
323
|
+
"licenseKey" => "browserKey",
|
324
|
+
"applicationID" => "5, 6",
|
325
|
+
"transactionName" => pack("most recent transaction"),
|
326
|
+
"queueTime" => 0,
|
327
|
+
"applicationTime" => 10000,
|
328
|
+
"ttGuid" => "ABC",
|
329
|
+
"agentToken" => "0123456789ABCDEF",
|
330
|
+
"agent" => nil,
|
331
|
+
"extra" => pack("user=user")
|
332
|
+
}
|
333
|
+
|
334
|
+
assert_equal(expected, data)
|
335
|
+
|
336
|
+
js = footer_js_string(NewRelic::Agent.instance.beacon_configuration)
|
337
|
+
expected.each do |key, value|
|
338
|
+
assert_match(/"#{key.to_s}":#{formatted_for_matching(value)}/, js)
|
339
|
+
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
ANALYTICS_ENABLED = :'analytics_events.enabled'
|
345
|
+
ANALYTICS_TXN_ENABLED = :'analytics_events.transactions.enabled'
|
346
|
+
ANALYTICS_TXN_IN_PAGE = :'capture_attributes.page_view_events'
|
347
|
+
|
348
|
+
def test_js_data_doesnt_pick_up_extras_by_default
|
349
|
+
in_transaction do
|
350
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
351
|
+
assert_extra_data_is("")
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_js_data_picks_up_extras_when_configured
|
356
|
+
in_transaction do
|
357
|
+
with_config(ANALYTICS_ENABLED => true,
|
358
|
+
ANALYTICS_TXN_ENABLED => true,
|
359
|
+
ANALYTICS_TXN_IN_PAGE => true) do
|
360
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
361
|
+
assert_extra_data_is("boo=hoo")
|
362
|
+
end
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
def test_js_data_ignores_extras_if_no_analytics
|
367
|
+
in_transaction do
|
368
|
+
with_config(ANALYTICS_ENABLED => false,
|
369
|
+
ANALYTICS_TXN_ENABLED => true,
|
370
|
+
ANALYTICS_TXN_IN_PAGE => true) do
|
371
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
372
|
+
assert_extra_data_is("")
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
def test_js_data_ignores_extras_if_no_transaction_analytics
|
378
|
+
in_transaction do
|
379
|
+
with_config(ANALYTICS_ENABLED => true,
|
380
|
+
ANALYTICS_TXN_ENABLED => false,
|
381
|
+
ANALYTICS_TXN_IN_PAGE => true) do
|
382
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
383
|
+
assert_extra_data_is("")
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def test_js_data_ignores_extras_if_not_allowed_in_page
|
389
|
+
in_transaction do
|
390
|
+
with_config(ANALYTICS_ENABLED => true,
|
391
|
+
ANALYTICS_TXN_ENABLED => true,
|
392
|
+
ANALYTICS_TXN_IN_PAGE => false) do
|
393
|
+
NewRelic::Agent.add_custom_parameters({:boo => "hoo"})
|
394
|
+
assert_extra_data_is("")
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
def assert_extra_data_is(expected)
|
400
|
+
data = js_data(NewRelic::Agent.instance.beacon_configuration)
|
401
|
+
assert_equal pack(expected), data["extra"]
|
402
|
+
end
|
403
|
+
|
404
|
+
def pack(text)
|
405
|
+
[text].pack("m0").gsub("\n", "")
|
406
|
+
end
|
407
|
+
|
408
|
+
def formatted_for_matching(value)
|
409
|
+
case value
|
410
|
+
when String
|
411
|
+
%Q["#{value}"]
|
412
|
+
when NilClass
|
413
|
+
"null"
|
414
|
+
else
|
415
|
+
value
|
308
416
|
end
|
309
417
|
end
|
310
418
|
|
@@ -21,6 +21,45 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_custom_parameters_in_event_are_normalized_to_string_keys
|
25
|
+
with_sampler_config do
|
26
|
+
generate_request('whatever', :custom_params => {:bing => 2, 1 => 3})
|
27
|
+
txn_event = @sampler.samples.first
|
28
|
+
assert_equal 2, txn_event['bing']
|
29
|
+
assert_equal 3, txn_event['1']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def test_includes_custom_parameters_in_event
|
35
|
+
with_sampler_config do
|
36
|
+
generate_request('whatever', :custom_params => {'bing' => 2})
|
37
|
+
txn_event = @sampler.samples.first
|
38
|
+
assert_equal 2, txn_event['bing']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_doesnt_include_custom_parameters_in_event_when_configured_not_to
|
43
|
+
with_sampler_config('capture_attributes.transaction_events' => false) do
|
44
|
+
generate_request('whatever', :custom_params => {'bing' => 2})
|
45
|
+
txn_event = @sampler.samples.first
|
46
|
+
assert_equal nil, txn_event['bing']
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_custom_parameters_in_event_cant_override_reserved_attributes
|
51
|
+
with_sampler_config do
|
52
|
+
generate_request('whatever',
|
53
|
+
:overview_metrics => {'webDuration' => 0.01},
|
54
|
+
:custom_params => {'type' => 'giraffe', 'duration' => 'hippo', 'webDuration' => 'zebra'}
|
55
|
+
)
|
56
|
+
txn_event = @sampler.samples.first
|
57
|
+
assert_equal 'Transaction', txn_event['type']
|
58
|
+
assert_equal 0.1, txn_event['duration']
|
59
|
+
assert_equal 0.01, txn_event['webDuration']
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
24
63
|
def test_samples_on_transaction_finished_event_includes_overview_metrics
|
25
64
|
with_sampler_config do
|
26
65
|
generate_request('name', :overview_metrics => {:foo => :bar})
|
@@ -130,7 +169,8 @@ class NewRelic::Agent::RequestSamplerTest < Test::Unit::TestCase
|
|
130
169
|
:type => :controller,
|
131
170
|
:start_timestamp => Time.now.to_f,
|
132
171
|
:duration => 0.1,
|
133
|
-
:overview_metrics => {}
|
172
|
+
:overview_metrics => {},
|
173
|
+
:custom_params => {}
|
134
174
|
}.merge(options)
|
135
175
|
@event_listener.notify(:transaction_finished, payload)
|
136
176
|
end
|