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.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/CHANGELOG +22 -0
- data/lib/new_relic/agent/agent.rb +0 -4
- data/lib/new_relic/agent/configuration/default_source.rb +114 -107
- data/lib/new_relic/agent/database.rb +17 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +68 -48
- data/lib/new_relic/agent/database/obfuscator.rb +4 -23
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +20 -1
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +1 -1
- data/lib/new_relic/agent/rules_engine.rb +39 -2
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +27 -5
- data/lib/new_relic/agent/sql_sampler.rb +7 -3
- data/lib/new_relic/language_support.rb +8 -0
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.html.erb +5 -1
- data/lib/tasks/config.rake +10 -2
- data/lib/tasks/config.text.erb +6 -5
- data/test/environments/rails32/Gemfile +6 -1
- data/test/fixtures/cross_agent_tests/aws.json +95 -1
- data/test/fixtures/cross_agent_tests/cat/README.md +28 -0
- data/test/fixtures/cross_agent_tests/cat/cat_map.json +595 -0
- data/test/fixtures/cross_agent_tests/cat/path_hashing.json +51 -0
- data/test/fixtures/cross_agent_tests/data_transport/data_transport.json +1441 -0
- data/test/fixtures/cross_agent_tests/data_transport/data_transport.md +35 -0
- data/test/fixtures/cross_agent_tests/sql_obfuscation/README.md +7 -2
- data/test/fixtures/cross_agent_tests/sql_obfuscation/sql_obfuscation.json +261 -35
- data/test/fixtures/cross_agent_tests/transaction_segment_terms.json +305 -17
- data/test/multiverse/suites/active_record/active_record_test.rb +1 -1
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +12 -12
- data/test/multiverse/suites/datamapper/datamapper_test.rb +23 -0
- data/test/multiverse/suites/rails/Envfile +10 -2
- data/test/new_relic/agent/database/sql_obfuscation_test.rb +2 -7
- data/test/performance/README.md +3 -10
- data/test/performance/lib/performance/table.rb +1 -1
- data/test/performance/suites/rules_engine.rb +35 -0
- data/test/performance/suites/segment_terms_rule.rb +27 -0
- data/test/performance/suites/sql_obfuscation.rb +19 -0
- metadata +9 -2
@@ -4,7 +4,7 @@
|
|
4
4
|
"transaction_segment_terms": [
|
5
5
|
{
|
6
6
|
"prefix": "WebTransaction/Custom",
|
7
|
-
"terms":
|
7
|
+
"terms": ["one", "two", "three"]
|
8
8
|
},
|
9
9
|
{
|
10
10
|
"prefix": "WebTransaction/Uri",
|
@@ -40,61 +40,349 @@
|
|
40
40
|
"expected": "WebTransaction/Custom/a/b/*"
|
41
41
|
},
|
42
42
|
{
|
43
|
-
"input": "WebTransaction/
|
44
|
-
"expected": "WebTransaction/
|
43
|
+
"input": "WebTransaction/Other/a/b/c",
|
44
|
+
"expected": "WebTransaction/Other/a/b/c"
|
45
|
+
}
|
46
|
+
]
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"testname": "prefix_with_trailing_spaces_and_then_slash",
|
50
|
+
"transaction_segment_terms": [
|
51
|
+
{
|
52
|
+
"prefix": "WebTransaction/Custom /",
|
53
|
+
"terms": ["a", "b"]
|
54
|
+
}
|
55
|
+
],
|
56
|
+
"tests": [
|
57
|
+
{
|
58
|
+
"input": "WebTransaction/Custom /a/b/c",
|
59
|
+
"expected": "WebTransaction/Custom /a/b/*"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"input": "WebTransaction/Custom /a/b/c",
|
63
|
+
"expected": "WebTransaction/Custom /a/b/c"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"input": "WebTransaction/Custom/a/b/c",
|
67
|
+
"expected": "WebTransaction/Custom/a/b/c"
|
45
68
|
}
|
46
69
|
]
|
47
70
|
},
|
48
71
|
{
|
49
|
-
"testname": "
|
72
|
+
"testname": "prefix_with_trailing_spaces",
|
73
|
+
"transaction_segment_terms": [
|
74
|
+
{
|
75
|
+
"prefix": "WebTransaction/Custom ",
|
76
|
+
"terms": ["a", "b"]
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"tests": [
|
80
|
+
{
|
81
|
+
"input": "WebTransaction/Custom /a/b/c",
|
82
|
+
"expected": "WebTransaction/Custom /a/b/*"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"input": "WebTransaction/Custom /a/b/c",
|
86
|
+
"expected": "WebTransaction/Custom /a/b/c"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"input": "WebTransaction/Custom/a/b/c",
|
90
|
+
"expected": "WebTransaction/Custom/a/b/c"
|
91
|
+
}
|
92
|
+
]
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"testname": "overlapping_prefix_last_one_only_applied",
|
50
96
|
"transaction_segment_terms": [
|
51
97
|
{
|
52
98
|
"prefix": "WebTransaction/Foo",
|
53
99
|
"terms": ["one", "two", "three"]
|
54
100
|
},
|
55
101
|
{
|
56
|
-
"prefix": "WebTransaction/Foo
|
102
|
+
"prefix": "WebTransaction/Foo",
|
103
|
+
"terms": ["one", "two", "zero"]
|
104
|
+
}
|
105
|
+
],
|
106
|
+
"tests": [
|
107
|
+
{
|
108
|
+
"input": "WebTransaction/Foo/zero/one/two/three/four",
|
109
|
+
"expected": "WebTransaction/Foo/zero/one/two/*"
|
110
|
+
}
|
111
|
+
]
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"testname": "terms_are_order_independent",
|
115
|
+
"transaction_segment_terms": [
|
116
|
+
{
|
117
|
+
"prefix": "WebTransaction/Foo",
|
118
|
+
"terms": ["one", "two", "three"]
|
119
|
+
}
|
120
|
+
],
|
121
|
+
"tests": [
|
122
|
+
{
|
123
|
+
"input": "WebTransaction/Foo/bar/one/three/two",
|
124
|
+
"expected": "WebTransaction/Foo/*/one/three/two"
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"input": "WebTransaction/Foo/three/one/one/two/three",
|
128
|
+
"expected": "WebTransaction/Foo/three/one/one/two/three"
|
129
|
+
}
|
130
|
+
]
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"testname": "invalid_rule_not_enough_prefix_segments",
|
134
|
+
"transaction_segment_terms": [
|
135
|
+
{
|
136
|
+
"prefix": "WebTransaction",
|
57
137
|
"terms": ["one", "two"]
|
58
138
|
}
|
59
139
|
],
|
60
140
|
"tests": [
|
61
141
|
{
|
62
|
-
"input": "WebTransaction/Foo/one/
|
63
|
-
"expected": "WebTransaction/Foo/one/two
|
142
|
+
"input": "WebTransaction/Foo/bar/one/three/two",
|
143
|
+
"expected": "WebTransaction/Foo/bar/one/three/two"
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"input": "WebTransaction/Foo/three/one/one/two/three",
|
147
|
+
"expected": "WebTransaction/Foo/three/one/one/two/three"
|
64
148
|
}
|
65
149
|
]
|
66
150
|
},
|
67
151
|
{
|
68
|
-
"testname": "
|
152
|
+
"testname": "invalid_rule_not_enough_prefix_segments_ending_in_slash",
|
69
153
|
"transaction_segment_terms": [
|
70
154
|
{
|
71
|
-
"prefix": "
|
155
|
+
"prefix": "WebTransaction/",
|
72
156
|
"terms": ["one", "two"]
|
73
157
|
}
|
74
158
|
],
|
75
159
|
"tests": [
|
76
160
|
{
|
77
|
-
"input": "WebTransaction/Foo/one/two",
|
78
|
-
"expected": "
|
161
|
+
"input": "WebTransaction/Foo/bar/one/three/two",
|
162
|
+
"expected": "WebTransaction/Foo/bar/one/three/two"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"input": "WebTransaction/Foo/three/one/one/two/three",
|
166
|
+
"expected": "WebTransaction/Foo/three/one/one/two/three"
|
79
167
|
}
|
80
168
|
]
|
81
169
|
},
|
82
170
|
{
|
83
|
-
"testname": "
|
171
|
+
"testname": "invalid_rule_too_many_prefix_segments",
|
172
|
+
"transaction_segment_terms": [
|
173
|
+
{
|
174
|
+
"prefix": "WebTransaction/Foo/bar",
|
175
|
+
"terms": ["one", "two"]
|
176
|
+
}
|
177
|
+
],
|
178
|
+
"tests": [
|
179
|
+
{
|
180
|
+
"input": "WebTransaction/Foo/bar/one/three/two",
|
181
|
+
"expected": "WebTransaction/Foo/bar/one/three/two"
|
182
|
+
},
|
183
|
+
{
|
184
|
+
"input": "WebTransaction/Foo/three/one/one/two/three",
|
185
|
+
"expected": "WebTransaction/Foo/three/one/one/two/three"
|
186
|
+
}
|
187
|
+
]
|
188
|
+
},
|
189
|
+
{
|
190
|
+
"testname": "invalid_rule_prefix_with_trailing_slash_and_then_space",
|
191
|
+
"transaction_segment_terms": [
|
192
|
+
{
|
193
|
+
"prefix": "WebTransaction/Custom/ ",
|
194
|
+
"terms": ["a", "b"]
|
195
|
+
}
|
196
|
+
],
|
197
|
+
"tests": [
|
198
|
+
{
|
199
|
+
"input": "WebTransaction/Custom/a/b/c",
|
200
|
+
"expected": "WebTransaction/Custom/a/b/c"
|
201
|
+
}
|
202
|
+
]
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"testname": "invalid_rule_prefix_with_multiple_trailing_slashes",
|
206
|
+
"transaction_segment_terms": [
|
207
|
+
{
|
208
|
+
"prefix": "WebTransaction/Custom////",
|
209
|
+
"terms": ["a", "b"]
|
210
|
+
}
|
211
|
+
],
|
212
|
+
"tests": [
|
213
|
+
{
|
214
|
+
"input": "WebTransaction/Custom/a/b/c",
|
215
|
+
"expected": "WebTransaction/Custom/a/b/c"
|
216
|
+
}
|
217
|
+
]
|
218
|
+
},
|
219
|
+
{
|
220
|
+
"testname": "invalid_rule_null_prefix",
|
84
221
|
"transaction_segment_terms": [
|
85
222
|
{
|
86
|
-
"prefix": "Foo",
|
87
223
|
"terms": ["one", "two", "three"]
|
88
224
|
}
|
89
225
|
],
|
90
226
|
"tests": [
|
91
227
|
{
|
92
|
-
"input": "
|
93
|
-
"expected": "
|
228
|
+
"input": "WebTransaction/Custom/one/two/seven/user/nine/account",
|
229
|
+
"expected": "WebTransaction/Custom/one/two/seven/user/nine/account"
|
230
|
+
}
|
231
|
+
]
|
232
|
+
},
|
233
|
+
{
|
234
|
+
"testname": "invalid_rule_null_terms",
|
235
|
+
"transaction_segment_terms": [
|
236
|
+
{
|
237
|
+
"prefix": "WebTransaction/Custom"
|
238
|
+
}
|
239
|
+
],
|
240
|
+
"tests": [
|
241
|
+
{
|
242
|
+
"input": "WebTransaction/Custom/one/two/seven/user/nine/account",
|
243
|
+
"expected": "WebTransaction/Custom/one/two/seven/user/nine/account"
|
244
|
+
}
|
245
|
+
]
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"testname": "empty_terms",
|
249
|
+
"transaction_segment_terms": [
|
250
|
+
{
|
251
|
+
"prefix": "WebTransaction/Custom",
|
252
|
+
"terms": []
|
253
|
+
}
|
254
|
+
],
|
255
|
+
"tests": [
|
256
|
+
{
|
257
|
+
"input": "WebTransaction/Custom/one/two/seven/user/nine/account",
|
258
|
+
"expected": "WebTransaction/Custom/*"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
"input": "WebTransaction/Custom/",
|
262
|
+
"expected": "WebTransaction/Custom/"
|
94
263
|
},
|
95
264
|
{
|
96
|
-
"input": "
|
97
|
-
"expected": "
|
265
|
+
"input": "WebTransaction/Custom",
|
266
|
+
"expected": "WebTransaction/Custom"
|
267
|
+
}
|
268
|
+
]
|
269
|
+
},
|
270
|
+
{
|
271
|
+
"testname": "two_segment_transaction_name",
|
272
|
+
"transaction_segment_terms": [
|
273
|
+
{
|
274
|
+
"prefix": "WebTransaction/Foo",
|
275
|
+
"terms": ["a", "b", "c"]
|
276
|
+
}
|
277
|
+
],
|
278
|
+
"tests": [
|
279
|
+
{
|
280
|
+
"input": "WebTransaction/Foo",
|
281
|
+
"expected": "WebTransaction/Foo"
|
282
|
+
}
|
283
|
+
]
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"testname": "two_segment_transaction_name_with_trailing_slash",
|
287
|
+
"transaction_segment_terms": [
|
288
|
+
{
|
289
|
+
"prefix": "WebTransaction/Foo",
|
290
|
+
"terms": ["a", "b", "c"]
|
291
|
+
}
|
292
|
+
],
|
293
|
+
"tests": [
|
294
|
+
{
|
295
|
+
"input": "WebTransaction/Foo/",
|
296
|
+
"expected": "WebTransaction/Foo/"
|
297
|
+
}
|
298
|
+
]
|
299
|
+
},
|
300
|
+
{
|
301
|
+
"testname": "transaction_segment_with_adjacent_slashes",
|
302
|
+
"transaction_segment_terms": [
|
303
|
+
{
|
304
|
+
"prefix": "WebTransaction/Foo",
|
305
|
+
"terms": ["a", "b", "c"]
|
306
|
+
}
|
307
|
+
],
|
308
|
+
"tests": [
|
309
|
+
{
|
310
|
+
"input": "WebTransaction/Foo///a/b///c/d/",
|
311
|
+
"expected": "WebTransaction/Foo/*/a/b/*/c/*"
|
312
|
+
},
|
313
|
+
{
|
314
|
+
"input": "WebTransaction/Foo///a/b///c///",
|
315
|
+
"expected": "WebTransaction/Foo/*/a/b/*/c/*"
|
316
|
+
}
|
317
|
+
]
|
318
|
+
},
|
319
|
+
{
|
320
|
+
"testname": "transaction_name_with_single_segment",
|
321
|
+
"transaction_segment_terms": [
|
322
|
+
{
|
323
|
+
"prefix": "WebTransaction/Foo",
|
324
|
+
"terms": ["a", "b", "c"]
|
325
|
+
}
|
326
|
+
],
|
327
|
+
"tests": [
|
328
|
+
{
|
329
|
+
"input": "WebTransaction",
|
330
|
+
"expected": "WebTransaction"
|
331
|
+
}
|
332
|
+
]
|
333
|
+
},
|
334
|
+
{
|
335
|
+
"testname": "prefix_must_match_first_two_segments",
|
336
|
+
"transaction_segment_terms": [
|
337
|
+
{
|
338
|
+
"prefix": "WebTransaction/Zip",
|
339
|
+
"terms": ["a", "b"]
|
340
|
+
}
|
341
|
+
],
|
342
|
+
"tests": [
|
343
|
+
{
|
344
|
+
"input": "WebTransaction/Zip/a/b/c",
|
345
|
+
"expected": "WebTransaction/Zip/a/b/*"
|
346
|
+
},
|
347
|
+
{
|
348
|
+
"input": "WebTransaction/ZipZap/a/b/c",
|
349
|
+
"expected": "WebTransaction/ZipZap/a/b/c"
|
350
|
+
}
|
351
|
+
]
|
352
|
+
},
|
353
|
+
{
|
354
|
+
"testname": "one_bad_rule_does_not_scrap_all_rules",
|
355
|
+
"transaction_segment_terms": [
|
356
|
+
{
|
357
|
+
"prefix": "WebTransaction/MissingTerms"
|
358
|
+
},
|
359
|
+
{
|
360
|
+
"prefix": "WebTransaction/Uri",
|
361
|
+
"terms": ["seven", "eight", "nine"]
|
362
|
+
}
|
363
|
+
],
|
364
|
+
"tests": [
|
365
|
+
{
|
366
|
+
"input": "WebTransaction/Uri/one/two/seven/user/nine/account",
|
367
|
+
"expected": "WebTransaction/Uri/*/seven/*/nine/*"
|
368
|
+
}
|
369
|
+
]
|
370
|
+
},
|
371
|
+
{
|
372
|
+
"testname": "one_bad_matching_rule_at_end_does_not_scrap_other_matching_rules",
|
373
|
+
"transaction_segment_terms": [
|
374
|
+
{
|
375
|
+
"prefix": "WebTransaction/Uri",
|
376
|
+
"terms": ["seven", "eight", "nine"]
|
377
|
+
},
|
378
|
+
{
|
379
|
+
"prefix": "WebTransaction/Uri"
|
380
|
+
}
|
381
|
+
],
|
382
|
+
"tests": [
|
383
|
+
{
|
384
|
+
"input": "WebTransaction/Uri/one/two/seven/user/nine/account",
|
385
|
+
"expected": "WebTransaction/Uri/*/seven/*/nine/*"
|
98
386
|
}
|
99
387
|
]
|
100
388
|
}
|
@@ -473,7 +473,7 @@ class ActiveRecordInstrumentationTest < Minitest::Test
|
|
473
473
|
statement = node.params[:sql]
|
474
474
|
assert_match(/^SELECT /, statement.sql)
|
475
475
|
|
476
|
-
assert_equal(adapter
|
476
|
+
assert_equal(adapter, statement.adapter)
|
477
477
|
refute_nil(statement.config)
|
478
478
|
refute_nil(statement.explainer)
|
479
479
|
end
|
@@ -12,7 +12,7 @@ class RenameRuleTest < Minitest::Test
|
|
12
12
|
{ 'match_expression' => 'Nothing', 'replacement' => 'Something' }
|
13
13
|
]
|
14
14
|
segment_terms_rules = [
|
15
|
-
{ 'prefix' => 'other', 'terms' => ['Nothing', 'one', 'two'] }
|
15
|
+
{ 'prefix' => 'other/qux', 'terms' => ['Nothing', 'one', 'two'] }
|
16
16
|
]
|
17
17
|
collector.stub('connect', {
|
18
18
|
'agent_run_id' => 666,
|
@@ -60,32 +60,32 @@ class RenameRuleTest < Minitest::Test
|
|
60
60
|
|
61
61
|
def test_transaction_segment_terms_do_not_apply_to_metrics
|
62
62
|
in_transaction do
|
63
|
-
NewRelic::Agent.record_metric("other/foo/bar", 42)
|
63
|
+
NewRelic::Agent.record_metric("other/qux/foo/bar", 42)
|
64
64
|
end
|
65
65
|
|
66
|
-
assert_metrics_recorded(['other/foo/bar'])
|
66
|
+
assert_metrics_recorded(['other/qux/foo/bar'])
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_transaction_segment_terms_do_apply_to_transaction_names
|
70
70
|
in_transaction do
|
71
|
-
NewRelic::Agent.set_transaction_name('one/two/three/four')
|
71
|
+
NewRelic::Agent.set_transaction_name('qux/one/two/three/four')
|
72
72
|
end
|
73
73
|
|
74
|
-
assert_metrics_recorded(['other/one/two/*'])
|
75
|
-
assert_metrics_not_recorded(['other/one/two/three/four'])
|
74
|
+
assert_metrics_recorded(['other/qux/one/two/*'])
|
75
|
+
assert_metrics_not_recorded(['other/qux/one/two/three/four'])
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_transaction_segment_terms_applied_after_other_rules
|
79
79
|
in_transaction do
|
80
|
-
NewRelic::Agent.set_transaction_name('Nothing/one/two/three')
|
80
|
+
NewRelic::Agent.set_transaction_name('qux/Nothing/one/two/three')
|
81
81
|
end
|
82
82
|
|
83
|
-
assert_metrics_recorded(['other/*/one/two/*'])
|
83
|
+
assert_metrics_recorded(['other/qux/*/one/two/*'])
|
84
84
|
assert_metrics_not_recorded([
|
85
|
-
'other/Something/one/two/*',
|
86
|
-
'other/Something/one/two/three',
|
87
|
-
'other/Nothing/one/two/*',
|
88
|
-
'other/Nothing/one/two/three'
|
85
|
+
'other/qux/Something/one/two/*',
|
86
|
+
'other/qux/Something/one/two/three',
|
87
|
+
'other/qux/Nothing/one/two/*',
|
88
|
+
'other/qux/Nothing/one/two/three'
|
89
89
|
])
|
90
90
|
end
|
91
91
|
end
|
@@ -311,6 +311,29 @@ class DataMapperTest < Minitest::Test
|
|
311
311
|
db.send(:log, msg)
|
312
312
|
end
|
313
313
|
|
314
|
+
def test_obfuscate_query_in_sqlerror
|
315
|
+
invalid_query = "select * from users where password='Slurms McKenzie' limit 1"
|
316
|
+
with_config(:'slow_sql.record_sql' => 'obfuscated') do
|
317
|
+
begin
|
318
|
+
DataMapper.repository.adapter.select(invalid_query)
|
319
|
+
rescue => e
|
320
|
+
NewRelic::Agent.notice_error(e)
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
refute last_traced_error.message.include?(invalid_query)
|
325
|
+
end
|
326
|
+
|
327
|
+
def test_splice_user_password_from_sqlerror
|
328
|
+
begin
|
329
|
+
DataMapper.repository.adapter.select("select * from users")
|
330
|
+
rescue => e
|
331
|
+
NewRelic::Agent.notice_error(e)
|
332
|
+
end
|
333
|
+
|
334
|
+
refute last_traced_error.message.include?('&password=')
|
335
|
+
end
|
336
|
+
|
314
337
|
def assert_against_record(operation)
|
315
338
|
post = Post.create!(:title => "Dummy post", :body => "whatever, man")
|
316
339
|
|