newrelic_rpm 3.17.0.325 → 3.17.1.326
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +21 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +3 -11
- data/lib/new_relic/agent/hostname.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +3 -7
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +10 -12
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -7
- data/lib/new_relic/agent/instrumentation/memcache.rb +2 -45
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +157 -0
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +34 -17
- data/lib/new_relic/agent/instrumentation/redis.rb +51 -11
- data/lib/new_relic/agent/traced_method_stack.rb +4 -0
- data/lib/new_relic/agent/transaction/datastore_segment.rb +27 -5
- data/lib/new_relic/agent/transaction/tracing.rb +4 -0
- data/lib/new_relic/version.rb +1 -1
- data/lib/tasks/config.rake +2 -1
- data/test/helpers/mongo_metric_builder.rb +11 -4
- data/test/multiverse/suites/memcached/dalli_test.rb +82 -1
- data/test/multiverse/suites/memcached/memcache_test_cases.rb +21 -8
- data/test/multiverse/suites/memcached/memcached_test.rb +21 -1
- data/test/multiverse/suites/mongo/mongo2_instrumentation_test.rb +33 -17
- data/test/multiverse/suites/redis/redis_instrumentation_test.rb +99 -7
- data/test/new_relic/agent/hostname_test.rb +23 -0
- data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +11 -0
- data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +37 -0
- data/test/new_relic/agent/transaction/datastore_segment_test.rb +12 -0
- data/test/new_relic/agent/transaction/tracing_test.rb +8 -0
- metadata +3 -2
@@ -34,7 +34,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
34
34
|
"Datastore/Redis/allOther" => { :call_count => 2 },
|
35
35
|
"Datastore/Redis/all" => { :call_count => 2 },
|
36
36
|
"Datastore/allOther" => { :call_count => 2 },
|
37
|
-
"Datastore/all" => { :call_count => 2 }
|
37
|
+
"Datastore/all" => { :call_count => 2 },
|
38
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 2 }
|
38
39
|
}
|
39
40
|
|
40
41
|
assert_metrics_recorded_exclusive(expected, :ignore_filter => /Supportability/)
|
@@ -63,7 +64,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
63
64
|
"Datastore/Redis/allOther" => { :call_count => 1 },
|
64
65
|
"Datastore/Redis/all"=> { :call_count => 1 },
|
65
66
|
"Datastore/allOther"=> { :call_count => 1 },
|
66
|
-
"Datastore/all"=> { :call_count => 1 }
|
67
|
+
"Datastore/all"=> { :call_count => 1 },
|
68
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 1 }
|
67
69
|
}
|
68
70
|
assert_metrics_recorded(expected)
|
69
71
|
end
|
@@ -78,7 +80,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
78
80
|
"Datastore/Redis/allWeb" => { :call_count => 1 },
|
79
81
|
"Datastore/Redis/all"=> { :call_count => 1 },
|
80
82
|
"Datastore/allWeb"=> { :call_count => 1 },
|
81
|
-
"Datastore/all"=> { :call_count => 1 }
|
83
|
+
"Datastore/all"=> { :call_count => 1 },
|
84
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 1 }
|
82
85
|
}
|
83
86
|
assert_metrics_recorded(expected)
|
84
87
|
end
|
@@ -91,7 +94,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
91
94
|
"Datastore/Redis/allOther" => { :call_count => 1 },
|
92
95
|
"Datastore/Redis/all"=> { :call_count => 1 },
|
93
96
|
"Datastore/allOther"=> { :call_count => 1 },
|
94
|
-
"Datastore/all"=> { :call_count => 1 }
|
97
|
+
"Datastore/all"=> { :call_count => 1 },
|
98
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 1 }
|
95
99
|
}
|
96
100
|
assert_metrics_recorded(expected)
|
97
101
|
end
|
@@ -128,7 +132,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
128
132
|
"Datastore/Redis/allWeb" => { :call_count => 1 },
|
129
133
|
"Datastore/Redis/all"=> { :call_count => 1 },
|
130
134
|
"Datastore/allWeb"=> { :call_count => 1 },
|
131
|
-
"Datastore/all"=> { :call_count => 1 }
|
135
|
+
"Datastore/all"=> { :call_count => 1 },
|
136
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 1 }
|
132
137
|
}
|
133
138
|
assert_metrics_recorded(expected)
|
134
139
|
end
|
@@ -144,7 +149,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
144
149
|
"Datastore/Redis/allOther" => { :call_count => 1 },
|
145
150
|
"Datastore/Redis/all" => { :call_count => 1 },
|
146
151
|
"Datastore/allOther" => { :call_count => 1 },
|
147
|
-
"Datastore/all" => { :call_count => 1 }
|
152
|
+
"Datastore/all" => { :call_count => 1 },
|
153
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 1 }
|
148
154
|
}
|
149
155
|
assert_metrics_recorded_exclusive(expected, :ignore_filter => /Supportability/)
|
150
156
|
end
|
@@ -174,7 +180,8 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
174
180
|
"Datastore/Redis/allOther" => { :call_count => 1 },
|
175
181
|
"Datastore/Redis/all" => { :call_count => 1 },
|
176
182
|
"Datastore/allOther" => { :call_count => 1 },
|
177
|
-
"Datastore/all" => { :call_count => 1 }
|
183
|
+
"Datastore/all" => { :call_count => 1 },
|
184
|
+
"Datastore/instance/Redis/#{NewRelic::Agent::Hostname.get}/6379" => { :call_count => 1 }
|
178
185
|
}
|
179
186
|
assert_metrics_recorded_exclusive(expected, :ignore_filter => /Supportability/)
|
180
187
|
end
|
@@ -208,5 +215,90 @@ class NewRelic::Agent::Instrumentation::RedisInstrumentationTest < Minitest::Tes
|
|
208
215
|
|
209
216
|
assert_equal("multi\nset \"darkpact\" \"sorcery\"\nget \"chaos orb\"\nexec", pipeline_node[:statement])
|
210
217
|
end
|
218
|
+
|
219
|
+
def test_records_instance_parameters_on_tt_node_for_get
|
220
|
+
in_transaction do
|
221
|
+
@redis.get("foo")
|
222
|
+
end
|
223
|
+
|
224
|
+
tt = last_transaction_trace
|
225
|
+
|
226
|
+
get_node = tt.root_node.called_nodes[0].called_nodes[0]
|
227
|
+
assert_equal(NewRelic::Agent::Hostname.get, get_node[:host])
|
228
|
+
assert_equal('6379', get_node[:port_path_or_id])
|
229
|
+
assert_equal('0', get_node[:database_name])
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_records_hostname_on_tt_node_for_get_with_unix_domain_socket
|
233
|
+
redis = Redis.new
|
234
|
+
redis.client.stubs(:path).returns('/tmp/redis.sock')
|
235
|
+
|
236
|
+
in_transaction do
|
237
|
+
redis.get("foo")
|
238
|
+
end
|
239
|
+
|
240
|
+
tt = last_transaction_trace
|
241
|
+
|
242
|
+
node = tt.root_node.called_nodes[0].called_nodes[0]
|
243
|
+
assert_equal(NewRelic::Agent::Hostname.get, node[:host])
|
244
|
+
assert_equal('/tmp/redis.sock', node[:port_path_or_id])
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_records_instance_parameters_on_tt_node_for_multi
|
248
|
+
in_transaction do
|
249
|
+
@redis.multi do
|
250
|
+
@redis.get("foo")
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
tt = last_transaction_trace
|
255
|
+
|
256
|
+
node = tt.root_node.called_nodes[0].called_nodes[0]
|
257
|
+
assert_equal(NewRelic::Agent::Hostname.get, node[:host])
|
258
|
+
assert_equal('6379', node[:port_path_or_id])
|
259
|
+
assert_equal('0', node[:database_name])
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_records_hostname_on_tt_node_for_multi_with_unix_domain_socket
|
263
|
+
redis = Redis.new
|
264
|
+
redis.client.stubs(:path).returns('/tmp/redis.sock')
|
265
|
+
|
266
|
+
in_transaction do
|
267
|
+
redis.multi do
|
268
|
+
redis.get("foo")
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
tt = last_transaction_trace
|
273
|
+
|
274
|
+
node = tt.root_node.called_nodes[0].called_nodes[0]
|
275
|
+
assert_equal(NewRelic::Agent::Hostname.get, node[:host])
|
276
|
+
assert_equal('/tmp/redis.sock', node[:port_path_or_id])
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_records_unknown_unknown_metric_when_error_gathering_instance_data
|
280
|
+
redis = Redis.new
|
281
|
+
redis.client.stubs(:path).raises StandardError.new
|
282
|
+
|
283
|
+
redis.get("foo")
|
284
|
+
|
285
|
+
assert_metrics_recorded('Datastore/instance/Redis/unknown/unknown')
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_instrumentation_returns_expected_values
|
289
|
+
assert_equal 0, @redis.del('foo')
|
290
|
+
|
291
|
+
assert_equal 'OK', @redis.set('foo', 'bar')
|
292
|
+
assert_equal 'bar', @redis.get('foo')
|
293
|
+
assert_equal 1, @redis.del('foo')
|
294
|
+
|
295
|
+
assert_equal ['OK','OK'], @redis.multi { @redis.set('foo', 'bar'); @redis.set('baz', 'bat') }
|
296
|
+
assert_equal ['bar', 'bat'], @redis.multi { @redis.get('foo'); @redis.get('baz') }
|
297
|
+
assert_equal 2, @redis.del('foo', 'baz')
|
298
|
+
|
299
|
+
assert_equal ['OK','OK'], @redis.pipelined { @redis.set('foo', 'bar'); @redis.set('baz', 'bat') }
|
300
|
+
assert_equal ['bar', 'bat'], @redis.pipelined { @redis.get('foo'); @redis.get('baz') }
|
301
|
+
assert_equal 2, @redis.del('foo', 'baz')
|
302
|
+
end
|
211
303
|
end
|
212
304
|
end
|
@@ -85,6 +85,29 @@ module NewRelic
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def test_local_predicate_true_when_host_local
|
89
|
+
hosts = %w(localhost 0.0.0.0 127.0.0.1 0:0:0:0:0:0:0:1
|
90
|
+
0:0:0:0:0:0:0:0 ::1 ::)
|
91
|
+
hosts.each do |host|
|
92
|
+
assert NewRelic::Agent::Hostname.local?(host)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_localhost_predicate_false_when_host_nonlocal
|
97
|
+
hosts = %w(drscheffler jonan-show jonan.tm)
|
98
|
+
hosts.each do |host|
|
99
|
+
refute NewRelic::Agent::Hostname.local?(host)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_get_external_returns_host_for_localhost
|
104
|
+
assert_equal "Rivendell", NewRelic::Agent::Hostname.get_external("localhost")
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_get_external_returns_argument_for_nonlocalhost
|
108
|
+
assert_equal "drscheffler", NewRelic::Agent::Hostname.get_external("drscheffler")
|
109
|
+
end
|
110
|
+
|
88
111
|
def with_dyno_name(dyno_name, config_options)
|
89
112
|
with_config(config_options) do
|
90
113
|
ENV['DYNO'] = dyno_name
|
@@ -92,6 +92,17 @@ class NewRelic::Agent::Instrumentation::ActiveRecordSubscriberTest < Minitest::T
|
|
92
92
|
refute node.params.key?(:database_name)
|
93
93
|
end
|
94
94
|
|
95
|
+
def test_records_unknown_unknown_when_error_gathering_instance_data
|
96
|
+
NewRelic::Agent::Hostname.stubs(:get).raises StandardError.new
|
97
|
+
NewRelic::Agent::Instrumentation::ActiveRecordHelper::InstanceIdentification.stubs(:mysql_default_case?).raises StandardError.new
|
98
|
+
config = {:adapter => 'mysql', :host => "127.0.0.1"}
|
99
|
+
@subscriber.stubs(:active_record_config).returns(config)
|
100
|
+
|
101
|
+
simulate_query
|
102
|
+
|
103
|
+
assert_metrics_recorded("Datastore/instance/MySQL/unknown/unknown")
|
104
|
+
end
|
105
|
+
|
95
106
|
def test_records_nothing_if_tracing_disabled
|
96
107
|
freeze_time
|
97
108
|
|
@@ -15,6 +15,8 @@ class NewRelic::Agent::Instrumentation::MongodbCommandSubscriberTest < Minitest:
|
|
15
15
|
@started_event.stubs(:command_name).returns('find')
|
16
16
|
@started_event.stubs(:database_name).returns('mongodb-test')
|
17
17
|
@started_event.stubs(:command).returns({ 'find' => 'users', 'filter' => { 'name' => 'test' }})
|
18
|
+
address = stub('address', :host => "127.0.0.1", :port => 27017)
|
19
|
+
@started_event.stubs(:address).returns(address)
|
18
20
|
|
19
21
|
@succeeded_event = mock('succeeded event')
|
20
22
|
@succeeded_event.stubs(:operation_id).returns(1)
|
@@ -22,6 +24,7 @@ class NewRelic::Agent::Instrumentation::MongodbCommandSubscriberTest < Minitest:
|
|
22
24
|
|
23
25
|
@subscriber = NewRelic::Agent::Instrumentation::MongodbCommandSubscriber.new
|
24
26
|
|
27
|
+
NewRelic::Agent::Hostname.stubs(:get).returns("nerd-server")
|
25
28
|
@stats_engine = NewRelic::Agent.instance.stats_engine
|
26
29
|
@stats_engine.clear_stats
|
27
30
|
end
|
@@ -65,6 +68,40 @@ class NewRelic::Agent::Instrumentation::MongodbCommandSubscriberTest < Minitest:
|
|
65
68
|
simulate_query
|
66
69
|
end
|
67
70
|
|
71
|
+
def test_records_instance_metrics_for_tcp_connection
|
72
|
+
simulate_query
|
73
|
+
assert_metrics_recorded('Datastore/instance/MongoDB/nerd-server/27017')
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_records_instance_metrics_for_unix_domain_socket
|
77
|
+
address = stub('address', :host => "/tmp/mongodb-27017.sock", :port => nil)
|
78
|
+
@started_event.stubs(:address).returns(address)
|
79
|
+
simulate_query
|
80
|
+
assert_metrics_recorded('Datastore/instance/MongoDB/nerd-server//tmp/mongodb-27017.sock')
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_records_unknown_unknown_metric_when_error_gathering_instance_data
|
84
|
+
@started_event.stubs(:address).returns(nil)
|
85
|
+
simulate_query
|
86
|
+
assert_metrics_recorded('Datastore/instance/MongoDB/unknown/unknown')
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_records_tt_segment_parameters_for_datastore_instance
|
90
|
+
in_transaction do
|
91
|
+
simulate_query
|
92
|
+
end
|
93
|
+
|
94
|
+
tt = last_transaction_trace
|
95
|
+
|
96
|
+
node = find_node_with_name_matching tt, /^Datastore\//
|
97
|
+
|
98
|
+
assert_equal(NewRelic::Agent::Hostname.get, node[:host])
|
99
|
+
assert_equal('27017', node[:port_path_or_id])
|
100
|
+
assert_equal('mongodb-test', node[:database_name])
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
|
68
105
|
def simulate_query
|
69
106
|
@subscriber.started(@started_event)
|
70
107
|
advance_time @succeeded_event.duration
|
@@ -211,6 +211,18 @@ module NewRelic
|
|
211
211
|
segment.finish
|
212
212
|
end
|
213
213
|
end
|
214
|
+
|
215
|
+
def test_notice_nosql_statement
|
216
|
+
statement = "set mykey 123"
|
217
|
+
in_transaction do
|
218
|
+
segment = NewRelic::Agent::Transaction.start_datastore_segment "Redis", "set"
|
219
|
+
segment.notice_nosql_statement statement
|
220
|
+
advance_time 2.0
|
221
|
+
|
222
|
+
Agent.instance.transaction_sampler.expects(:notice_nosql_statement).with(statement, 2.0)
|
223
|
+
segment.finish
|
224
|
+
end
|
225
|
+
end
|
214
226
|
end
|
215
227
|
end
|
216
228
|
end
|
@@ -114,6 +114,14 @@ module NewRelic
|
|
114
114
|
assert_nil segment.transaction, "Did not expect segment to associated with a transaction"
|
115
115
|
refute_metrics_recorded ["Custom/segment/method", "Custom/all"]
|
116
116
|
end
|
117
|
+
|
118
|
+
def test_current_segment_in_transaction
|
119
|
+
in_transaction "test_txn" do |txn|
|
120
|
+
segment = Transaction.start_datastore_segment "SQLite", "insert", "Blog"
|
121
|
+
assert_equal segment, txn.current_segment
|
122
|
+
segment.finish
|
123
|
+
end
|
124
|
+
end
|
117
125
|
end
|
118
126
|
end
|
119
127
|
end
|
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.17.
|
4
|
+
version: 3.17.1.326
|
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: 2016-
|
14
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -268,6 +268,7 @@ files:
|
|
268
268
|
- lib/new_relic/agent/instrumentation/httpclient.rb
|
269
269
|
- lib/new_relic/agent/instrumentation/ignore_actions.rb
|
270
270
|
- lib/new_relic/agent/instrumentation/memcache.rb
|
271
|
+
- lib/new_relic/agent/instrumentation/memcache/dalli.rb
|
271
272
|
- lib/new_relic/agent/instrumentation/merb/controller.rb
|
272
273
|
- lib/new_relic/agent/instrumentation/merb/errors.rb
|
273
274
|
- lib/new_relic/agent/instrumentation/metric_frame.rb
|