newrelic_rpm 3.18.0.329 → 3.18.1.330
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +14 -9
- data/lib/new_relic/version.rb +1 -1
- data/test/environments/norails/Gemfile +1 -2
- data/test/environments/rails21/Gemfile +2 -1
- data/test/environments/rails22/Gemfile +2 -1
- data/test/environments/rails23/Gemfile +1 -0
- data/test/environments/rails30/Gemfile +1 -0
- data/test/environments/rails31/Gemfile +1 -0
- data/test/environments/rails32/Gemfile +1 -0
- data/test/multiverse/lib/multiverse/suite.rb +3 -1
- data/test/multiverse/suites/datamapper/Envfile +0 -1
- data/test/multiverse/suites/json/Envfile +1 -1
- data/test/multiverse/suites/mongo/mongo2_instrumentation_test.rb +49 -1
- data/test/multiverse/suites/redis/Envfile +7 -0
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +11 -3
- data/test/new_relic/agent/datastores/mongo/event_formatter_test.rb +24 -0
- data/test/new_relic/agent/datastores/mongo/obfuscator_test.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aea433d0e5dddee05b76a21d682702ef9b6858e1
|
4
|
+
data.tar.gz: f9bd9e91d487865e5d33630eda81c49cadb29757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41eb55392a0eb008ef66bd77979e15cd45617536cbe81e331a36cf86a1f1606301250bb538b2b48049b057818116e90bc8e5bf5d1c4d191c4225b240bc99d506
|
7
|
+
data.tar.gz: 537960507a71710172aaa29442595c172559921fe7ee8c4c071a1f864e7f7e4917042c10442decd3a169008abf3ebce2755d1432c418eab519d1e7c3ae7ed9b8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v3.18.1 ##
|
4
|
+
|
5
|
+
* Ensure Mongo aggregate queries are properly obfuscated
|
6
|
+
|
7
|
+
Instrumentation for the Mongo 2.x driver had a bug where the `pipeline`
|
8
|
+
attribute of Mongo aggregate queries was not properly obfuscated. Users
|
9
|
+
who have sensitive data in their `aggregate` queries are strongly encouraged
|
10
|
+
to upgrade to this version of the agent. Users who are unable to upgrade are
|
11
|
+
encouraged to turn off query collection using by setting
|
12
|
+
`mongo.capture_queries` to false in their newrelic.yml files.
|
13
|
+
|
14
|
+
* Early access Redis 4.0 instrumentation
|
15
|
+
|
16
|
+
Our Redis instrumentation has been tested against Redis 4.0.0.rc1.
|
17
|
+
|
3
18
|
## v3.18.0 ##
|
4
19
|
|
5
20
|
* Ruby 2.4.0 support
|
@@ -10,7 +10,7 @@ module NewRelic
|
|
10
10
|
module EventFormatter
|
11
11
|
|
12
12
|
# Keys that will get their values replaced with '?'.
|
13
|
-
OBFUSCATE_KEYS = [ 'filter', 'query' ].freeze
|
13
|
+
OBFUSCATE_KEYS = [ 'filter', 'query', 'pipeline' ].freeze
|
14
14
|
|
15
15
|
# Keys that will get completely removed from the statement.
|
16
16
|
BLACKLISTED_KEYS = [ 'deletes', 'documents', 'updates' ].freeze
|
@@ -11,25 +11,30 @@ module NewRelic
|
|
11
11
|
WHITELIST = [:operation].freeze
|
12
12
|
|
13
13
|
def self.obfuscate_statement(source, whitelist = WHITELIST)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
if source.is_a? Hash
|
15
|
+
obfuscated = {}
|
16
|
+
source.each do |key, value|
|
17
|
+
if whitelist.include?(key)
|
18
|
+
obfuscated[key] = value
|
19
|
+
else
|
20
|
+
obfuscated[key] = obfuscate_value(value, whitelist)
|
21
|
+
end
|
20
22
|
end
|
23
|
+
obfuscated
|
24
|
+
else
|
25
|
+
obfuscate_value(source, whitelist)
|
21
26
|
end
|
22
|
-
|
23
|
-
obfuscated
|
24
27
|
end
|
25
28
|
|
29
|
+
QUESTION_MARK = '?'.freeze
|
30
|
+
|
26
31
|
def self.obfuscate_value(value, whitelist = WHITELIST)
|
27
32
|
if value.is_a?(Hash)
|
28
33
|
obfuscate_statement(value, whitelist)
|
29
34
|
elsif value.is_a?(Array)
|
30
35
|
value.map {|v| obfuscate_value(v, whitelist)}
|
31
36
|
else
|
32
|
-
|
37
|
+
QUESTION_MARK
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
data/lib/new_relic/version.rb
CHANGED
@@ -12,12 +12,11 @@ else
|
|
12
12
|
end
|
13
13
|
|
14
14
|
gem 'rack-test'
|
15
|
-
gem 'json', '<
|
15
|
+
gem 'json', '< 1.8.5' if RUBY_VERSION == "1.8.7"
|
16
16
|
|
17
17
|
platforms :rbx do
|
18
18
|
gem "rubysl"
|
19
19
|
gem "rubysl-test-unit"
|
20
|
-
gem "json", '< 2.0.0'
|
21
20
|
gem "psych"
|
22
21
|
gem "racc" # https://github.com/rubinius/rubinius/issues/2632
|
23
22
|
end
|
@@ -177,7 +177,7 @@ module Multiverse
|
|
177
177
|
f.puts minitest_line unless gemfile_text =~ /^\s*gem .minitest[^_]./
|
178
178
|
f.puts rake_line unless gemfile_text =~ /^\s*gem .rake[^_]./ || suite == 'rake'
|
179
179
|
if RUBY_VERSION == "1.8.7"
|
180
|
-
f.puts "gem 'json', '<
|
180
|
+
f.puts "gem 'json', '< 1.8.5'" unless gemfile_text =~ /^\s.*gem .json./
|
181
181
|
end
|
182
182
|
|
183
183
|
rbx_gemfile_lines(f, gemfile_text)
|
@@ -297,6 +297,8 @@ module Multiverse
|
|
297
297
|
case
|
298
298
|
when RUBY_VERSION >= '2.4'
|
299
299
|
'~> 2.0.2'
|
300
|
+
when RUBY_VERSION == '1.8.7'
|
301
|
+
'< 1.8.5'
|
300
302
|
else
|
301
303
|
'< 2.0.0'
|
302
304
|
end
|
@@ -11,7 +11,6 @@ adapter_gems = <<-RB
|
|
11
11
|
RB
|
12
12
|
|
13
13
|
gemfile <<-RB
|
14
|
-
gem 'json', '>= 1.8.1'
|
15
14
|
gem 'datamapper', '~> 1.2.0', :require => 'data_mapper'
|
16
15
|
gem 'dm-ar-finders', '~> 1.2.0'
|
17
16
|
gem 'addressable', '2.3.8', :require => 'addressable/uri' # addressable >= 2.4.0 does not support Ruby 1.8.7
|
@@ -24,7 +24,7 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
24
24
|
@collection_name = "tribbles-#{SecureRandom.hex(16)}"
|
25
25
|
@collection = @database.collection(@collection_name)
|
26
26
|
|
27
|
-
@tribbles = [{'name' => 'soterios johnson'}, {'name' => 'wes mantooth'}]
|
27
|
+
@tribbles = [{'name' => 'soterios johnson', 'count' => 1}, {'name' => 'wes mantooth', 'count' => 2}]
|
28
28
|
|
29
29
|
NewRelic::Agent::Transaction.stubs(:recording_web_transaction?).returns(true)
|
30
30
|
NewRelic::Agent.drop_buffered_data
|
@@ -205,6 +205,54 @@ if NewRelic::Agent::Datastores::Mongo.is_supported_version? &&
|
|
205
205
|
assert_metrics_recorded(expected)
|
206
206
|
end
|
207
207
|
|
208
|
+
def test_records_metrics_for_aggregate
|
209
|
+
in_transaction do
|
210
|
+
@collection.aggregate([
|
211
|
+
{'$group' => {'_id' => "name", "max" => {'$max'=>"$count"}}},
|
212
|
+
{'$match' => {'max' => {'$gte' => 1}}}
|
213
|
+
]).to_a
|
214
|
+
end
|
215
|
+
|
216
|
+
metrics = build_test_metrics(:aggregate, true)
|
217
|
+
expected = metrics_with_attributes(metrics)
|
218
|
+
|
219
|
+
assert_metrics_recorded(expected)
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_aggregate_pipeline_obfuscated_by_default
|
223
|
+
in_transaction do
|
224
|
+
@collection.aggregate([
|
225
|
+
{'$group' => {'_id' => "name", "max" => {'$max'=>"$count"}}},
|
226
|
+
{'$match' => {'max' => {'$gte' => 1}}}
|
227
|
+
]).to_a
|
228
|
+
end
|
229
|
+
|
230
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
231
|
+
metric = "Datastore/statement/MongoDB/#{@collection_name}/aggregate"
|
232
|
+
node = find_node_with_name(sample, metric)
|
233
|
+
|
234
|
+
expected = [
|
235
|
+
{"$group"=>{"_id"=>"?", "max"=>{"$max"=>"?"}}},
|
236
|
+
{"$match"=>{"max"=>{"$gte"=>"?"}}}
|
237
|
+
]
|
238
|
+
|
239
|
+
assert_equal expected, node[:statement]["pipeline"]
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_filter_obfuscated_by_default
|
243
|
+
in_transaction do
|
244
|
+
@collection.find("name" => "Wes Mantooth", "count" => {"$gte" => 1}).to_a
|
245
|
+
end
|
246
|
+
|
247
|
+
sample = NewRelic::Agent.instance.transaction_sampler.last_sample
|
248
|
+
metric = "Datastore/statement/MongoDB/#{@collection_name}/find"
|
249
|
+
node = find_node_with_name(sample, metric)
|
250
|
+
|
251
|
+
expected = {"name"=>"?", "count"=>{"$gte"=>"?"}}
|
252
|
+
|
253
|
+
assert_equal expected, node[:statement]["filter"]
|
254
|
+
end
|
255
|
+
|
208
256
|
def test_batched_queries
|
209
257
|
25.times do |i|
|
210
258
|
@collection.insert_one :name => "test-#{i}", :active => true
|
@@ -249,7 +249,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
249
249
|
|
250
250
|
def test_records_hostname_on_tt_node_for_get_with_unix_domain_socket
|
251
251
|
redis = Redis.new
|
252
|
-
redis.client.stubs(:path).returns('/tmp/redis.sock')
|
252
|
+
redis.send(client).stubs(:path).returns('/tmp/redis.sock')
|
253
253
|
|
254
254
|
in_transaction do
|
255
255
|
redis.get("foo")
|
@@ -279,7 +279,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
279
279
|
|
280
280
|
def test_records_hostname_on_tt_node_for_multi_with_unix_domain_socket
|
281
281
|
redis = Redis.new
|
282
|
-
redis.client.stubs(:path).returns('/tmp/redis.sock')
|
282
|
+
redis.send(client).stubs(:path).returns('/tmp/redis.sock')
|
283
283
|
|
284
284
|
in_transaction do
|
285
285
|
redis.multi do
|
@@ -296,7 +296,7 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
296
296
|
|
297
297
|
def test_records_unknown_unknown_metric_when_error_gathering_instance_data
|
298
298
|
redis = Redis.new
|
299
|
-
redis.client.stubs(:path).raises StandardError.new
|
299
|
+
redis.send(client).stubs(:path).raises StandardError.new
|
300
300
|
in_transaction do
|
301
301
|
redis.get("foo")
|
302
302
|
end
|
@@ -319,5 +319,13 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
319
319
|
assert_equal ['bar', 'bat'], @redis.pipelined { @redis.get('foo'); @redis.get('baz') }
|
320
320
|
assert_equal 2, @redis.del('foo', 'baz')
|
321
321
|
end
|
322
|
+
|
323
|
+
def client
|
324
|
+
if NewRelic::VersionNumber.new(Redis::VERSION).major_version < 4
|
325
|
+
:client
|
326
|
+
else
|
327
|
+
:_client
|
328
|
+
end
|
329
|
+
end
|
322
330
|
end
|
323
331
|
end
|
@@ -56,6 +56,14 @@ module NewRelic
|
|
56
56
|
"deletes" => [{ :q => { :_id => { "$gt" => 1 }}, :limit => 1 }]
|
57
57
|
}.freeze
|
58
58
|
|
59
|
+
AGGREGATE_COMMAND = {
|
60
|
+
"aggregate"=>"tribbles",
|
61
|
+
"pipeline"=>[
|
62
|
+
{"$group"=> {"_id"=>"name", "max"=>{"$max"=>"$count"}}},
|
63
|
+
{"$match"=>{"max"=>{"$gte"=>1}}}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
|
59
67
|
if RUBY_VERSION > "1.9.3"
|
60
68
|
|
61
69
|
def test_doesnt_modify_incoming_statement
|
@@ -146,6 +154,22 @@ module NewRelic
|
|
146
154
|
formatted = EventFormatter.format(:delete, DATABASE, DELETE_COMMAND)
|
147
155
|
assert_equal expected, formatted
|
148
156
|
end
|
157
|
+
|
158
|
+
def test_event_formatter_obfuscates_pipeline
|
159
|
+
expected = {
|
160
|
+
:operation => :aggregate,
|
161
|
+
:database => DATABASE,
|
162
|
+
:collection => "tribbles",
|
163
|
+
"aggregate" => "tribbles",
|
164
|
+
"pipeline" => [
|
165
|
+
{"$group" => {"_id" => "?", "max" => {"$max" => "?"}}},
|
166
|
+
{"$match" => {"max" => {"$gte" => "?"}}}
|
167
|
+
]
|
168
|
+
}
|
169
|
+
|
170
|
+
formatted = EventFormatter.format(:aggregate, DATABASE, AGGREGATE_COMMAND)
|
171
|
+
assert_equal expected, formatted
|
172
|
+
end
|
149
173
|
end
|
150
174
|
end
|
151
175
|
end
|
@@ -69,6 +69,14 @@ module NewRelic
|
|
69
69
|
assert_equal expected, obfuscated
|
70
70
|
end
|
71
71
|
|
72
|
+
def test_obfuscates_array_statement
|
73
|
+
statement = [{"$group"=>{:_id=>"$says", :total=>{"$sum"=>1}}}]
|
74
|
+
expected = [{"$group"=>{:_id=>"?", :total=>{"$sum"=>"?"}}}]
|
75
|
+
|
76
|
+
obfuscated = Obfuscator.obfuscate_statement(statement)
|
77
|
+
assert_equal expected, obfuscated
|
78
|
+
end
|
79
|
+
|
72
80
|
def test_obfuscate_nested_arrays
|
73
81
|
selector = {
|
74
82
|
"aggregate" => "mongeese",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.18.
|
4
|
+
version: 3.18.1.330
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Krajcar
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|