newrelic_rpm 9.1.0 → 9.2.1

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/.rubocop.yml +1 -65
  3. data/.simplecov +1 -0
  4. data/Brewfile +1 -0
  5. data/CHANGELOG.md +33 -0
  6. data/Guardfile +1 -0
  7. data/bin/newrelic +1 -0
  8. data/bin/newrelic_cmd +1 -0
  9. data/lib/new_relic/agent/configuration/default_source.rb +69 -82
  10. data/lib/new_relic/agent/configuration/manager.rb +13 -0
  11. data/lib/new_relic/agent/error_collector.rb +1 -1
  12. data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
  13. data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
  14. data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
  15. data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
  16. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -1
  17. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -0
  18. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
  19. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
  20. data/lib/new_relic/agent/instrumentation/fiber.rb +1 -1
  21. data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
  22. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +1 -1
  23. data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
  24. data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
  25. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +1 -1
  26. data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
  27. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  28. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
  29. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
  30. data/lib/new_relic/agent/instrumentation/memcache.rb +2 -2
  31. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -0
  33. data/lib/new_relic/agent/method_tracer.rb +1 -1
  34. data/lib/new_relic/agent/new_relic_service.rb +0 -1
  35. data/lib/new_relic/agent/sampler.rb +1 -0
  36. data/lib/new_relic/agent/tracer.rb +1 -1
  37. data/lib/new_relic/agent/transaction/abstract_segment.rb +45 -39
  38. data/lib/new_relic/agent/transaction/distributed_tracing.rb +7 -8
  39. data/lib/new_relic/agent/transaction/tracing.rb +6 -0
  40. data/lib/new_relic/agent/transaction.rb +4 -0
  41. data/lib/new_relic/control/instrumentation.rb +0 -14
  42. data/lib/new_relic/dependency_detection.rb +10 -1
  43. data/lib/new_relic/version.rb +2 -2
  44. data/lib/tasks/coverage_report.rake +1 -1
  45. data/lib/tasks/instrumentation_generator/instrumentation.thor +8 -8
  46. data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
  47. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
  48. data/lib/tasks/multiverse.rb +1 -0
  49. data/lib/tasks/newrelic.rb +1 -0
  50. data/newrelic.yml +5 -5
  51. metadata +73 -4
  52. data/lib/new_relic/agent/range_extensions.rb +0 -27
@@ -14,30 +14,6 @@ module NewRelic
14
14
  end
15
15
  end
16
16
 
17
- # Combines potentially two properties into one.
18
- # Given the example:
19
- # :disable_net_http and :prepend_net_instrumentation
20
- # if :disable_net_http is true, then returned value is "disabled"
21
- # if :prepend_net_instrumentation is false, then returned value is "chain"
22
- # otherwise, "auto" is returned.
23
- #
24
- # Intent is:
25
- # - if user sets disable_xxx property, then don't instrument
26
- # - if user set prepend to `false` then we use method_alias chaining
27
- # - auto, when returned means, try to use prepend unless conflicting gems discovered
28
- #
29
- def self.instrumentation_value_of(disable_key, prepend_key = nil)
30
- proc do
31
- if NewRelic::Agent.config[disable_key]
32
- 'disabled'
33
- elsif prepend_key && !NewRelic::Agent.config[prepend_key]
34
- 'chain'
35
- else
36
- 'auto'
37
- end
38
- end
39
- end
40
-
41
17
  def self.instrumentation_value_from_boolean(key)
42
18
  proc do
43
19
  NewRelic::Agent.config[key] ? 'auto' : 'disabled'
@@ -342,7 +318,7 @@ module NewRelic
342
318
  :public => true,
343
319
  :type => String,
344
320
  :allowed_from_server => false,
345
- :description => 'Your New Relic <LicenseKey />.'
321
+ :description => 'Your New Relic <InlinePopover type="licenseKey" />.'
346
322
  },
347
323
  :log_level => {
348
324
  :default => 'info',
@@ -377,7 +353,7 @@ module NewRelic
377
353
  :public => true,
378
354
  :type => String,
379
355
  :allowed_from_server => false,
380
- :description => 'Your New Relic [user key](/docs/apis/intro-apis/new-relic-api-keys/#overview-keys). Required when using the New Relic REST API v2 to record deployments using the `newrelic deployments` command.'
356
+ :description => 'Your New Relic <InlinePopover type="userKey" />. Required when using the New Relic REST API v2 to record deployments using the `newrelic deployments` command.'
381
357
  },
382
358
  :backport_fast_active_record_connection_lookup => {
383
359
  :default => false,
@@ -410,7 +386,7 @@ module NewRelic
410
386
  When `true`, the agent captures HTTP request parameters and attaches them to transaction traces, traced errors, and [`TransactionError` events](/attribute-dictionary?attribute_name=&events_tids%5B%5D=8241).
411
387
 
412
388
  <Callout variant="caution">
413
- When using the `capture_params` setting, the Ruby agent will not attempt to filter secret information. <b>Recommendation:</b> To filter secret information from request parameters, use the [`attributes.include` setting](/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby) instead. For more information, see the <a href="/docs/agents/ruby-agent/attributes/ruby-attribute-examples#ex_req_params">Ruby attribute examples</a>.
389
+ When using the `capture_params` setting, the Ruby agent will not attempt to filter secret information. `Recommendation:` To filter secret information from request parameters, use the [`attributes.include` setting](/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby) instead. For more information, see the <a href="/docs/agents/ruby-agent/attributes/ruby-attribute-examples#ex_req_params">Ruby attribute examples</a>.
414
390
  </Callout>
415
391
  DESCRIPTION
416
392
  },
@@ -426,7 +402,13 @@ module NewRelic
426
402
  :public => true,
427
403
  :type => String,
428
404
  :allowed_from_server => false,
429
- :description => 'Path to <b>newrelic.yml</b>. If undefined, the agent checks the following directories (in order): <b>config/newrelic.yml</b>, <b>newrelic.yml</b>, <b>$HOME/.newrelic/newrelic.yml</b> and <b>$HOME/newrelic.yml</b>.'
405
+ :description => <<~DESC
406
+ Path to `newrelic.yml`. If undefined, the agent checks the following directories (in order):
407
+ * `config/newrelic.yml`
408
+ * `newrelic.yml`
409
+ * `$HOME/.newrelic/newrelic.yml`
410
+ * `$HOME/newrelic.yml`
411
+ DESC
430
412
  },
431
413
  :'exclude_newrelic_header' => {
432
414
  :default => false,
@@ -646,7 +628,7 @@ module NewRelic
646
628
  :type => Boolean,
647
629
  :allowed_from_server => true,
648
630
  :dynamic_name => true,
649
- :description => 'If `true`, the agent collects [TransactionError events](/docs/insights/new-relic-insights/decorating-events/error-event-default-attributes-insights).'
631
+ :description => 'If `true`, the agent collects [`TransactionError` events](/docs/insights/new-relic-insights/decorating-events/error-event-default-attributes-insights).'
650
632
  },
651
633
  :'error_collector.enabled' => {
652
634
  :default => true,
@@ -726,7 +708,7 @@ module NewRelic
726
708
  :public => true,
727
709
  :type => Integer,
728
710
  :allowed_from_server => true,
729
- :description => 'Defines the maximum number of [TransactionError events](/docs/insights/new-relic-insights/decorating-events/error-event-default-attributes-insights) reported per harvest cycle.'
711
+ :description => 'Defines the maximum number of [`TransactionError` events](/docs/insights/new-relic-insights/decorating-events/error-event-default-attributes-insights) reported per harvest cycle.'
730
712
  },
731
713
  # Browser monitoring
732
714
  :'browser_monitoring.auto_instrument' => {
@@ -965,7 +947,7 @@ module NewRelic
965
947
  :type => Array,
966
948
  :allowed_from_server => false,
967
949
  :transform => DefaultSource.method(:convert_to_regexp_list),
968
- :description => 'List of allowed endpoints to include in audit log'
950
+ :description => 'List of allowed endpoints to include in audit log.'
969
951
  },
970
952
  :'audit_log.path' => {
971
953
  :default => DefaultSource.audit_log_path,
@@ -981,21 +963,21 @@ module NewRelic
981
963
  :public => true,
982
964
  :type => String,
983
965
  :allowed_from_server => false,
984
- :description => 'Specify a list of constants that should prevent the agent from starting automatically. Separate individual constants with a comma `,`. For example, `Rails::Console,UninstrumentedBackgroundJob`.'
966
+ :description => 'Specify a list of constants that should prevent the agent from starting automatically. Separate individual constants with a comma `,`. For example, `"Rails::Console,UninstrumentedBackgroundJob"`.'
985
967
  },
986
968
  :'autostart.denylisted_executables' => {
987
969
  :default => 'irb,rspec',
988
970
  :public => true,
989
971
  :type => String,
990
972
  :allowed_from_server => false,
991
- :description => 'Defines a comma-delimited list of executables that the agent should not instrument. For example, `rake,my_ruby_script.rb`.'
973
+ :description => 'Defines a comma-delimited list of executables that the agent should not instrument. For example, `"rake,my_ruby_script.rb"`.'
992
974
  },
993
975
  :'autostart.denylisted_rake_tasks' => {
994
976
  :default => AUTOSTART_DENYLISTED_RAKE_TASKS,
995
977
  :public => true,
996
978
  :type => String,
997
979
  :allowed_from_server => false,
998
- :description => 'Defines a comma-delimited list of Rake tasks that the agent should not instrument. For example, `assets:precompile,db:migrate`.'
980
+ :description => 'Defines a comma-delimited list of Rake tasks that the agent should not instrument. For example, `"assets:precompile,db:migrate"`.'
999
981
  },
1000
982
  # Code level metrics
1001
983
  :'code_level_metrics.enabled' => {
@@ -1159,7 +1141,7 @@ module NewRelic
1159
1141
  :public => true,
1160
1142
  :type => Boolean,
1161
1143
  :allowed_from_server => false,
1162
- :description => 'If `true`, disables the use of GC::Profiler to measure time spent in garbage collection'
1144
+ :description => 'If `true`, disables the use of `GC::Profiler` to measure time spent in garbage collection'
1163
1145
  },
1164
1146
  :disable_memory_sampler => {
1165
1147
  :default => false,
@@ -1174,7 +1156,7 @@ module NewRelic
1174
1156
  :public => true,
1175
1157
  :type => Boolean,
1176
1158
  :allowed_from_server => false,
1177
- :description => 'If `true`, the agent won\'t wrap third-party middlewares in instrumentation (regardless of whether they are installed via Rack::Builder or Rails).'
1159
+ :description => 'If `true`, the agent won\'t wrap third-party middlewares in instrumentation (regardless of whether they are installed via `Rack::Builder` or Rails).'
1178
1160
  },
1179
1161
  :disable_samplers => {
1180
1162
  :default => false,
@@ -1210,7 +1192,7 @@ module NewRelic
1210
1192
 
1211
1193
  To continue using cross application tracing, update the following options in your `newrelic.yml` configuration file:
1212
1194
 
1213
- ```
1195
+ ```yaml
1214
1196
  # newrelic.yml
1215
1197
 
1216
1198
  cross_application_tracer:
@@ -1273,7 +1255,7 @@ module NewRelic
1273
1255
  :type => Array,
1274
1256
  :allowed_from_server => false,
1275
1257
  :transform => DefaultSource.method(:convert_to_list),
1276
- :description => 'Ordinarily the agent reports dyno names with a trailing dot and process ID (for example, <b>worker.3</b>). You can remove this trailing data by specifying the prefixes you want to report without trailing data (for example, <b>worker</b>).'
1258
+ :description => 'Ordinarily the agent reports dyno names with a trailing dot and process ID (for example, `worker.3`). You can remove this trailing data by specifying the prefixes you want to report without trailing data (for example, `worker`).'
1277
1259
  },
1278
1260
  # Infinite tracing
1279
1261
  :'infinite_tracing.trace_observer.host' => {
@@ -1303,7 +1285,7 @@ module NewRelic
1303
1285
  :public => true,
1304
1286
  :type => String,
1305
1287
  :allowed_from_server => false,
1306
- :description => 'Controls auto-instrumentation of ActiveSupport::Logger at start up. May be one of [auto|prepend|chain|disabled].'
1288
+ :description => 'Controls auto-instrumentation of `ActiveSupport::Logger` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1307
1289
  },
1308
1290
  :'instrumentation.bunny' => {
1309
1291
  :default => 'auto',
@@ -1311,7 +1293,7 @@ module NewRelic
1311
1293
  :type => String,
1312
1294
  :dynamic_name => true,
1313
1295
  :allowed_from_server => false,
1314
- :description => 'Controls auto-instrumentation of bunny at start up. May be one of [auto|prepend|chain|disabled].'
1296
+ :description => 'Controls auto-instrumentation of bunny at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1315
1297
  },
1316
1298
  :'instrumentation.fiber' => {
1317
1299
  :default => 'auto',
@@ -1319,7 +1301,7 @@ module NewRelic
1319
1301
  :type => String,
1320
1302
  :dynamic_name => true,
1321
1303
  :allowed_from_server => false,
1322
- :description => 'Controls auto-instrumentation of the Fiber class at start up. May be one of [auto|prepend|chain|disabled].'
1304
+ :description => 'Controls auto-instrumentation of the Fiber class at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1323
1305
  },
1324
1306
  :'instrumentation.concurrent_ruby' => {
1325
1307
  :default => 'auto',
@@ -1327,7 +1309,7 @@ module NewRelic
1327
1309
  :type => String,
1328
1310
  :dynamic_name => true,
1329
1311
  :allowed_from_server => false,
1330
- :description => 'Controls auto-instrumentation of the concurrent-ruby library at start up. May be one of [auto|prepend|chain|disabled].'
1312
+ :description => 'Controls auto-instrumentation of the concurrent-ruby library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1331
1313
  },
1332
1314
  :'instrumentation.curb' => {
1333
1315
  :default => 'auto',
@@ -1336,7 +1318,7 @@ module NewRelic
1336
1318
  :type => String,
1337
1319
  :dynamic_name => true,
1338
1320
  :allowed_from_server => false,
1339
- :description => 'Controls auto-instrumentation of Curb at start up. May be one of [auto|prepend|chain|disabled].'
1321
+ :description => 'Controls auto-instrumentation of Curb at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1340
1322
  },
1341
1323
  :'instrumentation.delayed_job' => {
1342
1324
  :default => 'auto',
@@ -1345,7 +1327,7 @@ module NewRelic
1345
1327
  :type => String,
1346
1328
  :dynamic_name => true,
1347
1329
  :allowed_from_server => false,
1348
- :description => 'Controls auto-instrumentation of Delayed Job at start up. May be one of [auto|prepend|chain|disabled].'
1330
+ :description => 'Controls auto-instrumentation of Delayed Job at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1349
1331
  },
1350
1332
  :'instrumentation.elasticsearch' => {
1351
1333
  :default => 'auto',
@@ -1353,7 +1335,7 @@ module NewRelic
1353
1335
  :type => String,
1354
1336
  :dynamic_name => true,
1355
1337
  :allowed_from_server => false,
1356
- :description => 'Controls auto-instrumentation of the elasticsearch library at start up. May be one of [auto|prepend|chain|disabled].'
1338
+ :description => 'Controls auto-instrumentation of the elasticsearch library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1357
1339
  },
1358
1340
  :'instrumentation.excon' => {
1359
1341
  :default => 'enabled',
@@ -1362,7 +1344,7 @@ module NewRelic
1362
1344
  :type => String,
1363
1345
  :dynamic_name => true,
1364
1346
  :allowed_from_server => false,
1365
- :description => 'Controls auto-instrumentation of Excon at start up. May be one of [enabled|disabled].'
1347
+ :description => 'Controls auto-instrumentation of Excon at start up. May be one of: `enabled`, `disabled`.'
1366
1348
  },
1367
1349
  :'instrumentation.grape' => {
1368
1350
  :default => 'auto',
@@ -1370,16 +1352,16 @@ module NewRelic
1370
1352
  :type => String,
1371
1353
  :dynamic_name => true,
1372
1354
  :allowed_from_server => false,
1373
- :description => 'Controls auto-instrumentation of Grape at start up. May be one of [auto|prepend|chain|disabled].'
1355
+ :description => 'Controls auto-instrumentation of Grape at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1374
1356
  },
1375
1357
  :'instrumentation.grpc_client' => {
1376
- :default => instrumentation_value_of(:disable_grpc_client),
1358
+ :default => 'auto',
1377
1359
  :documentation_default => 'auto',
1378
1360
  :public => true,
1379
1361
  :type => String,
1380
1362
  :dynamic_name => true,
1381
1363
  :allowed_from_server => false,
1382
- :description => 'Controls auto-instrumentation of gRPC clients at start up. May be one of [auto|prepend|chain|disabled].'
1364
+ :description => 'Controls auto-instrumentation of gRPC clients at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1383
1365
  },
1384
1366
  :'instrumentation.grpc.host_denylist' => {
1385
1367
  :default => [],
@@ -1387,16 +1369,16 @@ module NewRelic
1387
1369
  :type => Array,
1388
1370
  :allowed_from_server => false,
1389
1371
  :transform => DefaultSource.method(:convert_to_regexp_list),
1390
- :description => %Q(Specifies a list of hostname patterns separated by commas that will match gRPC hostnames that traffic is to be ignored by New Relic for. New Relic's gRPC client instrumentation will ignore traffic streamed to a host matching any of these patterns, and New Relic's gRPC server instrumentation will ignore traffic for a server running on a host whose hostname matches any of these patterns. By default, no traffic is ignored when gRPC instrumentation is itself enabled. For example, "private.com$,exception.*")
1372
+ :description => %Q(Specifies a list of hostname patterns separated by commas that will match gRPC hostnames that traffic is to be ignored by New Relic for. New Relic's gRPC client instrumentation will ignore traffic streamed to a host matching any of these patterns, and New Relic's gRPC server instrumentation will ignore traffic for a server running on a host whose hostname matches any of these patterns. By default, no traffic is ignored when gRPC instrumentation is itself enabled. For example, `"private.com$,exception.*"`)
1391
1373
  },
1392
1374
  :'instrumentation.grpc_server' => {
1393
- :default => instrumentation_value_of(:disable_grpc_server),
1375
+ :default => 'auto',
1394
1376
  :documentation_default => 'auto',
1395
1377
  :public => true,
1396
1378
  :type => String,
1397
1379
  :dynamic_name => true,
1398
1380
  :allowed_from_server => false,
1399
- :description => 'Controls auto-instrumentation of gRPC servers at start up. May be one of [auto|prepend|chain|disabled].'
1381
+ :description => 'Controls auto-instrumentation of gRPC servers at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1400
1382
  },
1401
1383
  :'instrumentation.httpclient' => {
1402
1384
  :default => 'auto',
@@ -1405,7 +1387,7 @@ module NewRelic
1405
1387
  :type => String,
1406
1388
  :dynamic_name => true,
1407
1389
  :allowed_from_server => false,
1408
- :description => 'Controls auto-instrumentation of HTTPClient at start up. May be one of [auto|prepend|chain|disabled].'
1390
+ :description => 'Controls auto-instrumentation of HTTPClient at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1409
1391
  },
1410
1392
  :'instrumentation.httprb' => {
1411
1393
  :default => 'auto',
@@ -1414,7 +1396,7 @@ module NewRelic
1414
1396
  :type => String,
1415
1397
  :dynamic_name => true,
1416
1398
  :allowed_from_server => false,
1417
- :description => 'Controls auto-instrumentation of http.rb gem at start up. May be one of [auto|prepend|chain|disabled].'
1399
+ :description => 'Controls auto-instrumentation of http.rb gem at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1418
1400
  },
1419
1401
  :'instrumentation.logger' => {
1420
1402
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
@@ -1423,7 +1405,7 @@ module NewRelic
1423
1405
  :type => String,
1424
1406
  :dynamic_name => true,
1425
1407
  :allowed_from_server => false,
1426
- :description => 'Controls auto-instrumentation of Ruby standard library Logger at start up. May be one of [auto|prepend|chain|disabled].'
1408
+ :description => 'Controls auto-instrumentation of Ruby standard library Logger at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1427
1409
  },
1428
1410
  :'instrumentation.memcache' => {
1429
1411
  :default => 'auto',
@@ -1431,7 +1413,7 @@ module NewRelic
1431
1413
  :type => String,
1432
1414
  :dynamic_name => true,
1433
1415
  :allowed_from_server => false,
1434
- :description => 'Controls auto-instrumentation of dalli gem for Memcache at start up. May be one of [auto|prepend|chain|disabled].'
1416
+ :description => 'Controls auto-instrumentation of dalli gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1435
1417
  },
1436
1418
  :'instrumentation.memcached' => {
1437
1419
  :default => 'auto',
@@ -1440,16 +1422,16 @@ module NewRelic
1440
1422
  :type => String,
1441
1423
  :dynamic_name => true,
1442
1424
  :allowed_from_server => false,
1443
- :description => 'Controls auto-instrumentation of memcached gem for Memcache at start up. May be one of [auto|prepend|chain|disabled].'
1425
+ :description => 'Controls auto-instrumentation of memcached gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1444
1426
  },
1445
1427
  :'instrumentation.memcache_client' => {
1446
- :default => instrumentation_value_of(:disable_memcache_client),
1428
+ :default => 'auto',
1447
1429
  :documentation_default => 'auto',
1448
1430
  :public => true,
1449
1431
  :type => String,
1450
1432
  :dynamic_name => true,
1451
1433
  :allowed_from_server => false,
1452
- :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start up. May be one of [auto|prepend|chain|disabled].'
1434
+ :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1453
1435
  },
1454
1436
  :'instrumentation.mongo' => {
1455
1437
  :default => 'enabled',
@@ -1458,7 +1440,7 @@ module NewRelic
1458
1440
  :type => String,
1459
1441
  :dynamic_name => true,
1460
1442
  :allowed_from_server => false,
1461
- :description => 'Controls auto-instrumentation of Mongo at start up. May be one of [enabled|disabled].'
1443
+ :description => 'Controls auto-instrumentation of Mongo at start up. May be one of: `enabled`, `disabled`.'
1462
1444
  },
1463
1445
  :'instrumentation.net_http' => {
1464
1446
  :default => 'auto',
@@ -1467,7 +1449,7 @@ module NewRelic
1467
1449
  :type => String,
1468
1450
  :dynamic_name => true,
1469
1451
  :allowed_from_server => false,
1470
- :description => 'Controls auto-instrumentation of Net::HTTP at start up. May be one of [auto|prepend|chain|disabled].'
1452
+ :description => 'Controls auto-instrumentation of `Net::HTTP` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1471
1453
  },
1472
1454
  :'instrumentation.puma_rack' => {
1473
1455
  :default => value_of(:'instrumentation.rack'),
@@ -1476,9 +1458,9 @@ module NewRelic
1476
1458
  :type => String,
1477
1459
  :dynamic_name => true,
1478
1460
  :allowed_from_server => false,
1479
- :description => 'Controls auto-instrumentation of Puma::Rack. When enabled, the agent hooks into the ' \
1480
- '`to_app` method in Puma::Rack::Builder to find gems to instrument during ' \
1481
- 'application startup. May be one of [auto|prepend|chain|disabled].'
1461
+ :description => 'Controls auto-instrumentation of `Puma::Rack`. When enabled, the agent hooks into the ' \
1462
+ '`to_app` method in `Puma::Rack::Builder` to find gems to instrument during ' \
1463
+ 'application startup. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1482
1464
  },
1483
1465
  :'instrumentation.puma_rack_urlmap' => {
1484
1466
  :default => value_of(:'instrumentation.rack_urlmap'),
@@ -1487,7 +1469,7 @@ module NewRelic
1487
1469
  :type => String,
1488
1470
  :dynamic_name => true,
1489
1471
  :allowed_from_server => false,
1490
- :description => 'Controls auto-instrumentation of Puma::Rack::URLMap at start up. May be one of [auto|prepend|chain|disabled].'
1472
+ :description => 'Controls auto-instrumentation of `Puma::Rack::URLMap` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1491
1473
  },
1492
1474
  :'instrumentation.rack' => {
1493
1475
  :default => 'auto',
@@ -1497,8 +1479,8 @@ module NewRelic
1497
1479
  :dynamic_name => true,
1498
1480
  :allowed_from_server => false,
1499
1481
  :description => 'Controls auto-instrumentation of Rack. When enabled, the agent hooks into the ' \
1500
- '`to_app` method in Rack::Builder to find gems to instrument during ' \
1501
- 'application startup. May be one of [auto|prepend|chain|disabled].'
1482
+ '`to_app` method in `Rack::Builder` to find gems to instrument during ' \
1483
+ 'application startup. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1502
1484
  },
1503
1485
  :'instrumentation.rack_urlmap' => {
1504
1486
  :default => 'auto',
@@ -1507,7 +1489,7 @@ module NewRelic
1507
1489
  :type => String,
1508
1490
  :dynamic_name => true,
1509
1491
  :allowed_from_server => false,
1510
- :description => 'Controls auto-instrumentation of Rack::URLMap at start up. May be one of [auto|prepend|chain|disabled].'
1492
+ :description => 'Controls auto-instrumentation of `Rack::URLMap` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1511
1493
  },
1512
1494
  :'instrumentation.rake' => {
1513
1495
  :default => 'auto',
@@ -1515,7 +1497,7 @@ module NewRelic
1515
1497
  :type => String,
1516
1498
  :dynamic_name => true,
1517
1499
  :allowed_from_server => false,
1518
- :description => 'Controls auto-instrumentation of rake at start up. May be one of [auto|prepend|chain|disabled].'
1500
+ :description => 'Controls auto-instrumentation of rake at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1519
1501
  },
1520
1502
  :'instrumentation.redis' => {
1521
1503
  :default => 'auto',
@@ -1523,7 +1505,7 @@ module NewRelic
1523
1505
  :type => String,
1524
1506
  :dynamic_name => true,
1525
1507
  :allowed_from_server => false,
1526
- :description => 'Controls auto-instrumentation of Redis at start up. May be one of [auto|prepend|chain|disabled].'
1508
+ :description => 'Controls auto-instrumentation of Redis at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1527
1509
  },
1528
1510
  :'instrumentation.resque' => {
1529
1511
  :default => 'auto',
@@ -1532,7 +1514,7 @@ module NewRelic
1532
1514
  :type => String,
1533
1515
  :dynamic_name => true,
1534
1516
  :allowed_from_server => false,
1535
- :description => 'Controls auto-instrumentation of resque at start up. May be one of [auto|prepend|chain|disabled].'
1517
+ :description => 'Controls auto-instrumentation of resque at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1536
1518
  },
1537
1519
  :'instrumentation.sinatra' => {
1538
1520
  :default => 'auto',
@@ -1540,7 +1522,7 @@ module NewRelic
1540
1522
  :type => String,
1541
1523
  :dynamic_name => true,
1542
1524
  :allowed_from_server => false,
1543
- :description => 'Controls auto-instrumentation of Sinatra at start up. May be one of [auto|prepend|chain|disabled].'
1525
+ :description => 'Controls auto-instrumentation of Sinatra at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1544
1526
  },
1545
1527
  :'instrumentation.thread' => {
1546
1528
  :default => 'auto',
@@ -1548,7 +1530,7 @@ module NewRelic
1548
1530
  :type => String,
1549
1531
  :dynamic_name => true,
1550
1532
  :allowed_from_server => false,
1551
- :description => 'Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asynchronous transaction. This does not enable the agent to automatically trace all threads created (see `instrumentation.thread.tracing`). May be one of [auto|prepend|chain|disabled].'
1533
+ :description => 'Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asynchronous transaction. This does not enable the agent to automatically trace all threads created (see `instrumentation.thread.tracing`). May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1552
1534
  },
1553
1535
  :'instrumentation.thread.tracing' => {
1554
1536
  :default => true,
@@ -1570,7 +1552,7 @@ module NewRelic
1570
1552
  :type => String,
1571
1553
  :dynamic_name => true,
1572
1554
  :allowed_from_server => false,
1573
- :description => 'Controls auto-instrumentation of the Tilt template rendering library at start up. May be one of [auto|prepend|chain|disabled].'
1555
+ :description => 'Controls auto-instrumentation of the Tilt template rendering library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1574
1556
  },
1575
1557
  :'instrumentation.typhoeus' => {
1576
1558
  :default => 'auto',
@@ -1579,7 +1561,7 @@ module NewRelic
1579
1561
  :type => String,
1580
1562
  :dynamic_name => true,
1581
1563
  :allowed_from_server => false,
1582
- :description => 'Controls auto-instrumentation of Typhoeus at start up. May be one of [auto|prepend|chain|disabled].'
1564
+ :description => 'Controls auto-instrumentation of Typhoeus at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1583
1565
  },
1584
1566
  # Message tracer
1585
1567
  :'message_tracer.segment_parameters.enabled' => {
@@ -1687,14 +1669,14 @@ module NewRelic
1687
1669
  :public => true,
1688
1670
  :type => String,
1689
1671
  :allowed_from_server => true,
1690
- :description => 'Defines an obfuscation level for slow SQL queries. Valid options are `obfuscated`, `raw`, or `none`).'
1672
+ :description => 'Defines an obfuscation level for slow SQL queries. Valid options are `obfuscated`, `raw`, or `none`.'
1691
1673
  },
1692
1674
  :'slow_sql.use_longer_sql_id' => {
1693
1675
  :default => false,
1694
1676
  :public => true,
1695
1677
  :type => Boolean,
1696
1678
  :allowed_from_server => true,
1697
- :description => 'Generate a longer sql_id for slow SQL traces. sql_id is used for aggregation of similar queries.'
1679
+ :description => 'Generate a longer `sql_id` for slow SQL traces. `sql_id` is used for aggregation of similar queries.'
1698
1680
  },
1699
1681
  # Span events
1700
1682
  :'span_events.enabled' => {
@@ -1717,7 +1699,7 @@ module NewRelic
1717
1699
  :public => true,
1718
1700
  :type => Integer,
1719
1701
  :allowed_from_server => true,
1720
- :description => 'Defines the maximum number of span events reported from a single harvest. Any Integer between 1 and 10000 is valid.'
1702
+ :description => 'Defines the maximum number of span events reported from a single harvest. Any Integer between `1` and `10000` is valid.'
1721
1703
  },
1722
1704
  # Strip exception messages
1723
1705
  :'strip_exception_messages.enabled' => {
@@ -2025,8 +2007,8 @@ module NewRelic
2025
2007
  :type => Boolean,
2026
2008
  :allowed_from_server => false,
2027
2009
  :external => :infinite_tracing,
2028
- :description => "If `true` (the default), data sent to the trace observer is batched\ninstead of sending " \
2029
- 'each span individually.'
2010
+ :description => 'If `true` (the default), data sent to the trace observer is batched instead of ' \
2011
+ 'sending each span individually.'
2030
2012
  },
2031
2013
  :'infinite_tracing.compression_level' => {
2032
2014
  :default => :high,
@@ -2034,8 +2016,13 @@ module NewRelic
2034
2016
  :type => Symbol,
2035
2017
  :allowed_from_server => false,
2036
2018
  :external => :infinite_tracing,
2037
- :description => "Configure the compression level for data sent to the trace observer\nMay be one of " \
2038
- "[none|low|medium|high]\n'high' is the default. Set the level to 'none' to disable compression"
2019
+ :description => <<~DESC
2020
+ Configure the compression level for data sent to the trace observer.
2021
+
2022
+ May be one of: `:none`, `:low`, `:medium`, `:high`.
2023
+
2024
+ Set the level to `:none` to disable compression.
2025
+ DESC
2039
2026
  },
2040
2027
  :js_agent_file => {
2041
2028
  :default => '',
@@ -15,6 +15,8 @@ module NewRelic
15
15
  module Agent
16
16
  module Configuration
17
17
  class Manager
18
+ DEPENDENCY_DETECTION_VALUES = %i[prepend chain].freeze
19
+
18
20
  # Defining these explicitly saves object allocations that we incur
19
21
  # if we use Forwardable and def_delegators.
20
22
  def [](key)
@@ -357,7 +359,18 @@ module NewRelic
357
359
  reset_cache
358
360
  end
359
361
 
362
+ # reset the configuration hash, but do not replace previously auto
363
+ # determined dependency detection values with nil or 'auto'
360
364
  def reset_cache
365
+ return new_cache unless defined?(@cache) && @cache
366
+
367
+ preserved = @cache.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
368
+ new_cache
369
+ preserved.each { |k, v| @cache[k] = v unless @cache[k] && @cache[k] != 'auto' }
370
+ @cache
371
+ end
372
+
373
+ def new_cache
361
374
  @cache = Hash.new { |hash, key| hash[key] = self.fetch(key) }
362
375
  end
363
376
 
@@ -277,7 +277,7 @@ module NewRelic
277
277
  noticed_error.line_number = sense_method(exception, :line_number)
278
278
  noticed_error.stack_trace = truncate_trace(extract_stack_trace(exception))
279
279
 
280
- noticed_error.expected = !options.delete(:expected).nil? || expected?(exception)
280
+ noticed_error.expected = !!options.delete(:expected) || expected?(exception) # rubocop:disable Style/DoubleNegation
281
281
 
282
282
  noticed_error.attributes_from_notice_error = options.delete(:custom_params) || {}
283
283
 
@@ -27,9 +27,9 @@ DependencyDetection.defer do
27
27
  actions = [:authorize, :purchase, :credit, :void, :capture, :recurring, :store, :unstore, :update]
28
28
  actions.each do |operation|
29
29
  if implemented_methods.include?(operation)
30
- add_method_tracer operation, [-> (*) { "ActiveMerchant/gateway/#{gateway_name}/#{operation}" },
31
- -> (*) { "ActiveMerchant/gateway/#{gateway_name}" },
32
- -> (*) { "ActiveMerchant/operation/#{operation}" }]
30
+ add_method_tracer operation, [->(*) { "ActiveMerchant/gateway/#{gateway_name}/#{operation}" },
31
+ ->(*) { "ActiveMerchant/gateway/#{gateway_name}" },
32
+ ->(*) { "ActiveMerchant/operation/#{operation}" }]
33
33
  end
34
34
  end
35
35
  end
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  module NewRelic::Agent::Instrumentation
6
- module Bunny
6
+ module Bunny::Chain
7
7
  def self.instrument!
8
8
  ::Bunny::Exchange.class_eval do
9
9
  include NewRelic::Agent::Instrumentation::Bunny::Exchange
@@ -26,7 +26,7 @@ DependencyDetection.defer do
26
26
  prepend_instrument Bunny::Queue, NewRelic::Agent::Instrumentation::Bunny::Prepend::Queue
27
27
  prepend_instrument Bunny::Consumer, NewRelic::Agent::Instrumentation::Bunny::Prepend::Consumer
28
28
  else
29
- chain_instrument NewRelic::Agent::Instrumentation::Bunny
29
+ chain_instrument NewRelic::Agent::Instrumentation::Bunny::Chain
30
30
  end
31
31
  end
32
32
  end
@@ -1,6 +1,7 @@
1
1
  # This file is distributed under New Relic's license terms.
2
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
3
  # frozen_string_literal: true
4
+
4
5
  require_relative 'instrumentation'
5
6
 
6
7
  module NewRelic::Agent::Instrumentation
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  module NewRelic::Agent::Instrumentation
6
- module Elasticsearch
6
+ module Elasticsearch::Chain
7
7
  def self.instrument!
8
8
  to_instrument = if ::Gem::Version.create(::Elasticsearch::VERSION) <
9
9
  ::Gem::Version.create('8.0.0')
@@ -1,6 +1,7 @@
1
1
  # This file is distributed under New Relic's license terms.
2
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
3
  # frozen_string_literal: true
4
+
4
5
  require_relative '../../datastores/nosql_obfuscator'
5
6
 
6
7
  module NewRelic::Agent::Instrumentation
@@ -25,7 +25,7 @@ DependencyDetection.defer do
25
25
  if use_prepend?
26
26
  prepend_instrument to_instrument, NewRelic::Agent::Instrumentation::Elasticsearch::Prepend
27
27
  else
28
- chain_instrument NewRelic::Agent::Instrumentation::Elasticsearch
28
+ chain_instrument NewRelic::Agent::Instrumentation::Elasticsearch::Chain
29
29
  end
30
30
  end
31
31
  end
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  module NewRelic::Agent::Instrumentation
6
- module MonitoredFiber
6
+ module MonitoredFiber::Chain
7
7
  def self.instrument!
8
8
  ::Fiber.class_eval do
9
9
  include NewRelic::Agent::Instrumentation::MonitoredFiber
@@ -19,7 +19,7 @@ DependencyDetection.defer do
19
19
  if use_prepend?
20
20
  prepend_instrument Fiber, NewRelic::Agent::Instrumentation::MonitoredFiber::Prepend
21
21
  else
22
- chain_instrument NewRelic::Agent::Instrumentation::MonitoredFiber
22
+ chain_instrument NewRelic::Agent::Instrumentation::MonitoredFiber::Chain
23
23
  end
24
24
  end
25
25
  end
@@ -1,6 +1,6 @@
1
- # frozen_string_literal: true
2
1
  # This file is distributed under New Relic's license terms.
3
2
  # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
4
 
5
5
  require_relative 'instrumentation'
6
6