newrelic_rpm 3.14.2.312 → 3.14.3.313

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -5
  3. data/CHANGELOG +22 -0
  4. data/lib/new_relic/agent/agent.rb +0 -4
  5. data/lib/new_relic/agent/configuration/default_source.rb +114 -107
  6. data/lib/new_relic/agent/database.rb +17 -1
  7. data/lib/new_relic/agent/database/obfuscation_helpers.rb +68 -48
  8. data/lib/new_relic/agent/database/obfuscator.rb +4 -23
  9. data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
  10. data/lib/new_relic/agent/instrumentation/data_mapper.rb +20 -1
  11. data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +1 -1
  12. data/lib/new_relic/agent/rules_engine.rb +39 -2
  13. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +27 -5
  14. data/lib/new_relic/agent/sql_sampler.rb +7 -3
  15. data/lib/new_relic/language_support.rb +8 -0
  16. data/lib/new_relic/version.rb +1 -1
  17. data/lib/tasks/config.html.erb +5 -1
  18. data/lib/tasks/config.rake +10 -2
  19. data/lib/tasks/config.text.erb +6 -5
  20. data/test/environments/rails32/Gemfile +6 -1
  21. data/test/fixtures/cross_agent_tests/aws.json +95 -1
  22. data/test/fixtures/cross_agent_tests/cat/README.md +28 -0
  23. data/test/fixtures/cross_agent_tests/cat/cat_map.json +595 -0
  24. data/test/fixtures/cross_agent_tests/cat/path_hashing.json +51 -0
  25. data/test/fixtures/cross_agent_tests/data_transport/data_transport.json +1441 -0
  26. data/test/fixtures/cross_agent_tests/data_transport/data_transport.md +35 -0
  27. data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +7 -2
  28. data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +261 -35
  29. data/test/fixtures/cross_agent_tests/transaction_segment_terms.json +305 -17
  30. data/test/multiverse/suites/active_record/active_record_test.rb +1 -1
  31. data/test/multiverse/suites/agent_only/rename_rule_test.rb +12 -12
  32. data/test/multiverse/suites/datamapper/datamapper_test.rb +23 -0
  33. data/test/multiverse/suites/rails/Envfile +10 -2
  34. data/test/new_relic/agent/database/sql_obfuscation_test.rb +2 -7
  35. data/test/performance/README.md +3 -10
  36. data/test/performance/lib/performance/table.rb +1 -1
  37. data/test/performance/suites/rules_engine.rb +35 -0
  38. data/test/performance/suites/segment_terms_rule.rb +27 -0
  39. data/test/performance/suites/sql_obfuscation.rb +19 -0
  40. metadata +9 -2
@@ -0,0 +1,51 @@
1
+ [
2
+ {
3
+ "name": "no referring path hash",
4
+ "referringPathHash": null,
5
+ "applicationName": "application A",
6
+ "transactionName": "transaction A",
7
+ "expectedPathHash": "5e17050e"
8
+ },
9
+ {
10
+ "name": "leading zero on resulting path hash",
11
+ "referringPathHash": null,
12
+ "applicationName": "my application",
13
+ "transactionName": "transaction 13",
14
+ "expectedPathHash": "097ca5e1"
15
+ },
16
+ {
17
+ "name": "with referring path hash",
18
+ "referringPathHash": "95f2f716",
19
+ "applicationName": "app2",
20
+ "transactionName": "txn2",
21
+ "expectedPathHash": "ef72c2e6"
22
+ },
23
+ {
24
+ "name": "with referring path hash leading zero",
25
+ "referringPathHash": "077634eb",
26
+ "applicationName": "app3",
27
+ "transactionName": "txn3",
28
+ "expectedPathHash": "bfd6587f"
29
+ },
30
+ {
31
+ "name": "with multi-byte UTF-8 characters in transaction name",
32
+ "referringPathHash": "95f2f716",
33
+ "applicationName": "app1",
34
+ "transactionName": "Доверяй, но проверяй",
35
+ "expectedPathHash": "b7ad900e"
36
+ },
37
+ {
38
+ "name": "high bit of referringPathHash set",
39
+ "referringPathHash": "80000000",
40
+ "applicationName": "app1",
41
+ "transactionName": "txn1",
42
+ "expectedPathHash": "95f2f717"
43
+ },
44
+ {
45
+ "name": "low bit of referringPathHash set",
46
+ "referringPathHash": "00000001",
47
+ "applicationName": "app1",
48
+ "transactionName": "txn1",
49
+ "expectedPathHash": "95f2f714"
50
+ }
51
+ ]
@@ -0,0 +1,1441 @@
1
+ {
2
+ "tests": [
3
+ {
4
+ "title": "happy_connect",
5
+ "comment": "Verifies that the agent connects correctly under normal circumstances and sends the right metadata with each request",
6
+ "steps": [
7
+ {
8
+ "event_agent_start": {
9
+ "payload": {
10
+ "host": "collector.newrelic.com",
11
+ "port": 443,
12
+ "license_key": "licenseKey1"
13
+ }
14
+ }
15
+ },
16
+ {
17
+ "expect_request": {
18
+ "command": "get_redirect_host",
19
+ "host": "collector.newrelic.com",
20
+ "port": 443,
21
+ "license_key": "licenseKey1",
22
+ "response_payload": {
23
+ "return_value": "collector55.newrelic.com"
24
+ }
25
+ }
26
+ },
27
+ {
28
+ "expect_request": {
29
+ "command": "connect",
30
+ "host": "collector55.newrelic.com",
31
+ "port": 443,
32
+ "license_key": "licenseKey1",
33
+ "response_payload": {
34
+ "return_value": {
35
+ "agent_run_id": "agentRunId1"
36
+ }
37
+ }
38
+ }
39
+ },
40
+ {
41
+ "expect_request": {
42
+ "host": "collector55.newrelic.com",
43
+ "port": 443,
44
+ "license_key": "licenseKey1",
45
+ "agent_run_id": "agentRunId1",
46
+ "command": "agent_settings"
47
+ }
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "title": "invalid_license",
53
+ "comment": "Verifies that the agent stops itself after receiving a license error",
54
+ "steps": [
55
+ {
56
+ "event_agent_start": {
57
+ "payload": {
58
+ "host": "collector.newrelic.com",
59
+ "port": 443,
60
+ "license_key": "WRONG"
61
+ }
62
+ }
63
+ },
64
+ {
65
+ "expect_request": {
66
+ "command": "get_redirect_host",
67
+ "response_payload": {
68
+ "exception": {
69
+ "error_type": "NewRelic::Agent::LicenseException"
70
+ }
71
+ }
72
+ }
73
+ },
74
+ {
75
+ "event_metric": {
76
+ "payload": {
77
+ "name": "DotNet/DefaultController/FooBar",
78
+ "time": 2
79
+ }
80
+ }
81
+ },
82
+ {
83
+ "event_harvest_metrics": {}
84
+ },
85
+ {
86
+ "expect_no_request": {}
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "title": "happy_metric_data",
92
+ "comment": "Verifies that the agent serializes metrics correctly and sends them to the right endpoint",
93
+ "steps": [
94
+ {
95
+ "composite_step": "startup"
96
+ },
97
+ {
98
+ "event_metric": {
99
+ "payload": {
100
+ "name": "DotNet/DefaultController/FooBar",
101
+ "time": 2
102
+ }
103
+ }
104
+ },
105
+ {
106
+ "event_metric": {
107
+ "payload": {
108
+ "name": "DotNet/DefaultController/ApplePie",
109
+ "time": 2
110
+ }
111
+ }
112
+ },
113
+ {
114
+ "event_harvest_metrics": {}
115
+ },
116
+ {
117
+ "expect_request": {
118
+ "command": "metric_data",
119
+ "payload": [
120
+ "agentRunId1",
121
+ "__ANY_FLOAT__",
122
+ "__ANY_FLOAT__",
123
+ [
124
+ [
125
+ {
126
+ "name": "DotNet/DefaultController/FooBar"
127
+ },
128
+ [
129
+ 1,
130
+ 2,
131
+ 2,
132
+ 2,
133
+ 2,
134
+ 4
135
+ ]
136
+ ],
137
+ [
138
+ {
139
+ "name": "DotNet/DefaultController/ApplePie"
140
+ },
141
+ [
142
+ 1,
143
+ 2,
144
+ 2,
145
+ 2,
146
+ 2,
147
+ 4
148
+ ]
149
+ ]
150
+ ]
151
+ ]
152
+ }
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "title": "happy_transaction_event_data",
158
+ "comment": "Verifies that the agent serializes transaction events correctly and sends them to the right endpoint",
159
+ "steps": [
160
+ {
161
+ "composite_step": "startup"
162
+ },
163
+ {
164
+ "event_transaction_event": {
165
+ "payload": {
166
+ "intrinsic_attributes": {
167
+ "name": "WebTransaction/Action/FooBar",
168
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
169
+ "timestamp": 12345,
170
+ "duration": 6.789
171
+ },
172
+ "user_attributes": {
173
+ "my_attribute": "my_value"
174
+ },
175
+ "agent_attributes": {
176
+ "response.status": "200"
177
+ }
178
+ }
179
+ }
180
+ },
181
+ {
182
+ "event_harvest_transaction_events": {}
183
+ },
184
+ {
185
+ "expect_request": {
186
+ "command": "analytic_event_data",
187
+ "payload": [
188
+ "agentRunId1",
189
+ [
190
+ [
191
+ {
192
+ "type": "Transaction",
193
+ "name": "WebTransaction/Action/FooBar",
194
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
195
+ "timestamp": 12345,
196
+ "duration": 6.789
197
+ },
198
+ {
199
+ "my_attribute": "my_value"
200
+ },
201
+ {
202
+ "response.status": "200"
203
+ }
204
+ ]
205
+ ]
206
+ ]
207
+ }
208
+ }
209
+ ]
210
+ },
211
+ {
212
+ "title": "happy_custom_event_data",
213
+ "comment": "Verifies that the agent serializes transaction events correctly and sends them to the right endpoint",
214
+ "steps": [
215
+ {
216
+ "composite_step": "startup"
217
+ },
218
+ {
219
+ "event_custom_event": {
220
+ "payload": {
221
+ "intrinsic_attributes": {
222
+ "type": "myType"
223
+ },
224
+ "user_attributes": {
225
+ "my_attribute": "my_value"
226
+ }
227
+ }
228
+ }
229
+ },
230
+ {
231
+ "event_harvest_custom_events": {}
232
+ },
233
+ {
234
+ "expect_request": {
235
+ "command": "custom_event_data",
236
+ "payload": [
237
+ "agentRunId1",
238
+ [
239
+ [
240
+ {
241
+ "type": "myType",
242
+ "timestamp": "__ANY_FLOAT__"
243
+ },
244
+ {
245
+ "my_attribute": "my_value"
246
+ }
247
+ ]
248
+ ]
249
+ ]
250
+ }
251
+ }
252
+ ]
253
+ },
254
+ {
255
+ "title": "happy_transaction_sample_data",
256
+ "comment": "Verifies that the agent serializes transaction samples correctly and sends them to the right endpoint",
257
+ "steps": [
258
+ {
259
+ "composite_step": "startup"
260
+ },
261
+ {
262
+ "event_transaction_sample": {
263
+ "payload": {
264
+ "timestamp": "2000-01-01 01:01:01",
265
+ "duration": 9967,
266
+ "path": "WebTransaction/Action/FooBar",
267
+ "uri": "http://localhost/MyApp/FooBar",
268
+ "trace_data": [
269
+ 946688461,
270
+ [],
271
+ [],
272
+ [
273
+ 123,
274
+ 456,
275
+ "rootSegment",
276
+ {},
277
+ [],
278
+ "myClass",
279
+ "myMethod"
280
+ ],
281
+ {
282
+ "intrinsics": {
283
+ "name": "WebTransaction/Action/FooBar",
284
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817"
285
+ },
286
+ "userAttributes": {
287
+ "my_attribute": "my_value"
288
+ },
289
+ "agentAttributes": {
290
+ "response.status": "200"
291
+ }
292
+ }
293
+ ],
294
+ "guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
295
+ "unused": null,
296
+ "force_persist": false,
297
+ "xrey_session_id": null,
298
+ "synthetics_resource_id": null
299
+ }
300
+ }
301
+ },
302
+ {
303
+ "event_harvest_transaction_samples": {}
304
+ },
305
+ {
306
+ "expect_request": {
307
+ "command": "transaction_sample_data",
308
+ "payload": [
309
+ "agentRunId1",
310
+ [
311
+ [
312
+ 946688461,
313
+ 9967,
314
+ "WebTransaction/Action/FooBar",
315
+ "http://localhost/MyApp/FooBar",
316
+ "eJxVjk9rwzAMxb+LzkmWP05q79YNdutpgx1KKEqqZIbGLpY9KCHfvXbHDgUh6b33A+moRNdJKbqqKLN1S3Ws6iYK0Xaxg7PWf9K8kPHwSPsMltv7BZkhbQfyP/YMfbYCzhHae+/0EDwxvK7giK/WMBXs0YdoQV2WsGUQmNwzutxO+G9ELspfvARKsDbRN6zHB2hwScA3DV8ODePotTUv+7/xYe0buviZccUc9DldlM2gqG3ycVdRLsZmytUk61ypVkyTUkJWO9i2/g7A4VcY",
317
+ "283b9e53-c71e-4c3f-9f82-9954ff994817",
318
+ null,
319
+ false,
320
+ null,
321
+ null
322
+ ]
323
+ ]
324
+ ]
325
+ }
326
+ }
327
+ ]
328
+ },
329
+ {
330
+ "title": "happy_error_data",
331
+ "comment": "Verifies that the agent serializes error traces correctly and sends them to the right endpoint",
332
+ "steps": [
333
+ {
334
+ "composite_step": "startup"
335
+ },
336
+ {
337
+ "event_error": {
338
+ "payload": {
339
+ "timestamp": "2000-01-01 01:01:01",
340
+ "path": "WebTransaction/Action/FooBar",
341
+ "message": "Oh no!",
342
+ "exception_class_name": "System.Exception",
343
+ "attributes": {
344
+ "stack_trace": [
345
+ "at SomeMethod1()",
346
+ "at SomeMethod2()"
347
+ ],
348
+ "agent_attributes": {
349
+ "response.status": "200"
350
+ },
351
+ "user_attributes": {
352
+ "my_attribute": "my_value"
353
+ },
354
+ "intrinsic_attributes": {},
355
+ "request_uri": "http://localhost/MyApp/FooBar"
356
+ },
357
+ "guid": "283b9e53-c71e-4c3f-9f82-9954ff994817"
358
+ }
359
+ }
360
+ },
361
+ {
362
+ "event_harvest_errors": {}
363
+ },
364
+ {
365
+ "expect_request": {
366
+ "command": "error_data",
367
+ "payload": [
368
+ "agentRunId1",
369
+ [
370
+ [
371
+ 946688461,
372
+ "WebTransaction/Action/FooBar",
373
+ "Oh no!",
374
+ "System.Exception",
375
+ {
376
+ "stack_trace": [
377
+ "at SomeMethod1()",
378
+ "at SomeMethod2()"
379
+ ],
380
+ "agentAttributes": {
381
+ "response.status": "200"
382
+ },
383
+ "userAttributes": {
384
+ "my_attribute": "my_value"
385
+ },
386
+ "intrinsics": {},
387
+ "request_uri": "http://localhost/MyApp/FooBar"
388
+ },
389
+ "283b9e53-c71e-4c3f-9f82-9954ff994817"
390
+ ]
391
+ ]
392
+ ]
393
+ }
394
+ }
395
+ ]
396
+ },
397
+ {
398
+ "title": "happy_sql_trace_data",
399
+ "comment": "Verifies that the agent serializes SQL traces correctly and sends them to the right endpoint",
400
+ "steps": [
401
+ {
402
+ "composite_step": "startup"
403
+ },
404
+ {
405
+ "event_sql_trace": {
406
+ "payload": {
407
+ "transaction_name": "WebTransaction/Action/FooBar",
408
+ "uri": "http://localhost/MyApp/FooBar",
409
+ "sql_id": 123,
410
+ "sql": "SELECT * FROM foo",
411
+ "database_metric_name": "Datastore/statement/Postgres/MyTable/select",
412
+ "call_time": 1,
413
+ "parameter_data": {}
414
+ }
415
+ }
416
+ },
417
+ {
418
+ "event_sql_trace": {
419
+ "payload": {
420
+ "transaction_name": "WebTransaction/Action/FooBar",
421
+ "uri": "http://localhost/MyApp/FooBar",
422
+ "sql_id": 123,
423
+ "sql": "SELECT * FROM foo",
424
+ "database_metric_name": "Datastore/statement/Postgres/MyTable/select",
425
+ "call_time": 9001,
426
+ "parameter_data": {}
427
+ }
428
+ }
429
+ },
430
+ {
431
+ "event_harvest_sql_traces": {}
432
+ },
433
+ {
434
+ "expect_request": {
435
+ "command": "sql_trace_data",
436
+ "payload": [
437
+ [
438
+ [
439
+ "WebTransaction/Action/FooBar",
440
+ "http://localhost/MyApp/FooBar",
441
+ 123,
442
+ "SELECT * FROM foo",
443
+ "Datastore/statement/Postgres/MyTable/select",
444
+ 2,
445
+ 9002,
446
+ 1,
447
+ 9001,
448
+ "eJyrrgUAAXUA+Q=="
449
+ ]
450
+ ]
451
+ ]
452
+ }
453
+ }
454
+ ]
455
+ },
456
+ {
457
+ "title": "harvest_force_restart",
458
+ "comment": "Verifies that the agent restarts when told to and doesn't resend sent data",
459
+ "steps": [
460
+ {
461
+ "composite_step": "startup"
462
+ },
463
+ {
464
+ "event_metric": {
465
+ "payload": {
466
+ "name": "DotNet/DefaultController/FooBar",
467
+ "time": 2
468
+ }
469
+ }
470
+ },
471
+ {
472
+ "event_harvest_metrics": {}
473
+ },
474
+ {
475
+ "expect_request": {
476
+ "command": "metric_data",
477
+ "response_payload": {
478
+ "exception": {
479
+ "error_type": "NewRelic::Agent::ForceRestartException"
480
+ }
481
+ }
482
+ }
483
+ },
484
+ {
485
+ "composite_step": "get_redirect_host"
486
+ },
487
+ {
488
+ "expect_request": {
489
+ "command": "connect",
490
+ "response_payload": {
491
+ "return_value": {
492
+ "agent_run_id": "agentRunId2"
493
+ }
494
+ }
495
+ }
496
+ },
497
+ {
498
+ "expect_request": {
499
+ "command": "agent_settings",
500
+ "agent_run_id": "agentRunId2"
501
+ }
502
+ },
503
+ {
504
+ "event_metric": {
505
+ "payload": {
506
+ "name": "DotNet/DefaultController/ApplePie",
507
+ "time": 2
508
+ }
509
+ }
510
+ },
511
+ {
512
+ "event_harvest_metrics": {}
513
+ },
514
+ {
515
+ "expect_request": {
516
+ "command": "metric_data",
517
+ "agent_run_id": "agentRunId2",
518
+ "payload": [
519
+ "agentRunId2",
520
+ "__ANY_FLOAT__",
521
+ "__ANY_FLOAT__",
522
+ [
523
+ [
524
+ {
525
+ "name": "DotNet/DefaultController/ApplePie"
526
+ },
527
+ [
528
+ 1,
529
+ 2,
530
+ 2,
531
+ 2,
532
+ 2,
533
+ 4
534
+ ]
535
+ ]
536
+ ]
537
+ ]
538
+ }
539
+ }
540
+ ]
541
+ },
542
+ {
543
+ "title": "harvest_force_disconnect",
544
+ "comment": "Verifies that the agent shuts down when told to",
545
+ "steps": [
546
+ {
547
+ "composite_step": "startup"
548
+ },
549
+ {
550
+ "event_metric": {
551
+ "payload": {
552
+ "name": "DotNet/DefaultController/FooBar",
553
+ "time": 2
554
+ }
555
+ }
556
+ },
557
+ {
558
+ "event_harvest_metrics": {}
559
+ },
560
+ {
561
+ "expect_request": {
562
+ "command": "metric_data",
563
+ "response_payload": {
564
+ "exception": {
565
+ "error_type": "NewRelic::Agent::ForceDisconnectException"
566
+ }
567
+ }
568
+ }
569
+ },
570
+ {
571
+ "event_metric": {
572
+ "payload": {
573
+ "name": "DotNet/DefaultController/ApplePie",
574
+ "time": 2
575
+ }
576
+ }
577
+ },
578
+ {
579
+ "event_harvest_metrics": {}
580
+ },
581
+ {
582
+ "expect_no_request": {}
583
+ }
584
+ ]
585
+ },
586
+ {
587
+ "title": "restart_agent_command",
588
+ "comment": "Verifies that agent responds to the Restart command and doesn't send data collected before the restart",
589
+ "steps": [
590
+ {
591
+ "composite_step": "startup"
592
+ },
593
+ {
594
+ "event_metric": {
595
+ "payload": {
596
+ "name": "DotNet/DefaultController/FooBar",
597
+ "time": 2
598
+ }
599
+ }
600
+ },
601
+ {
602
+ "event_get_agent_commands": {}
603
+ },
604
+ {
605
+ "expect_request": {
606
+ "command": "get_agent_commands",
607
+ "payload": [
608
+ "agentRunId1"
609
+ ],
610
+ "response_payload": {
611
+ "return_value": [
612
+ [
613
+ 1,
614
+ {
615
+ "name": "restart",
616
+ "arguments": {}
617
+ }
618
+ ]
619
+ ]
620
+ }
621
+ }
622
+ },
623
+ {
624
+ "composite_step": "get_redirect_host"
625
+ },
626
+ {
627
+ "expect_request": {
628
+ "command": "connect",
629
+ "response_payload": {
630
+ "return_value": {
631
+ "agent_run_id": "agentRunId2"
632
+ }
633
+ }
634
+ }
635
+ },
636
+ {
637
+ "expect_request": {
638
+ "command": "agent_settings",
639
+ "agent_run_id": "agentRunId2"
640
+ }
641
+ },
642
+ {
643
+ "expect_request": {
644
+ "command": "agent_command_results",
645
+ "agent_run_id": "agentRunId2",
646
+ "payload": [
647
+ "agentRunId2",
648
+ {
649
+ "1": null
650
+ }
651
+ ]
652
+ }
653
+ },
654
+ {
655
+ "event_metric": {
656
+ "payload": {
657
+ "name": "DotNet/DefaultController/ApplePie",
658
+ "time": 2
659
+ }
660
+ }
661
+ },
662
+ {
663
+ "event_harvest_metrics": {}
664
+ },
665
+ {
666
+ "expect_request": {
667
+ "command": "metric_data",
668
+ "agent_run_id": "agentRunId2",
669
+ "payload": [
670
+ "agentRunId2",
671
+ "__ANY_FLOAT__",
672
+ "__ANY_FLOAT__",
673
+ [
674
+ [
675
+ {
676
+ "name": "DotNet/DefaultController/ApplePie"
677
+ },
678
+ [
679
+ 1,
680
+ 2,
681
+ 2,
682
+ 2,
683
+ 2,
684
+ 4
685
+ ]
686
+ ]
687
+ ]
688
+ ]
689
+ }
690
+ }
691
+ ]
692
+ },
693
+ {
694
+ "title": "shutdown_agent_command",
695
+ "comment": "Verifies that agent responds to the Shutdown command and does not do a final harvest",
696
+ "steps": [
697
+ {
698
+ "composite_step": "startup"
699
+ },
700
+ {
701
+ "event_metric": {
702
+ "payload": {
703
+ "name": "DotNet/DefaultController/FooBar",
704
+ "time": 2
705
+ }
706
+ }
707
+ },
708
+ {
709
+ "event_get_agent_commands": {}
710
+ },
711
+ {
712
+ "expect_request": {
713
+ "command": "get_agent_commands",
714
+ "payload": [
715
+ "agentRunId1"
716
+ ],
717
+ "response_payload": {
718
+ "return_value": [
719
+ [
720
+ 1,
721
+ {
722
+ "name": "shutdown",
723
+ "arguments": {}
724
+ }
725
+ ]
726
+ ]
727
+ }
728
+ }
729
+ },
730
+ {
731
+ "event_metric": {
732
+ "payload": {
733
+ "name": "DotNet/DefaultController/ApplePie",
734
+ "time": 2
735
+ }
736
+ }
737
+ },
738
+ {
739
+ "event_harvest_metrics": {}
740
+ },
741
+ {
742
+ "expect_no_request": {}
743
+ }
744
+ ]
745
+ },
746
+ {
747
+ "title": "local_config_update",
748
+ "comment": "Verifies that agent reconnects and discards all previously collected data if local configuration changes are made",
749
+ "steps": [
750
+ {
751
+ "composite_step": "startup"
752
+ },
753
+ {
754
+ "event_metric": {
755
+ "payload": {
756
+ "name": "DotNet/DefaultController/FooBar",
757
+ "time": 2
758
+ }
759
+ }
760
+ },
761
+ {
762
+ "event_local_config_update": {}
763
+ },
764
+ {
765
+ "expect_request": {
766
+ "command": "shutdown"
767
+ }
768
+ },
769
+ {
770
+ "composite_step": "get_redirect_host"
771
+ },
772
+ {
773
+ "expect_request": {
774
+ "command": "connect",
775
+ "response_payload": {
776
+ "return_value": {
777
+ "agent_run_id": "agentRunId2"
778
+ }
779
+ }
780
+ }
781
+ },
782
+ {
783
+ "expect_request": {
784
+ "command": "agent_settings",
785
+ "agent_run_id": "agentRunId2"
786
+ }
787
+ },
788
+ {
789
+ "event_metric": {
790
+ "payload": {
791
+ "name": "DotNet/DefaultController/ApplePie",
792
+ "time": 2
793
+ }
794
+ }
795
+ },
796
+ {
797
+ "event_harvest_metrics": {}
798
+ },
799
+ {
800
+ "expect_request": {
801
+ "command": "metric_data",
802
+ "agent_run_id": "agentRunId2",
803
+ "payload": [
804
+ "agentRunId2",
805
+ "__ANY_FLOAT__",
806
+ "__ANY_FLOAT__",
807
+ [
808
+ [
809
+ {
810
+ "name": "DotNet/DefaultController/ApplePie"
811
+ },
812
+ [
813
+ 1,
814
+ 2,
815
+ 2,
816
+ 2,
817
+ 2,
818
+ 4
819
+ ]
820
+ ]
821
+ ]
822
+ ]
823
+ }
824
+ }
825
+ ]
826
+ },
827
+ {
828
+ "title": "final_harvest",
829
+ "comment": "Verifies that the agent does a final harvest before shutting down",
830
+ "steps": [
831
+ {
832
+ "composite_step": "startup"
833
+ },
834
+ {
835
+ "event_metric": {
836
+ "payload": {
837
+ "name": "DotNet/DefaultController/FooBar",
838
+ "time": 2
839
+ }
840
+ }
841
+ },
842
+ {
843
+ "event_agent_shutting_down": {}
844
+ },
845
+ {
846
+ "expect_request": {
847
+ "command": "metric_data",
848
+ "payload": [
849
+ "agentRunId1",
850
+ "__ANY_FLOAT__",
851
+ "__ANY_FLOAT__",
852
+ [
853
+ [
854
+ {
855
+ "name": "DotNet/DefaultController/FooBar"
856
+ },
857
+ [
858
+ 1,
859
+ 2,
860
+ 2,
861
+ 2,
862
+ 2,
863
+ 4
864
+ ]
865
+ ]
866
+ ]
867
+ ]
868
+ }
869
+ },
870
+ {
871
+ "expect_request": {
872
+ "command": "shutdown"
873
+ }
874
+ }
875
+ ]
876
+ },
877
+ {
878
+ "title": "harvest_successful",
879
+ "comment": "Verifies that the agent does not retain any data after a successful harvest",
880
+ "steps": [
881
+ {
882
+ "composite_step": "startup"
883
+ },
884
+ {
885
+ "event_transaction_event": {
886
+ "payload": {
887
+ "intrinsic_attributes": {
888
+ "name": "WebTransaction/Action/FooBar",
889
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
890
+ "timestamp": 12345,
891
+ "duration": 6.789
892
+ },
893
+ "user_attributes": {},
894
+ "agent_attributes": {}
895
+ }
896
+ }
897
+ },
898
+ {
899
+ "event_harvest_transaction_events": {}
900
+ },
901
+ {
902
+ "expect_request": {
903
+ "command": "analytic_event_data",
904
+ "payload": [
905
+ "agentRunId1",
906
+ [
907
+ [
908
+ {
909
+ "type": "Transaction",
910
+ "name": "WebTransaction/Action/FooBar",
911
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
912
+ "timestamp": 12345,
913
+ "duration": 6.789
914
+ },
915
+ {},
916
+ {}
917
+ ]
918
+ ]
919
+ ]
920
+ }
921
+ },
922
+ {
923
+ "event_harvest_transaction_events": {}
924
+ },
925
+ {
926
+ "expect_no_request": {}
927
+ }
928
+ ]
929
+ },
930
+ {
931
+ "title": "harvest_service_unavailable",
932
+ "comment": "Verifies that the agent retains all data after receiving a 503 status code during a harvest",
933
+ "steps": [
934
+ {
935
+ "composite_step": "startup"
936
+ },
937
+ {
938
+ "event_transaction_event": {
939
+ "payload": {
940
+ "intrinsic_attributes": {
941
+ "name": "WebTransaction/Action/FooBar",
942
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
943
+ "timestamp": 12345,
944
+ "duration": 6.789
945
+ },
946
+ "user_attributes": {},
947
+ "agent_attributes": {}
948
+ }
949
+ }
950
+ },
951
+ {
952
+ "event_transaction_event": {
953
+ "payload": {
954
+ "intrinsic_attributes": {
955
+ "name": "WebTransaction/Action/FooBar",
956
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
957
+ "timestamp": 12345,
958
+ "duration": 6.789
959
+ },
960
+ "user_attributes": {},
961
+ "agent_attributes": {}
962
+ }
963
+ }
964
+ },
965
+ {
966
+ "event_harvest_transaction_events": {}
967
+ },
968
+ {
969
+ "expect_request": {
970
+ "command": "analytic_event_data",
971
+ "payload": [
972
+ "agentRunId1",
973
+ [
974
+ [
975
+ {
976
+ "type": "Transaction",
977
+ "name": "WebTransaction/Action/FooBar",
978
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
979
+ "timestamp": 12345,
980
+ "duration": 6.789
981
+ },
982
+ {},
983
+ {}
984
+ ],
985
+ [
986
+ {
987
+ "type": "Transaction",
988
+ "name": "WebTransaction/Action/FooBar",
989
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
990
+ "timestamp": 12345,
991
+ "duration": 6.789
992
+ },
993
+ {},
994
+ {}
995
+ ]
996
+ ]
997
+ ],
998
+ "response_status_code": 503
999
+ }
1000
+ },
1001
+ {
1002
+ "event_harvest_transaction_events": {}
1003
+ },
1004
+ {
1005
+ "expect_request": {
1006
+ "command": "analytic_event_data",
1007
+ "payload": [
1008
+ "agentRunId1",
1009
+ [
1010
+ [
1011
+ {
1012
+ "type": "Transaction",
1013
+ "name": "WebTransaction/Action/FooBar",
1014
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1015
+ "timestamp": 12345,
1016
+ "duration": 6.789
1017
+ },
1018
+ {},
1019
+ {}
1020
+ ],
1021
+ [
1022
+ {
1023
+ "type": "Transaction",
1024
+ "name": "WebTransaction/Action/FooBar",
1025
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1026
+ "timestamp": 12345,
1027
+ "duration": 6.789
1028
+ },
1029
+ {},
1030
+ {}
1031
+ ]
1032
+ ]
1033
+ ]
1034
+ }
1035
+ }
1036
+ ]
1037
+ },
1038
+ {
1039
+ "title": "harvest_post_too_big",
1040
+ "comment": "Verifies that the agent retains half of the data after receiving a PostTooBigException during a harvest",
1041
+ "steps": [
1042
+ {
1043
+ "composite_step": "startup"
1044
+ },
1045
+ {
1046
+ "event_transaction_event": {
1047
+ "payload": {
1048
+ "intrinsic_attributes": {
1049
+ "name": "WebTransaction/Action/FooBar",
1050
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1051
+ "timestamp": 12345,
1052
+ "duration": 6.789
1053
+ },
1054
+ "user_attributes": {},
1055
+ "agent_attributes": {}
1056
+ }
1057
+ }
1058
+ },
1059
+ {
1060
+ "event_transaction_event": {
1061
+ "payload": {
1062
+ "intrinsic_attributes": {
1063
+ "name": "WebTransaction/Action/FooBar",
1064
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1065
+ "timestamp": 12345,
1066
+ "duration": 6.789
1067
+ },
1068
+ "user_attributes": {},
1069
+ "agent_attributes": {}
1070
+ }
1071
+ }
1072
+ },
1073
+ {
1074
+ "event_harvest_transaction_events": {}
1075
+ },
1076
+ {
1077
+ "expect_request": {
1078
+ "command": "analytic_event_data",
1079
+ "payload": [
1080
+ "agentRunId1",
1081
+ [
1082
+ [
1083
+ {
1084
+ "type": "Transaction",
1085
+ "name": "WebTransaction/Action/FooBar",
1086
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1087
+ "timestamp": 12345,
1088
+ "duration": 6.789
1089
+ },
1090
+ {},
1091
+ {}
1092
+ ],
1093
+ [
1094
+ {
1095
+ "type": "Transaction",
1096
+ "name": "WebTransaction/Action/FooBar",
1097
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1098
+ "timestamp": 12345,
1099
+ "duration": 6.789
1100
+ },
1101
+ {},
1102
+ {}
1103
+ ]
1104
+ ]
1105
+ ],
1106
+ "response_payload": {
1107
+ "exception": {
1108
+ "error_type": "NewRelic::Agent::PostTooBigException"
1109
+ }
1110
+ }
1111
+ }
1112
+ },
1113
+ {
1114
+ "event_harvest_transaction_events": {}
1115
+ },
1116
+ {
1117
+ "expect_request": {
1118
+ "command": "analytic_event_data",
1119
+ "payload": [
1120
+ "agentRunId1",
1121
+ [
1122
+ [
1123
+ {
1124
+ "type": "Transaction",
1125
+ "name": "WebTransaction/Action/FooBar",
1126
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1127
+ "timestamp": 12345,
1128
+ "duration": 6.789
1129
+ },
1130
+ {},
1131
+ {}
1132
+ ]
1133
+ ]
1134
+ ]
1135
+ }
1136
+ }
1137
+ ]
1138
+ },
1139
+ {
1140
+ "title": "harvest_unexpected_server_error",
1141
+ "comment": "Verifies that the agent discards all data after receiving any unexpected status code during a harvest",
1142
+ "steps": [
1143
+ {
1144
+ "composite_step": "startup"
1145
+ },
1146
+ {
1147
+ "event_transaction_event": {
1148
+ "payload": {
1149
+ "intrinsic_attributes": {
1150
+ "name": "WebTransaction/Action/FooBar",
1151
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1152
+ "timestamp": 12345,
1153
+ "duration": 6.789
1154
+ },
1155
+ "user_attributes": {},
1156
+ "agent_attributes": {}
1157
+ }
1158
+ }
1159
+ },
1160
+ {
1161
+ "event_harvest_transaction_events": {}
1162
+ },
1163
+ {
1164
+ "expect_request": {
1165
+ "command": "analytic_event_data",
1166
+ "payload": [
1167
+ "agentRunId1",
1168
+ [
1169
+ [
1170
+ {
1171
+ "type": "Transaction",
1172
+ "name": "WebTransaction/Action/FooBar",
1173
+ "nr.guid": "283b9e53-c71e-4c3f-9f82-9954ff994817",
1174
+ "timestamp": 12345,
1175
+ "duration": 6.789
1176
+ },
1177
+ {},
1178
+ {}
1179
+ ]
1180
+ ]
1181
+ ],
1182
+ "response_status_code": 451
1183
+ }
1184
+ },
1185
+ {
1186
+ "event_harvest_transaction_events": {}
1187
+ },
1188
+ {
1189
+ "expect_no_request": {}
1190
+ }
1191
+ ]
1192
+ },
1193
+ {
1194
+ "title": "harvest_connection_error",
1195
+ "comment": "Verifies that the agent retains all data after a connection error during a harvest",
1196
+ "steps": []
1197
+ },
1198
+ {
1199
+ "title": "harvest_runtime_error",
1200
+ "comment": "Verifies that the agent discards all data after a runtime error during a harvest",
1201
+ "steps": []
1202
+ },
1203
+ {
1204
+ "title": "thread_profiler",
1205
+ "comment": "Verifies that agents handle thread profiling appropriately",
1206
+ "steps": [
1207
+ {
1208
+ "composite_step": "startup"
1209
+ },
1210
+ {
1211
+ "event_metric": {
1212
+ "payload": {
1213
+ "name": "DotNet/DefaultController/FooBar",
1214
+ "time": 2
1215
+ }
1216
+ }
1217
+ },
1218
+ {
1219
+ "event_get_agent_commands": {}
1220
+ },
1221
+ {
1222
+ "expect_request": {
1223
+ "command": "get_agent_commands",
1224
+ "payload": [
1225
+ "agentRunId1"
1226
+ ],
1227
+ "response_payload": {
1228
+ "return_value": [
1229
+ [
1230
+ 1,
1231
+ {
1232
+ "name": "start_profiler",
1233
+ "arguments": {}
1234
+ }
1235
+ ]
1236
+ ]
1237
+ }
1238
+ }
1239
+ },
1240
+ {
1241
+ "expect_request": {
1242
+ "command": "agent_command_results",
1243
+ "payload": [
1244
+ "agentRunId1",
1245
+ {
1246
+ "1": null
1247
+ }
1248
+ ]
1249
+ }
1250
+ },
1251
+ {
1252
+ "event_get_agent_commands": {}
1253
+ },
1254
+ {
1255
+ "expect_request": {
1256
+ "command": "get_agent_commands",
1257
+ "payload": [
1258
+ "agentRunId1"
1259
+ ],
1260
+ "response_payload": {
1261
+ "return_value": [
1262
+ [
1263
+ 2,
1264
+ {
1265
+ "name": "stop_profiler",
1266
+ "arguments": {}
1267
+ }
1268
+ ]
1269
+ ]
1270
+ }
1271
+ }
1272
+ },
1273
+ {
1274
+ "expect_request": {
1275
+ "command": "agent_command_results",
1276
+ "payload": [
1277
+ "agentRunId1",
1278
+ {
1279
+ "2": null
1280
+ }
1281
+ ]
1282
+ }
1283
+ },
1284
+ {
1285
+ "expect_request": {
1286
+ "command": "profile_data"
1287
+ }
1288
+ }
1289
+ ]
1290
+ },
1291
+ {
1292
+ "title": "connect_failure_retries",
1293
+ "comment": "Verifies that the agent retries after failing to connect and discards data collected between retries",
1294
+ "steps": [
1295
+ {
1296
+ "event_agent_start": {
1297
+ "payload": {
1298
+ "host": "collector.newrelic.com",
1299
+ "port": 443,
1300
+ "license_key": "licenseKey1"
1301
+ }
1302
+ }
1303
+ },
1304
+ {
1305
+ "expect_request": {
1306
+ "command": "get_redirect_host",
1307
+ "host": "collector.newrelic.com",
1308
+ "port": 443,
1309
+ "license_key": "licenseKey1",
1310
+ "response_status_code": 503
1311
+ }
1312
+ },
1313
+ {
1314
+ "event_metric": {
1315
+ "payload": {
1316
+ "name": "DotNet/DefaultController/FooBar",
1317
+ "time": 2
1318
+ }
1319
+ }
1320
+ },
1321
+ {
1322
+ "event_harvest_metrics": {}
1323
+ },
1324
+ {
1325
+ "event_retry_connect": {}
1326
+ },
1327
+ {
1328
+ "composite_step": "get_redirect_host"
1329
+ },
1330
+ {
1331
+ "expect_request": {
1332
+ "command": "connect",
1333
+ "response_payload": {
1334
+ "return_value": {
1335
+ "agent_run_id": "agentRunId1"
1336
+ }
1337
+ }
1338
+ }
1339
+ },
1340
+ {
1341
+ "expect_request": {
1342
+ "command": "agent_settings",
1343
+ "agent_run_id": "agentRunId1"
1344
+ }
1345
+ },
1346
+ {
1347
+ "event_metric": {
1348
+ "payload": {
1349
+ "name": "DotNet/DefaultController/ApplePie",
1350
+ "time": 2
1351
+ }
1352
+ }
1353
+ },
1354
+ {
1355
+ "event_harvest_metrics": {}
1356
+ },
1357
+ {
1358
+ "expect_request": {
1359
+ "command": "metric_data",
1360
+ "agent_run_id": "agentRunId1",
1361
+ "payload": [
1362
+ "agentRunId1",
1363
+ "__ANY_FLOAT__",
1364
+ "__ANY_FLOAT__",
1365
+ [
1366
+ [
1367
+ {
1368
+ "name": "DotNet/DefaultController/ApplePie"
1369
+ },
1370
+ [
1371
+ 1,
1372
+ 2,
1373
+ 2,
1374
+ 2,
1375
+ 2,
1376
+ 4
1377
+ ]
1378
+ ]
1379
+ ]
1380
+ ]
1381
+ }
1382
+ }
1383
+ ]
1384
+ }
1385
+ ],
1386
+ "composite_steps": [
1387
+ {
1388
+ "name": "get_redirect_host",
1389
+ "steps": [
1390
+ {
1391
+ "expect_request": {
1392
+ "host": "collector.newrelic.com",
1393
+ "port": 443,
1394
+ "command": "get_redirect_host",
1395
+ "response_payload": {
1396
+ "return_value": "collector55.newrelic.com"
1397
+ }
1398
+ }
1399
+ }
1400
+ ]
1401
+ },
1402
+ {
1403
+ "name": "startup",
1404
+ "steps": [
1405
+ {
1406
+ "event_agent_start": {
1407
+ "payload": {
1408
+ "host": "collector.newrelic.com",
1409
+ "port": 443,
1410
+ "license_key": "licenseKey1"
1411
+ }
1412
+ }
1413
+ },
1414
+ {
1415
+ "composite_step": "get_redirect_host"
1416
+ },
1417
+ {
1418
+ "expect_request": {
1419
+ "command": "connect",
1420
+ "host": "collector55.newrelic.com",
1421
+ "port": 443,
1422
+ "response_payload": {
1423
+ "return_value": {
1424
+ "agent_run_id": "agentRunId1"
1425
+ }
1426
+ }
1427
+ }
1428
+ },
1429
+ {
1430
+ "expect_request": {
1431
+ "command": "agent_settings",
1432
+ "host": "collector55.newrelic.com",
1433
+ "port": 443,
1434
+ "license_key": "licenseKey1",
1435
+ "agent_run_id": "agentRunId1"
1436
+ }
1437
+ }
1438
+ ]
1439
+ }
1440
+ ]
1441
+ }