newrelic_rpm 3.9.0.229 → 3.9.1.236
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +4 -1
- data/CHANGELOG +73 -0
- data/install.rb +2 -2
- data/lib/new_relic/agent/agent.rb +8 -1
- data/lib/new_relic/agent/browser_token.rb +10 -7
- data/lib/new_relic/agent/configuration/default_source.rb +8 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +56 -0
- data/lib/new_relic/agent/configuration/manager.rb +35 -28
- data/lib/new_relic/agent/cross_app_monitor.rb +23 -0
- data/lib/new_relic/agent/cross_app_tracing.rb +34 -26
- data/lib/new_relic/agent/database.rb +7 -6
- data/lib/new_relic/agent/instrumentation/active_record.rb +18 -18
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +18 -15
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +7 -4
- data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +9 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +6 -4
- data/lib/new_relic/agent/javascript_instrumentor.rb +9 -1
- data/lib/new_relic/agent/new_relic_service.rb +7 -0
- data/lib/new_relic/agent/obfuscator.rb +3 -2
- data/lib/new_relic/agent/request_sampler.rb +17 -1
- data/lib/new_relic/agent/sql_sampler.rb +10 -6
- data/lib/new_relic/agent/traced_method_stack.rb +0 -12
- data/lib/new_relic/agent/transaction.rb +98 -10
- data/lib/new_relic/agent/transaction_sampler.rb +10 -3
- data/lib/new_relic/agent/transaction_state.rb +2 -12
- data/lib/new_relic/control/frameworks/sinatra.rb +0 -3
- data/lib/new_relic/control/instance_methods.rb +5 -0
- data/lib/new_relic/json_wrapper.rb +7 -1
- data/lib/new_relic/rack/browser_monitoring.rb +25 -4
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +0 -1
- data/test/agent_helper.rb +76 -0
- data/test/fixtures/cross_agent_tests/cat_map.json +299 -0
- data/test/multiverse/suites/agent_only/collector_exception_handling_test.rb +16 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +30 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +17 -17
- data/test/multiverse/suites/agent_only/testing_app.rb +10 -1
- data/test/multiverse/suites/deferred_instrumentation/config/newrelic.yml +0 -1
- data/test/multiverse/suites/high_security/Envfile +3 -0
- data/test/multiverse/suites/high_security/config/newrelic.yml +27 -0
- data/test/multiverse/suites/high_security/high_security_test.rb +64 -0
- data/test/multiverse/suites/rails/action_controller_live_rum_test.rb +39 -0
- data/test/multiverse/suites/rails/bad_instrumentation_test.rb +3 -1
- data/test/multiverse/suites/rails/parameter_capture_test.rb +0 -20
- data/test/new_relic/agent/agent/connect_test.rb +5 -10
- data/test/new_relic/agent/agent_test.rb +11 -0
- data/test/new_relic/agent/browser_token_test.rb +10 -6
- data/test/new_relic/agent/configuration/default_source_test.rb +6 -0
- data/test/new_relic/agent/configuration/high_security_source_test.rb +83 -0
- data/test/new_relic/agent/configuration/manager_test.rb +7 -2
- data/test/new_relic/agent/cross_app_monitor_test.rb +17 -1
- data/test/new_relic/agent/cross_app_tracing_test.rb +11 -10
- data/test/new_relic/agent/hostname_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +22 -0
- data/test/new_relic/agent/instrumentation/middleware_tracing_test.rb +37 -0
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +4 -2
- data/test/new_relic/agent/javascript_instrumentor_test.rb +42 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +11 -5
- data/test/new_relic/agent/request_sampler_test.rb +9 -0
- data/test/new_relic/agent/sql_sampler_test.rb +46 -0
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +1 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +64 -4
- data/test/new_relic/agent/transaction_state_test.rb +0 -75
- data/test/new_relic/agent/transaction_test.rb +142 -0
- data/test/new_relic/control/instance_methods_test.rb +24 -4
- data/test/new_relic/fake_collector.rb +6 -13
- data/test/new_relic/fake_external_server.rb +14 -1
- data/test/new_relic/http_client_test_cases.rb +69 -21
- data/test/new_relic/json_wrapper_test.rb +10 -5
- data/test/performance/suites/rack_middleware.rb +2 -1
- data/test/performance/suites/rum_autoinsertion.rb +17 -3
- data/test/script/path_hash.rb +49 -0
- data/test/test_helper.rb +0 -10
- metadata +12 -52
- metadata.gz.sig +0 -0
@@ -0,0 +1,299 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"name": "new_cat",
|
4
|
+
"appName": "testAppName",
|
5
|
+
"transactionName": "WebTransaction/testTxnName",
|
6
|
+
"transactionGuid": "9323dc260548ed0e",
|
7
|
+
"referringPayload": [
|
8
|
+
"b854df4feb2b1f06",
|
9
|
+
false,
|
10
|
+
"7e249074f277923d",
|
11
|
+
"5d2957be"
|
12
|
+
],
|
13
|
+
"expectedAttributes": {
|
14
|
+
"nr.guid": "9323dc260548ed0e",
|
15
|
+
"nr.tripId": "7e249074f277923d",
|
16
|
+
"nr.pathHash": "169d655a",
|
17
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06",
|
18
|
+
"nr.referringPathHash": "5d2957be"
|
19
|
+
},
|
20
|
+
"nonExpectedAttributes": [
|
21
|
+
"nr.alternatePathHashes"
|
22
|
+
]
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"name": "new_cat_path_hash_with_leading_zero",
|
26
|
+
"appName": "testAppName",
|
27
|
+
"transactionName": "WebTransaction/txn7",
|
28
|
+
"transactionGuid": "9323dc260548ed0e",
|
29
|
+
"referringPayload": [
|
30
|
+
"b854df4feb2b1f06",
|
31
|
+
false,
|
32
|
+
"7e249074f277923d",
|
33
|
+
"5d2957be"
|
34
|
+
],
|
35
|
+
"expectedAttributes": {
|
36
|
+
"nr.guid": "9323dc260548ed0e",
|
37
|
+
"nr.tripId": "7e249074f277923d",
|
38
|
+
"nr.pathHash": "04429689",
|
39
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06",
|
40
|
+
"nr.referringPathHash": "5d2957be"
|
41
|
+
},
|
42
|
+
"nonExpectedAttributes": [
|
43
|
+
"nr.alternatePathHashes"
|
44
|
+
]
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"name": "new_cat_no_referring_payload",
|
48
|
+
"appName": "testAppName",
|
49
|
+
"transactionName": "WebTransaction/testTxnName",
|
50
|
+
"transactionGuid": "9323dc260548ed0e",
|
51
|
+
"referringPayload": null,
|
52
|
+
"expectedAttributes": {},
|
53
|
+
"nonExpectedAttributes": [
|
54
|
+
"nr.guid",
|
55
|
+
"nr.tripId",
|
56
|
+
"nr.pathHash",
|
57
|
+
"nr.referringTransactionGuid",
|
58
|
+
"nr.referringPathHash",
|
59
|
+
"nr.alternatePathHashes"
|
60
|
+
]
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"name": "new_cat_with_call_out",
|
64
|
+
"appName": "testAppName",
|
65
|
+
"transactionName": "WebTransaction/testTxnName",
|
66
|
+
"transactionGuid": "9323dc260548ed0e",
|
67
|
+
"referringPayload": null,
|
68
|
+
"outgoingTxnNames": [
|
69
|
+
"WebTransaction/testTxnName"
|
70
|
+
],
|
71
|
+
"expectedAttributes": {
|
72
|
+
"nr.guid": "9323dc260548ed0e",
|
73
|
+
"nr.tripId": "9323dc260548ed0e",
|
74
|
+
"nr.pathHash": "accfca26"
|
75
|
+
},
|
76
|
+
"nonExpectedAttributes": [
|
77
|
+
"nr.referringTransactionGuid",
|
78
|
+
"nr.referringPathHash",
|
79
|
+
"nr.alternatePathHashes"
|
80
|
+
]
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"name": "new_cat_with_multiple_calls_out",
|
84
|
+
"appName": "testAppName",
|
85
|
+
"transactionName": "WebTransaction/testTxnName",
|
86
|
+
"transactionGuid": "9323dc260548ed0e",
|
87
|
+
"referringPayload": null,
|
88
|
+
"outgoingTxnNames": [
|
89
|
+
"WebTransaction/otherTxnName",
|
90
|
+
"WebTransaction/otherTxnName",
|
91
|
+
"WebTransaction/moreOtherTxnName",
|
92
|
+
"WebTransaction/moreDifferentTxnName"
|
93
|
+
],
|
94
|
+
"expectedAttributes": {
|
95
|
+
"nr.guid": "9323dc260548ed0e",
|
96
|
+
"nr.tripId": "9323dc260548ed0e",
|
97
|
+
"nr.pathHash": "accfca26",
|
98
|
+
"nr.alternatePathHashes": "2ab5328c,cf3bc3a8,df3fb1b5"
|
99
|
+
},
|
100
|
+
"nonExpectedAttributes": [
|
101
|
+
"nr.referringTransactionGuid",
|
102
|
+
"nr.referringPathHash"
|
103
|
+
]
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"name": "new_cat_with_many_unique_calls_out",
|
107
|
+
"appName": "testAppName",
|
108
|
+
"transactionName": "WebTransaction/testTxnName",
|
109
|
+
"transactionGuid": "9323dc260548ed0e",
|
110
|
+
"referringPayload": null,
|
111
|
+
"outgoingTxnNames": [
|
112
|
+
"WebTransaction/txn1",
|
113
|
+
"WebTransaction/txn2",
|
114
|
+
"WebTransaction/txn3",
|
115
|
+
"WebTransaction/txn4",
|
116
|
+
"WebTransaction/txn5",
|
117
|
+
"WebTransaction/txn6",
|
118
|
+
"WebTransaction/txn7",
|
119
|
+
"WebTransaction/txn8",
|
120
|
+
"WebTransaction/txn9",
|
121
|
+
"WebTransaction/txn10",
|
122
|
+
"WebTransaction/txn11"
|
123
|
+
],
|
124
|
+
"expectedAttributes": {
|
125
|
+
"nr.guid": "9323dc260548ed0e",
|
126
|
+
"nr.tripId": "9323dc260548ed0e",
|
127
|
+
"nr.pathHash": "accfca26",
|
128
|
+
"nr.alternatePathHashes": "55f97a7f,6fc8d18f,72827114,9a3ed934,a1744603,a7d2798f,be1039f5,ccadfd2c,da7edf2e,eaca716b"
|
129
|
+
},
|
130
|
+
"nonExpectedAttributes": [
|
131
|
+
"nr.referringTransactionGuid",
|
132
|
+
"nr.referringPathHash"
|
133
|
+
]
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"name": "new_cat_with_many_calls_out",
|
137
|
+
"appName": "testAppName",
|
138
|
+
"transactionName": "WebTransaction/testTxnName",
|
139
|
+
"transactionGuid": "9323dc260548ed0e",
|
140
|
+
"referringPayload": null,
|
141
|
+
"outgoingTxnNames": [
|
142
|
+
"WebTransaction/txn1",
|
143
|
+
"WebTransaction/txn1",
|
144
|
+
"WebTransaction/txn1",
|
145
|
+
"WebTransaction/txn1",
|
146
|
+
"WebTransaction/txn1",
|
147
|
+
"WebTransaction/txn1",
|
148
|
+
"WebTransaction/txn1",
|
149
|
+
"WebTransaction/txn1",
|
150
|
+
"WebTransaction/txn1",
|
151
|
+
"WebTransaction/txn1",
|
152
|
+
"WebTransaction/txn1",
|
153
|
+
"WebTransaction/txn2"
|
154
|
+
],
|
155
|
+
"expectedAttributes": {
|
156
|
+
"nr.guid": "9323dc260548ed0e",
|
157
|
+
"nr.tripId": "9323dc260548ed0e",
|
158
|
+
"nr.pathHash": "accfca26",
|
159
|
+
"nr.alternatePathHashes": "55f97a7f,a7d2798f"
|
160
|
+
},
|
161
|
+
"nonExpectedAttributes": [
|
162
|
+
"nr.referringTransactionGuid",
|
163
|
+
"nr.referringPathHash"
|
164
|
+
]
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"name": "new_cat_with_referring_info_and_call_out",
|
168
|
+
"appName": "testAppName",
|
169
|
+
"transactionName": "WebTransaction/testTxnName",
|
170
|
+
"transactionGuid": "9323dc260548ed0e",
|
171
|
+
"referringPayload": [
|
172
|
+
"b854df4feb2b1f06",
|
173
|
+
false,
|
174
|
+
"7e249074f277923d",
|
175
|
+
"5d2957be"
|
176
|
+
],
|
177
|
+
"outgoingTxnNames": [
|
178
|
+
"WebTransaction/otherTxnName"
|
179
|
+
],
|
180
|
+
"expectedAttributes": {
|
181
|
+
"nr.guid": "9323dc260548ed0e",
|
182
|
+
"nr.tripId": "7e249074f277923d",
|
183
|
+
"nr.pathHash": "169d655a",
|
184
|
+
"nr.alternatePathHashes": "656d1ec9",
|
185
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06",
|
186
|
+
"nr.referringPathHash": "5d2957be"
|
187
|
+
},
|
188
|
+
"nonExpectedAttributes": []
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"name": "new_cat_missing_path_hash",
|
192
|
+
"appName": "testAppName",
|
193
|
+
"transactionName": "WebTransaction/testTxnName",
|
194
|
+
"transactionGuid": "9323dc260548ed0e",
|
195
|
+
"referringPayload": [
|
196
|
+
"b854df4feb2b1f06",
|
197
|
+
false,
|
198
|
+
"7e249074f277923d"
|
199
|
+
],
|
200
|
+
"expectedAttributes": {
|
201
|
+
"nr.guid": "9323dc260548ed0e",
|
202
|
+
"nr.tripId": "7e249074f277923d",
|
203
|
+
"nr.pathHash": "accfca26",
|
204
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06"
|
205
|
+
},
|
206
|
+
"nonExpectedAttributes": [
|
207
|
+
"nr.alternatePathHashes",
|
208
|
+
"nr.referringPathHash"
|
209
|
+
]
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"name": "new_cat_null_path_hash",
|
213
|
+
"appName": "testAppName",
|
214
|
+
"transactionName": "WebTransaction/testTxnName",
|
215
|
+
"transactionGuid": "9323dc260548ed0e",
|
216
|
+
"referringPayload": [
|
217
|
+
"b854df4feb2b1f06",
|
218
|
+
false,
|
219
|
+
"7e249074f277923d",
|
220
|
+
null
|
221
|
+
],
|
222
|
+
"expectedAttributes": {
|
223
|
+
"nr.guid": "9323dc260548ed0e",
|
224
|
+
"nr.tripId": "7e249074f277923d",
|
225
|
+
"nr.pathHash": "accfca26",
|
226
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06"
|
227
|
+
},
|
228
|
+
"nonExpectedAttributes": [
|
229
|
+
"nr.alternatePathHashes",
|
230
|
+
"nr.referringPathHash"
|
231
|
+
]
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"name": "new_cat_malformed_path_hash",
|
235
|
+
"appName": "testAppName",
|
236
|
+
"transactionName": "WebTransaction/testTxnName",
|
237
|
+
"transactionGuid": "9323dc260548ed0e",
|
238
|
+
"referringPayload": [
|
239
|
+
"b854df4feb2b1f06",
|
240
|
+
false,
|
241
|
+
"7e249074f277923d",
|
242
|
+
[
|
243
|
+
"scrambled",
|
244
|
+
"eggs"
|
245
|
+
]
|
246
|
+
],
|
247
|
+
"expectedAttributes": {
|
248
|
+
"nr.guid": "9323dc260548ed0e",
|
249
|
+
"nr.tripId": "7e249074f277923d",
|
250
|
+
"nr.pathHash": "accfca26",
|
251
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06"
|
252
|
+
},
|
253
|
+
"nonExpectedAttributes": [
|
254
|
+
"nr.alternatePathHashes",
|
255
|
+
"nr.referringPathHash"
|
256
|
+
]
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"name": "new_cat_missing_trip_id",
|
260
|
+
"appName": "testAppName",
|
261
|
+
"transactionName": "WebTransaction/testTxnName",
|
262
|
+
"transactionGuid": "9323dc260548ed0e",
|
263
|
+
"referringPayload": [
|
264
|
+
"b854df4feb2b1f06",
|
265
|
+
false
|
266
|
+
],
|
267
|
+
"expectedAttributes": {
|
268
|
+
"nr.guid": "9323dc260548ed0e",
|
269
|
+
"nr.tripId": "9323dc260548ed0e",
|
270
|
+
"nr.pathHash": "accfca26",
|
271
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06"
|
272
|
+
},
|
273
|
+
"nonExpectedAttributes": [
|
274
|
+
"nr.referringPathHash",
|
275
|
+
"nr.alternatePathHashes"
|
276
|
+
]
|
277
|
+
},
|
278
|
+
{
|
279
|
+
"name": "new_cat_null_trip_id",
|
280
|
+
"appName": "testAppName",
|
281
|
+
"transactionName": "WebTransaction/testTxnName",
|
282
|
+
"transactionGuid": "9323dc260548ed0e",
|
283
|
+
"referringPayload": [
|
284
|
+
"b854df4feb2b1f06",
|
285
|
+
false,
|
286
|
+
null
|
287
|
+
],
|
288
|
+
"expectedAttributes": {
|
289
|
+
"nr.guid": "9323dc260548ed0e",
|
290
|
+
"nr.tripId": "9323dc260548ed0e",
|
291
|
+
"nr.pathHash": "accfca26",
|
292
|
+
"nr.referringTransactionGuid": "b854df4feb2b1f06"
|
293
|
+
},
|
294
|
+
"nonExpectedAttributes": [
|
295
|
+
"nr.alternatePathHashes",
|
296
|
+
"nr.referringPathHash"
|
297
|
+
]
|
298
|
+
}
|
299
|
+
]
|
@@ -47,6 +47,22 @@ class CollectorExceptionHandlingTest < Minitest::Test
|
|
47
47
|
assert_equal(1, $collector.calls_for('metric_data').size)
|
48
48
|
end
|
49
49
|
|
50
|
+
def test_should_stop_reporting_after_force_disconnect_on_connect
|
51
|
+
$collector.reset
|
52
|
+
|
53
|
+
payload = { 'error_type' => 'NewRelic::Agent::ForceDisconnectException' }
|
54
|
+
$collector.stub_exception('connect', payload).once
|
55
|
+
|
56
|
+
with_config(:data_report_period => 0) do
|
57
|
+
worker_loop = NewRelic::Agent::WorkerLoop.new(:limit => 1)
|
58
|
+
NewRelic::Agent.agent.stubs(:create_worker_loop).returns(worker_loop)
|
59
|
+
NewRelic::Agent.agent.stubs(:sleep)
|
60
|
+
NewRelic::Agent.agent.deferred_work!({})
|
61
|
+
end
|
62
|
+
|
63
|
+
assert_equal(1, $collector.calls_for('connect').size)
|
64
|
+
end
|
65
|
+
|
50
66
|
def test_should_reconnect_on_connect_exception
|
51
67
|
$collector.reset
|
52
68
|
|
@@ -56,4 +56,34 @@ class CrossApplicationTracingTest < Minitest::Test
|
|
56
56
|
get '/', {'transaction_name' => 'ignored_transaction'}, {'X-NewRelic-ID' => Base64.encode64('1#234')}
|
57
57
|
assert_nil last_response.headers["X-NewRelic-App-Data"]
|
58
58
|
end
|
59
|
+
|
60
|
+
load_cross_agent_test("cat_map").each do |test_case|
|
61
|
+
# We only can do test cases here that don't involve outgoing calls
|
62
|
+
if !test_case["outgoingTxnNames"]
|
63
|
+
if test_case['referringPayload']
|
64
|
+
request_headers = {
|
65
|
+
'X-NewRelic-ID' => Base64.encode64('1#234'),
|
66
|
+
'X-NewRelic-Transaction' => json_dump_and_encode(test_case['referringPayload'])
|
67
|
+
}
|
68
|
+
else
|
69
|
+
request_headers = {}
|
70
|
+
end
|
71
|
+
|
72
|
+
define_method("test_#{test_case['name']}") do
|
73
|
+
txn_category, txn_name = test_case['transactionName'].split('/')
|
74
|
+
request_params = {
|
75
|
+
'transaction_name' => txn_name,
|
76
|
+
'transaction_category' => txn_category,
|
77
|
+
'guid' => test_case['transactionGuid']
|
78
|
+
}
|
79
|
+
|
80
|
+
with_config('app_name' => test_case['appName']) do
|
81
|
+
get '/', request_params, request_headers
|
82
|
+
end
|
83
|
+
|
84
|
+
event = get_last_analytics_event
|
85
|
+
assert_event_attributes(event, test_case['name'], test_case['expectedAttributes'], test_case['nonExpectedAttributes'])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
59
89
|
end
|
@@ -9,37 +9,37 @@ require 'multiverse_helpers'
|
|
9
9
|
|
10
10
|
class MarshalingTest < Minitest::Test
|
11
11
|
include MultiverseHelpers
|
12
|
+
include NewRelic::Agent::MethodTracer
|
12
13
|
|
13
14
|
setup_and_teardown_agent(:'transaction_tracer.transaction_threshold' => 0.0) do |collector|
|
14
15
|
collector.stub('connect', { 'agent_run_id' => 666 })
|
15
16
|
end
|
16
17
|
|
17
18
|
def test_transaction_trace_marshaling
|
18
|
-
# create fake transaction trace
|
19
19
|
time = freeze_time
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
expected_sample = sampler.last_sample
|
20
|
+
|
21
|
+
in_transaction do
|
22
|
+
trace_execution_scoped('a') do
|
23
|
+
trace_execution_scoped('ab') do
|
24
|
+
advance_time 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
expected_sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
32
30
|
|
33
31
|
agent.service.connect
|
34
32
|
agent.send(:harvest_and_send_transaction_traces)
|
35
33
|
|
36
34
|
marshaller = agent.service.marshaller
|
37
35
|
|
38
|
-
|
39
|
-
assert_equal('666', transaction_sample_data_post.run_id)
|
36
|
+
actual = $collector.calls_for('transaction_sample_data')[0][1][0]
|
40
37
|
encoder = NewRelic::Agent::NewRelicService::Encoders::Identity
|
41
|
-
|
42
|
-
|
38
|
+
|
39
|
+
expected = expected_sample.to_collector_array(encoder)
|
40
|
+
expected = NewRelic::JSONWrapper.normalize(expected)
|
41
|
+
|
42
|
+
assert_equal(expected, actual)
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_metric_data_marshalling
|
@@ -20,8 +20,17 @@ class TestingApp
|
|
20
20
|
request = Rack::Request.new(env)
|
21
21
|
params = request.params
|
22
22
|
if params['transaction_name']
|
23
|
-
|
23
|
+
opts = {}
|
24
|
+
if params['transaction_category']
|
25
|
+
opts[:category] = params['transaction_category']
|
26
|
+
NewRelic::Agent::Transaction.stubs(:transaction_category_is_web?).returns(true)
|
27
|
+
end
|
28
|
+
NewRelic::Agent.set_transaction_name(params['transaction_name'], opts)
|
24
29
|
end
|
30
|
+
if params['cross_app_caller']
|
31
|
+
NewRelic::Agent::TransactionState.tl_get.is_cross_app_caller = true
|
32
|
+
end
|
33
|
+
stub_transaction_guid(params['guid']) if params['guid']
|
25
34
|
sleep(params['sleep'].to_f) if params['sleep']
|
26
35
|
[200, headers, [response]]
|
27
36
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
development:
|
3
|
+
high_security: true
|
4
|
+
|
5
|
+
# Settings known to be overridden by high security, purposefully set wrong
|
6
|
+
# in local configuration for testing purposes!
|
7
|
+
ssl: false
|
8
|
+
transaction_tracer:
|
9
|
+
record_sql: raw
|
10
|
+
enabled: true
|
11
|
+
stack_trace_threshold: 0.5
|
12
|
+
slow_sql:
|
13
|
+
record_sql: obfuscated
|
14
|
+
capture_params: true
|
15
|
+
|
16
|
+
error_collector:
|
17
|
+
enabled: true
|
18
|
+
apdex_t: 0.24
|
19
|
+
monitor_mode: true
|
20
|
+
license_key: bootstrap_newrelic_admin_license_key_000
|
21
|
+
developer_mode: false
|
22
|
+
app_name: test
|
23
|
+
host: 127.0.0.1
|
24
|
+
api_host: 127.0.0.1
|
25
|
+
port: <%= $collector && $collector.port %>
|
26
|
+
browser_monitoring:
|
27
|
+
auto_instrument: true
|