newrelic_rpm 3.17.1.326 → 3.17.2.327

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -21
  3. data/{CHANGELOG → CHANGELOG.md} +143 -93
  4. data/lib/new_relic/agent/configuration/default_source.rb +31 -19
  5. data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
  6. data/lib/new_relic/agent/instrumentation/active_record_4.rb +2 -2
  7. data/lib/new_relic/agent/instrumentation/active_record_5.rb +89 -0
  8. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +3 -3
  9. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -2
  10. data/lib/new_relic/agent/instrumentation/data_mapper.rb +2 -0
  11. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +8 -6
  12. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +3 -2
  13. data/lib/new_relic/agent/instrumentation/rails5/action_controller.rb +12 -3
  14. data/lib/new_relic/agent/instrumentation/redis.rb +2 -1
  15. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  16. data/lib/new_relic/agent/new_relic_service.rb +6 -2
  17. data/lib/new_relic/agent/transaction/datastore_segment.rb +31 -7
  18. data/lib/new_relic/agent/transaction/tracing.rb +6 -1
  19. data/lib/new_relic/latest_changes.rb +1 -1
  20. data/lib/new_relic/version.rb +3 -3
  21. data/newrelic_rpm.gemspec +2 -1
  22. data/test/environments/rails21/Gemfile +1 -1
  23. data/test/environments/rails22/Gemfile +2 -1
  24. data/test/environments/rails23/Gemfile +6 -1
  25. data/test/fixtures/cross_agent_tests/datastores/README.md +1 -1
  26. data/test/fixtures/cross_agent_tests/datastores/datastore_api.json +443 -0
  27. data/test/fixtures/cross_agent_tests/datastores/datastore_instances.json +0 -47
  28. data/test/multiverse/lib/multiverse/runner.rb +2 -1
  29. data/test/multiverse/suites/memcached/dalli_test.rb +5 -12
  30. data/test/multiverse/suites/resque/instrumentation_test.rb +4 -0
  31. data/test/multiverse/suites/sidekiq/sidekiq_server.rb +5 -1
  32. data/test/multiverse/suites/sinatra/Envfile +8 -0
  33. data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +1 -1
  34. data/test/multiverse/suites/sinatra/sinatra_test_cases.rb +27 -9
  35. data/test/multiverse/suites/typhoeus/Envfile +5 -0
  36. data/test/new_relic/agent/api_tests/datastore_api_test.rb +64 -0
  37. data/test/new_relic/agent/configuration/default_source_test.rb +6 -3
  38. data/test/new_relic/agent/instrumentation/active_record_subscriber_test.rb +27 -1
  39. data/test/new_relic/agent/instrumentation/instance_identification_test.rb +4 -22
  40. data/test/new_relic/agent/instrumentation/mongodb_command_subscriber_test.rb +7 -0
  41. data/test/new_relic/agent/new_relic_service_test.rb +10 -2
  42. data/test/new_relic/agent/transaction/datastore_segment_test.rb +96 -6
  43. data/test/new_relic/agent/transaction/tracing_test.rb +9 -0
  44. data/test/new_relic/agent_test.rb +2 -1
  45. data/test/new_relic/latest_changes_test.rb +1 -1
  46. data/test/new_relic/rack/error_collector_test.rb +4 -0
  47. data/test/script/before_install/gemstash_mirror.sh +10 -0
  48. data/test/script/before_install/jruby_bundler.sh +22 -0
  49. data/test/script/before_install/revert_rubygems.sh +15 -0
  50. data/test/script/before_script/install_mongodb.sh +12 -0
  51. metadata +11 -5
  52. data/test/script/install_mongodb.sh +0 -6
@@ -41,7 +41,7 @@ module NewRelic
41
41
  settings.newrelic_ignores[type] += routes.map do |r|
42
42
  # Ugly sending to private Base#compile, but we want to mimic
43
43
  # exactly Sinatra's mapping of route text to regex
44
- send(:compile, r).first
44
+ Array(send(:compile, r)).first
45
45
  end
46
46
  end
47
47
 
@@ -33,7 +33,7 @@ module NewRelic
33
33
  attr_reader :collector, :marshaller
34
34
 
35
35
  def initialize(license_key=nil, collector=control.server)
36
- @license_key = license_key || Agent.config[:license_key]
36
+ @license_key = license_key
37
37
  @collector = collector
38
38
  @request_timeout = Agent.config[:timeout]
39
39
  @ssl_cert_store = nil
@@ -337,7 +337,7 @@ module NewRelic
337
337
  # The path on the server that we should post our data to
338
338
  def remote_method_uri(method, format)
339
339
  params = {'run_id' => @agent_id, 'marshal_format' => format}
340
- uri = "/agent_listener/#{PROTOCOL_VERSION}/#{@license_key}/#{method}"
340
+ uri = "/agent_listener/#{PROTOCOL_VERSION}/#{license_key}/#{method}"
341
341
  uri << '?' + params.map do |k,v|
342
342
  next unless v
343
343
  "#{k}=#{v}"
@@ -345,6 +345,10 @@ module NewRelic
345
345
  uri
346
346
  end
347
347
 
348
+ def license_key
349
+ @license_key ||= Agent.config[:license_key]
350
+ end
351
+
348
352
  # send a message via post to the actual server. This attempts
349
353
  # to automatically compress the data via zlib if it is large
350
354
  # enough to be worth compressing, and handles any errors the
@@ -5,28 +5,52 @@
5
5
  require 'new_relic/agent/transaction/segment'
6
6
  require 'new_relic/agent/datastores/metric_helper'
7
7
  require 'new_relic/agent/database'
8
+ require 'new_relic/agent/hostname'
8
9
 
9
10
  module NewRelic
10
11
  module Agent
11
12
  class Transaction
12
13
  class DatastoreSegment < Segment
13
- attr_reader :product, :operation, :collection, :sql_statement, :nosql_statement, :port_path_or_id
14
- attr_accessor :host, :database_name
15
14
 
16
- def initialize product, operation, collection = nil, host = nil, port_path_or_id = nil, database_name=nil
15
+ UNKNOWN = 'unknown'.freeze
16
+
17
+ attr_reader :product, :operation, :collection, :sql_statement, :nosql_statement, :host, :port_path_or_id
18
+ attr_accessor :database_name
19
+
20
+ def initialize product, operation, collection = nil, host = nil, port_path_or_id = nil, database_name = nil
17
21
  @product = product
18
22
  @operation = operation
19
23
  @collection = collection
20
24
  @sql_statement = nil
21
25
  @nosql_statement = nil
22
- @host = host
23
- self.port_path_or_id = port_path_or_id
26
+ set_instance_info host, port_path_or_id
24
27
  @database_name = database_name ? database_name.to_s : nil
25
28
  super Datastores::MetricHelper.scoped_metric_for(product, operation, collection)
26
29
  end
27
30
 
28
- def port_path_or_id= ppi
29
- @port_path_or_id = ppi ? ppi.to_s : nil
31
+ def set_instance_info host = nil, port_path_or_id = nil
32
+ port_path_or_id = port_path_or_id.to_s if port_path_or_id
33
+ host_present = host && !host.empty?
34
+ ppi_present = port_path_or_id && !port_path_or_id.empty?
35
+
36
+ host = NewRelic::Agent::Hostname.get_external host if host_present
37
+
38
+ case
39
+ when host_present && ppi_present
40
+ @host = host
41
+ @port_path_or_id = port_path_or_id
42
+
43
+ when host_present && !ppi_present
44
+ @host = host
45
+ @port_path_or_id = UNKNOWN
46
+
47
+ when !host_present && ppi_present
48
+ @host = UNKNOWN
49
+ @port_path_or_id = port_path_or_id
50
+
51
+ else
52
+ @host = @port_path_or_id = nil
53
+ end
30
54
  end
31
55
 
32
56
  def notice_sql sql
@@ -17,7 +17,12 @@ module NewRelic
17
17
  segment
18
18
  end
19
19
 
20
- def start_datastore_segment product, operation, collection=nil, host=nil, port_path_or_id=nil, database_name=nil
20
+ UNKNOWN_PRODUCT = "Unknown".freeze
21
+ UNKNOWN_OPERATION = "other".freeze
22
+
23
+ def start_datastore_segment product=nil, operation=nil, collection=nil, host=nil, port_path_or_id=nil, database_name=nil
24
+ product ||= UNKNOWN_PRODUCT
25
+ operation ||= UNKNOWN_OPERATION
21
26
  segment = DatastoreSegment.new product, operation, collection, host, port_path_or_id, database_name
22
27
  segment.start
23
28
  add_segment segment
@@ -5,7 +5,7 @@
5
5
  module NewRelic
6
6
  module LatestChanges
7
7
  def self.default_changelog
8
- File.join(File.dirname(__FILE__), '..', '..', 'CHANGELOG')
8
+ File.join(File.dirname(__FILE__), '..', '..', 'CHANGELOG.md')
9
9
  end
10
10
 
11
11
  FOOTER = <<'EOS'
@@ -12,7 +12,7 @@ module NewRelic
12
12
 
13
13
  MAJOR = 3
14
14
  MINOR = 17
15
- TINY = 1
15
+ TINY = 2
16
16
 
17
17
  begin
18
18
  require File.join(File.dirname(__FILE__), 'build')
@@ -57,10 +57,10 @@ module NewRelic
57
57
  a, b = parts1.first, parts2.first
58
58
  case
59
59
  when a.nil? && b.nil? then 0
60
- when a.nil? then b.is_a?(Fixnum) ? -1 : 1
60
+ when a.nil? then b.is_a?(Integer) ? -1 : 1
61
61
  when b.nil? then -compare(parts2, parts1)
62
62
  when a.to_s == b.to_s then compare(parts1[1..-1], parts2[1..-1])
63
- when a.is_a?(String) then b.is_a?(Fixnum) ? -1 : (a <=> b)
63
+ when a.is_a?(String) then b.is_a?(Integer) ? -1 : (a <=> b)
64
64
  when b.is_a?(String) then -compare(parts2, parts1)
65
65
  else # they are both fixnums, not nil
66
66
  a <=> b
data/newrelic_rpm.gemspec CHANGED
@@ -24,7 +24,7 @@ EOS
24
24
  s.email = "support@newrelic.com"
25
25
  s.executables = [ "mongrel_rpm", "newrelic_cmd", "newrelic", "nrdebug" ]
26
26
  s.extra_rdoc_files = [
27
- "CHANGELOG",
27
+ "CHANGELOG.md",
28
28
  "LICENSE",
29
29
  "README.md",
30
30
  "CONTRIBUTING.md",
@@ -46,6 +46,7 @@ EOS
46
46
  s.add_development_dependency 'mocha', '~> 0.13.0'
47
47
  s.add_development_dependency 'yard'
48
48
  s.add_development_dependency 'rails', '~> 3.2.13'
49
+ s.add_development_dependency 'json', '>= 2.0.2' if RUBY_VERSION >= '2.4.0' # possible bundler issue?
49
50
  s.add_development_dependency 'pry', '~> 0.9.12'
50
51
  s.add_development_dependency 'hometown', '~> 0.2.5'
51
52
 
@@ -6,7 +6,6 @@ gem 'rake', '~>10.1.1'
6
6
  gem 'minitest', '~>4.7.5'
7
7
  gem "mocha", :require => false
8
8
  gem "jeweler", "1.4.0"
9
- gem "rdoc"
10
9
  gem 'rack', '< 2.0.0'
11
10
  gem 'rack-test'
12
11
  gem 'newrelic_rpm', :path => "../../.."
@@ -26,5 +25,6 @@ gem 'hometown', '~> 0.2.5'
26
25
  if RUBY_VERSION < '1.9'
27
26
  gem 'git', '< 1.3' # git 1.3.0 requires Ruby version >= 1.9
28
27
  gem 'json_pure', '< 2.0'
28
+ gem 'rdoc', '4.2.0'
29
29
  end
30
30
 
@@ -6,7 +6,6 @@ gem 'rake', '~>10.1.1'
6
6
  gem 'minitest', '~>4.7.5'
7
7
  gem "mocha", :require => false
8
8
  gem "jeweler", "1.4.0"
9
- gem "rdoc"
10
9
 
11
10
  gem 'rack', '< 2.0.0'
12
11
  gem 'rack-test'
@@ -27,4 +26,6 @@ gem 'hometown', '~> 0.2.5'
27
26
  if RUBY_VERSION < '1.9'
28
27
  gem 'git', '< 1.3' # git 1.3.0 requires Ruby version >= 1.9
29
28
  gem 'json_pure', '< 2.0'
29
+ gem 'rdoc', '4.2.0'
30
30
  end
31
+
@@ -7,7 +7,12 @@ gem 'minitest', '~>4.7.5'
7
7
  gem 'mocha', :require => false
8
8
  gem 'rack', '< 2.0.0'
9
9
  gem 'rack-test'
10
- gem 'rdoc'
10
+
11
+ if RUBY_VERSION < '2.0'
12
+ gem 'rdoc', '4.2.0'
13
+ else
14
+ gem 'rdoc'
15
+ end
11
16
 
12
17
  gem "newrelic_rpm", :path => '../../..'
13
18
 
@@ -9,7 +9,7 @@ The datastore instance tests provide attributes similar to what an agent could e
9
9
  | product | always | the database product for this configuration
10
10
  | port | sometimes | the port reported by the database adapter |
11
11
  | unix_socket | sometimes |the path to a unix domain socket reported by a database adapter |
12
- | db_path | sometimes |the path to a filesystem database |
12
+ | database_path | sometimes |the path to a filesystem database |
13
13
  | expected\_instance\_metric | always | the instance metric expected to be generated from the given attributes |
14
14
 
15
15
  ## Implementing the test cases
@@ -0,0 +1,443 @@
1
+ [
2
+ {
3
+ "test_name": "all required fields present, everything enabled",
4
+ "input":{
5
+ "parameters":{
6
+ "product":"MySQL",
7
+ "collection":"users",
8
+ "operation":"INSERT",
9
+ "host":"db-server-1",
10
+ "port_path_or_id":"3306",
11
+ "database_name":"my_db"
12
+ },
13
+ "is_web":true,
14
+ "system_hostname":"datanerd-01",
15
+ "configuration":{
16
+ "datastore_tracer.instance_reporting.enabled":true,
17
+ "datastore_tracer.database_name_reporting.enabled":true
18
+ }
19
+ },
20
+ "expectation":{
21
+ "metrics_unscoped":[
22
+ "Datastore/all",
23
+ "Datastore/allWeb",
24
+ "Datastore/MySQL/all",
25
+ "Datastore/MySQL/allWeb",
26
+ "Datastore/operation/MySQL/INSERT",
27
+ "Datastore/statement/MySQL/users/INSERT",
28
+ "Datastore/instance/MySQL/db-server-1/3306"
29
+ ],
30
+ "metrics_scoped":[
31
+ "Datastore/statement/MySQL/users/INSERT"
32
+ ],
33
+ "transaction_segment_and_slow_query_trace":{
34
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
35
+ "host":"db-server-1",
36
+ "port_path_or_id":"3306",
37
+ "database_name":"my_db"
38
+ }
39
+ }
40
+ },
41
+ {
42
+ "test_name": "database name missing",
43
+ "input":{
44
+ "parameters":{
45
+ "product":"MySQL",
46
+ "collection":"users",
47
+ "operation":"INSERT",
48
+ "host":"db-server-1",
49
+ "port_path_or_id":"3306"
50
+ },
51
+ "is_web":true,
52
+ "system_hostname":"datanerd-01",
53
+ "configuration":{
54
+ "datastore_tracer.instance_reporting.enabled":true,
55
+ "datastore_tracer.database_name_reporting.enabled":true
56
+ }
57
+ },
58
+ "expectation":{
59
+ "metrics_unscoped":[
60
+ "Datastore/all",
61
+ "Datastore/allWeb",
62
+ "Datastore/MySQL/all",
63
+ "Datastore/MySQL/allWeb",
64
+ "Datastore/operation/MySQL/INSERT",
65
+ "Datastore/statement/MySQL/users/INSERT",
66
+ "Datastore/instance/MySQL/db-server-1/3306"
67
+ ],
68
+ "metrics_scoped":[
69
+ "Datastore/statement/MySQL/users/INSERT"
70
+ ],
71
+ "transaction_segment_and_slow_query_trace":{
72
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
73
+ "host":"db-server-1",
74
+ "port_path_or_id":"3306"
75
+ }
76
+ }
77
+ },
78
+ {
79
+ "test_name": "host and port missing",
80
+ "input":{
81
+ "parameters":{
82
+ "product":"MySQL",
83
+ "collection":"users",
84
+ "operation":"INSERT",
85
+ "database_name":"my_db"
86
+ },
87
+ "is_web":true,
88
+ "system_hostname":"datanerd-01",
89
+ "configuration":{
90
+ "datastore_tracer.instance_reporting.enabled":true,
91
+ "datastore_tracer.database_name_reporting.enabled":true
92
+ }
93
+ },
94
+ "expectation":{
95
+ "metrics_unscoped":[
96
+ "Datastore/all",
97
+ "Datastore/allWeb",
98
+ "Datastore/MySQL/all",
99
+ "Datastore/MySQL/allWeb",
100
+ "Datastore/operation/MySQL/INSERT",
101
+ "Datastore/statement/MySQL/users/INSERT"
102
+ ],
103
+ "metrics_scoped":[
104
+ "Datastore/statement/MySQL/users/INSERT"
105
+ ],
106
+ "transaction_segment_and_slow_query_trace":{
107
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
108
+ "database_name":"my_db"
109
+ }
110
+ }
111
+ },
112
+ {
113
+ "test_name": "host missing, but port present",
114
+ "input":{
115
+ "parameters":{
116
+ "product":"MySQL",
117
+ "collection":"users",
118
+ "operation":"INSERT",
119
+ "port_path_or_id":"3306",
120
+ "database_name":"my_db"
121
+ },
122
+ "is_web":true,
123
+ "configuration":{
124
+ "datastore_tracer.instance_reporting.enabled":true,
125
+ "datastore_tracer.database_name_reporting.enabled":true
126
+ }
127
+ },
128
+ "expectation":{
129
+ "metrics_unscoped":[
130
+ "Datastore/all",
131
+ "Datastore/allWeb",
132
+ "Datastore/MySQL/all",
133
+ "Datastore/MySQL/allWeb",
134
+ "Datastore/operation/MySQL/INSERT",
135
+ "Datastore/statement/MySQL/users/INSERT",
136
+ "Datastore/instance/MySQL/unknown/3306"
137
+ ],
138
+ "metrics_scoped":[
139
+ "Datastore/statement/MySQL/users/INSERT"
140
+ ],
141
+ "transaction_segment_and_slow_query_trace":{
142
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
143
+ "host":"unknown",
144
+ "port_path_or_id":"3306",
145
+ "database_name":"my_db"
146
+ }
147
+ }
148
+ },
149
+ {
150
+ "test_name": "instance reporting false",
151
+ "input":{
152
+ "parameters":{
153
+ "product":"MySQL",
154
+ "collection":"users",
155
+ "operation":"INSERT",
156
+ "host":"db-server-1",
157
+ "port_path_or_id":"3306",
158
+ "database_name":"my_db"
159
+ },
160
+ "is_web":true,
161
+ "system_hostname":"datanerd-01",
162
+ "configuration":{
163
+ "datastore_tracer.instance_reporting.enabled":false,
164
+ "datastore_tracer.database_name_reporting.enabled":true
165
+ }
166
+ },
167
+ "expectation":{
168
+ "metrics_unscoped":[
169
+ "Datastore/all",
170
+ "Datastore/allWeb",
171
+ "Datastore/MySQL/all",
172
+ "Datastore/MySQL/allWeb",
173
+ "Datastore/operation/MySQL/INSERT",
174
+ "Datastore/statement/MySQL/users/INSERT"
175
+ ],
176
+ "metrics_scoped":[
177
+ "Datastore/statement/MySQL/users/INSERT"
178
+ ],
179
+ "transaction_segment_and_slow_query_trace":{
180
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
181
+ "database_name":"my_db"
182
+ }
183
+ }
184
+ },
185
+ {
186
+ "test_name": "database name disabled",
187
+ "input":{
188
+ "parameters":{
189
+ "product":"MySQL",
190
+ "collection":"users",
191
+ "operation":"INSERT",
192
+ "host":"db-server-1",
193
+ "port_path_or_id":"3306",
194
+ "database_name":"my_db"
195
+ },
196
+ "is_web":true,
197
+ "system_hostname":"datanerd-01",
198
+ "configuration":{
199
+ "datastore_tracer.instance_reporting.enabled":true,
200
+ "datastore_tracer.database_name_reporting.enabled":false
201
+ }
202
+ },
203
+ "expectation":{
204
+ "metrics_unscoped":[
205
+ "Datastore/all",
206
+ "Datastore/allWeb",
207
+ "Datastore/MySQL/all",
208
+ "Datastore/MySQL/allWeb",
209
+ "Datastore/operation/MySQL/INSERT",
210
+ "Datastore/statement/MySQL/users/INSERT",
211
+ "Datastore/instance/MySQL/db-server-1/3306"
212
+ ],
213
+ "metrics_scoped":[
214
+ "Datastore/statement/MySQL/users/INSERT"
215
+ ],
216
+ "transaction_segment_and_slow_query_trace":{
217
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
218
+ "host":"db-server-1",
219
+ "port_path_or_id":"3306"
220
+ }
221
+ }
222
+ },
223
+ {
224
+ "test_name": "all fields missing",
225
+ "input":{
226
+ "parameters":{
227
+ },
228
+ "is_web":true,
229
+ "system_hostname":"datanerd-01",
230
+ "configuration":{
231
+ "datastore_tracer.instance_reporting.enabled":true,
232
+ "datastore_tracer.database_name_reporting.enabled":true
233
+ }
234
+ },
235
+ "expectation":{
236
+ "metrics_unscoped":[
237
+ "Datastore/all",
238
+ "Datastore/allWeb",
239
+ "Datastore/Unknown/all",
240
+ "Datastore/Unknown/allWeb",
241
+ "Datastore/operation/Unknown/other"
242
+ ],
243
+ "metrics_scoped":[
244
+ "Datastore/operation/Unknown/other"
245
+ ],
246
+ "transaction_segment_and_slow_query_trace":{
247
+ "metric_name":"Datastore/operation/Unknown/other"
248
+ }
249
+ }
250
+ },
251
+ {
252
+ "test_name": "missing collection",
253
+ "input":{
254
+ "parameters":{
255
+ "product":"MySQL",
256
+ "operation":"INSERT",
257
+ "host":"db-server-1",
258
+ "port_path_or_id":"3306",
259
+ "database_name":"my_db"
260
+ },
261
+ "is_web":true,
262
+ "system_hostname":"datanerd-01",
263
+ "configuration":{
264
+ "datastore_tracer.instance_reporting.enabled":true,
265
+ "datastore_tracer.database_name_reporting.enabled":true
266
+ }
267
+ },
268
+ "expectation":{
269
+ "metrics_unscoped":[
270
+ "Datastore/all",
271
+ "Datastore/allWeb",
272
+ "Datastore/MySQL/all",
273
+ "Datastore/MySQL/allWeb",
274
+ "Datastore/operation/MySQL/INSERT",
275
+ "Datastore/instance/MySQL/db-server-1/3306"
276
+ ],
277
+ "metrics_scoped":[
278
+ "Datastore/operation/MySQL/INSERT"
279
+ ],
280
+ "transaction_segment_and_slow_query_trace":{
281
+ "metric_name":"Datastore/operation/MySQL/INSERT",
282
+ "host":"db-server-1",
283
+ "port_path_or_id":"3306",
284
+ "database_name":"my_db"
285
+ }
286
+ }
287
+ },
288
+ {
289
+ "test_name": "host present, port missing",
290
+ "input":{
291
+ "parameters":{
292
+ "product":"MySQL",
293
+ "collection":"users",
294
+ "operation":"INSERT",
295
+ "host":"db-server-1",
296
+ "database_name":"my_db"
297
+ },
298
+ "is_web":true,
299
+ "system_hostname":"datanerd-01",
300
+ "configuration":{
301
+ "datastore_tracer.instance_reporting.enabled":true,
302
+ "datastore_tracer.database_name_reporting.enabled":true
303
+ }
304
+ },
305
+ "expectation":{
306
+ "metrics_unscoped":[
307
+ "Datastore/all",
308
+ "Datastore/allWeb",
309
+ "Datastore/MySQL/all",
310
+ "Datastore/MySQL/allWeb",
311
+ "Datastore/operation/MySQL/INSERT",
312
+ "Datastore/statement/MySQL/users/INSERT",
313
+ "Datastore/instance/MySQL/db-server-1/unknown"
314
+ ],
315
+ "metrics_scoped":[
316
+ "Datastore/statement/MySQL/users/INSERT"
317
+ ],
318
+ "transaction_segment_and_slow_query_trace":{
319
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
320
+ "host":"db-server-1",
321
+ "port_path_or_id":"unknown",
322
+ "database_name":"my_db"
323
+ }
324
+ }
325
+ },
326
+ {
327
+ "test_name": "localhost replacement",
328
+ "input":{
329
+ "parameters":{
330
+ "product":"MySQL",
331
+ "collection":"users",
332
+ "operation":"INSERT",
333
+ "host":"localhost",
334
+ "port_path_or_id":"3306",
335
+ "database_name":"my_db"
336
+ },
337
+ "is_web":true,
338
+ "system_hostname":"datanerd-01",
339
+ "configuration":{
340
+ "datastore_tracer.instance_reporting.enabled":true,
341
+ "datastore_tracer.database_name_reporting.enabled":true
342
+ }
343
+ },
344
+ "expectation":{
345
+ "metrics_unscoped":[
346
+ "Datastore/all",
347
+ "Datastore/allWeb",
348
+ "Datastore/MySQL/all",
349
+ "Datastore/MySQL/allWeb",
350
+ "Datastore/operation/MySQL/INSERT",
351
+ "Datastore/statement/MySQL/users/INSERT",
352
+ "Datastore/instance/MySQL/datanerd-01/3306"
353
+ ],
354
+ "metrics_scoped":[
355
+ "Datastore/statement/MySQL/users/INSERT"
356
+ ],
357
+ "transaction_segment_and_slow_query_trace":{
358
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
359
+ "host":"datanerd-01",
360
+ "port_path_or_id":"3306",
361
+ "database_name":"my_db"
362
+ }
363
+ }
364
+ },
365
+ {
366
+ "test_name": "background transaction",
367
+ "input":{
368
+ "parameters":{
369
+ "product":"MySQL",
370
+ "collection":"users",
371
+ "operation":"INSERT",
372
+ "host":"db-server-1",
373
+ "port_path_or_id":"3306",
374
+ "database_name":"my_db"
375
+ },
376
+ "is_web":false,
377
+ "system_hostname":"datanerd-01",
378
+ "configuration":{
379
+ "datastore_tracer.instance_reporting.enabled":true,
380
+ "datastore_tracer.database_name_reporting.enabled":true
381
+ }
382
+ },
383
+ "expectation":{
384
+ "metrics_unscoped":[
385
+ "Datastore/all",
386
+ "Datastore/allOther",
387
+ "Datastore/MySQL/all",
388
+ "Datastore/MySQL/allOther",
389
+ "Datastore/operation/MySQL/INSERT",
390
+ "Datastore/statement/MySQL/users/INSERT",
391
+ "Datastore/instance/MySQL/db-server-1/3306"
392
+ ],
393
+ "metrics_scoped":[
394
+ "Datastore/statement/MySQL/users/INSERT"
395
+ ],
396
+ "transaction_segment_and_slow_query_trace":{
397
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
398
+ "host":"db-server-1",
399
+ "port_path_or_id":"3306",
400
+ "database_name":"my_db"
401
+ }
402
+ }
403
+ },
404
+ {
405
+ "test_name": "socket path port",
406
+ "input":{
407
+ "parameters":{
408
+ "product":"MySQL",
409
+ "collection":"users",
410
+ "operation":"INSERT",
411
+ "host":"db-server-1",
412
+ "port_path_or_id":"/var/mysql/mysql.sock",
413
+ "database_name":"my_db"
414
+ },
415
+ "is_web":true,
416
+ "system_hostname":"datanerd-01",
417
+ "configuration":{
418
+ "datastore_tracer.instance_reporting.enabled":true,
419
+ "datastore_tracer.database_name_reporting.enabled":true
420
+ }
421
+ },
422
+ "expectation":{
423
+ "metrics_unscoped":[
424
+ "Datastore/all",
425
+ "Datastore/allWeb",
426
+ "Datastore/MySQL/all",
427
+ "Datastore/MySQL/allWeb",
428
+ "Datastore/operation/MySQL/INSERT",
429
+ "Datastore/statement/MySQL/users/INSERT",
430
+ "Datastore/instance/MySQL/db-server-1//var/mysql/mysql.sock"
431
+ ],
432
+ "metrics_scoped":[
433
+ "Datastore/statement/MySQL/users/INSERT"
434
+ ],
435
+ "transaction_segment_and_slow_query_trace":{
436
+ "metric_name":"Datastore/statement/MySQL/users/INSERT",
437
+ "host":"db-server-1",
438
+ "port_path_or_id":"/var/mysql/mysql.sock",
439
+ "database_name":"my_db"
440
+ }
441
+ }
442
+ }
443
+ ]