newrelic_rpm 9.5.0 → 9.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +112 -7
  3. data/CONTRIBUTING.md +0 -7
  4. data/Rakefile +1 -1
  5. data/bin/newrelic +2 -9
  6. data/bin/newrelic_rpm +15 -0
  7. data/init.rb +2 -2
  8. data/lib/new_relic/agent/agent.rb +1 -1
  9. data/lib/new_relic/agent/agent_helpers/shutdown.rb +1 -1
  10. data/lib/new_relic/agent/agent_helpers/special_startup.rb +1 -1
  11. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +2 -2
  12. data/lib/new_relic/agent/agent_helpers/startup.rb +2 -2
  13. data/lib/new_relic/agent/attribute_filter.rb +3 -3
  14. data/lib/new_relic/agent/configuration/default_source.rb +94 -35
  15. data/lib/new_relic/agent/configuration/manager.rb +8 -7
  16. data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
  17. data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +3 -3
  18. data/lib/new_relic/agent/event_loop.rb +1 -1
  19. data/lib/new_relic/agent/http_clients/abstract.rb +4 -0
  20. data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +80 -0
  21. data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -3
  22. data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +109 -0
  23. data/lib/new_relic/agent/http_clients/excon_wrappers.rb +0 -3
  24. data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -3
  25. data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +0 -3
  26. data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +91 -0
  27. data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +1 -4
  28. data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +0 -3
  29. data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
  30. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -2
  31. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
  32. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
  33. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
  34. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
  35. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
  36. data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
  37. data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
  38. data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
  39. data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
  40. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -1
  41. data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
  42. data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
  43. data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
  44. data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
  45. data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +1 -4
  46. data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
  47. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
  48. data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
  49. data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
  50. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -3
  51. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +1 -1
  52. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -0
  53. data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
  54. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +12 -0
  55. data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +1 -2
  56. data/lib/new_relic/agent/instrumentation/roda.rb +2 -0
  57. data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -1
  58. data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
  59. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -3
  60. data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -1
  61. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -4
  62. data/lib/new_relic/agent/instrumentation/view_component/chain.rb +21 -0
  63. data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +38 -0
  64. data/lib/new_relic/agent/instrumentation/view_component/prepend.rb +13 -0
  65. data/lib/new_relic/agent/instrumentation/view_component.rb +26 -0
  66. data/lib/new_relic/agent/javascript_instrumentor.rb +0 -1
  67. data/lib/new_relic/agent/messaging.rb +2 -2
  68. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
  69. data/lib/new_relic/agent/new_relic_service/encoders.rb +2 -2
  70. data/lib/new_relic/agent/new_relic_service.rb +8 -6
  71. data/lib/new_relic/agent/obfuscator.rb +0 -2
  72. data/lib/new_relic/agent/pipe_channel_manager.rb +2 -2
  73. data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -2
  74. data/lib/new_relic/agent/rules_engine.rb +1 -1
  75. data/lib/new_relic/agent/span_event_primitive.rb +16 -4
  76. data/lib/new_relic/agent/sql_sampler.rb +0 -1
  77. data/lib/new_relic/agent/system_info.rb +26 -0
  78. data/lib/new_relic/agent/tracer.rb +5 -6
  79. data/lib/new_relic/agent/transaction/abstract_segment.rb +3 -0
  80. data/lib/new_relic/agent/transaction/external_request_segment.rb +5 -2
  81. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -2
  82. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -3
  83. data/lib/new_relic/agent/transaction/tracing.rb +11 -1
  84. data/lib/new_relic/agent/transaction.rb +25 -2
  85. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -0
  86. data/lib/new_relic/agent/transaction_event_primitive.rb +19 -0
  87. data/lib/new_relic/agent/utilization/gcp.rb +1 -3
  88. data/lib/new_relic/agent/vm/{mri_vm.rb → c_ruby_vm.rb} +7 -15
  89. data/lib/new_relic/agent/vm.rb +2 -2
  90. data/lib/new_relic/agent/worker_loop.rb +1 -1
  91. data/lib/new_relic/agent.rb +11 -7
  92. data/lib/new_relic/base64.rb +25 -0
  93. data/lib/new_relic/cli/command.rb +6 -4
  94. data/lib/new_relic/constants.rb +5 -0
  95. data/lib/new_relic/control/frameworks/rails.rb +17 -5
  96. data/lib/new_relic/control/instrumentation.rb +1 -1
  97. data/lib/new_relic/language_support.rb +4 -0
  98. data/lib/new_relic/local_environment.rb +22 -13
  99. data/lib/new_relic/supportability_helper.rb +1 -1
  100. data/lib/new_relic/version.rb +1 -1
  101. data/lib/tasks/config.rake +1 -1
  102. data/lib/tasks/helpers/config.html.erb +6 -6
  103. data/lib/tasks/helpers/newrelicyml.rb +1 -1
  104. data/lib/tasks/instrumentation_generator/instrumentation.thor +3 -3
  105. data/lib/tasks/tests.rake +71 -0
  106. data/newrelic.yml +55 -35
  107. data/newrelic_rpm.gemspec +5 -4
  108. data/test/agent_helper.rb +14 -2
  109. metadata +32 -7
  110. data/bin/newrelic_cmd +0 -7
@@ -313,6 +313,7 @@ module NewRelic
313
313
  'webpacker:compile'
314
314
  ].join(',').freeze
315
315
 
316
+ # rubocop:disable Metrics/CollectionLiteralLength
316
317
  DEFAULTS = {
317
318
  # Critical
318
319
  :agent_enabled => {
@@ -336,6 +337,7 @@ module NewRelic
336
337
  :public => true,
337
338
  :type => String,
338
339
  :allowed_from_server => false,
340
+ :exclude_from_reported_settings => true,
339
341
  :description => 'Your New Relic <InlinePopover type="licenseKey" />.'
340
342
  },
341
343
  :log_level => {
@@ -444,7 +446,7 @@ module NewRelic
444
446
  'before shutting down to be installed regardless of detecting scenarios where it generally should not be. ' \
445
447
  'Known use-case for this option is where Sinatra is running as an embedded service within another framework ' \
446
448
  'and the agent is detecting the Sinatra app and skipping the `at_exit` handler as a result. Sinatra classically ' \
447
- 'runs the entire application in an `at_exit` block and would otherwise misbehave if the Agent\'s `at_exit` handler ' \
449
+ 'runs the entire application in an `at_exit` block and would otherwise misbehave if the agent\'s `at_exit` handler ' \
448
450
  'was also installed in those circumstances. Note: `send_data_on_exit` should also be set to `true` in tandem with this setting.'
449
451
  },
450
452
  :high_security => {
@@ -1014,7 +1016,20 @@ module NewRelic
1014
1016
  },
1015
1017
  # Autostart
1016
1018
  :'autostart.denylisted_constants' => {
1017
- :default => 'Rails::Console',
1019
+ :default => %w[Rails::Command::ConsoleCommand
1020
+ Rails::Command::CredentialsCommand
1021
+ Rails::Command::Db::System::ChangeCommand
1022
+ Rails::Command::DbConsoleCommand
1023
+ Rails::Command::DestroyCommand
1024
+ Rails::Command::DevCommand
1025
+ Rails::Command::EncryptedCommand
1026
+ Rails::Command::GenerateCommand
1027
+ Rails::Command::InitializersCommand
1028
+ Rails::Command::NotesCommand
1029
+ Rails::Command::RoutesCommand
1030
+ Rails::Command::SecretsCommand
1031
+ Rails::Console
1032
+ Rails::DBConsole].join(','),
1018
1033
  :public => true,
1019
1034
  :type => String,
1020
1035
  :allowed_from_server => false,
@@ -1348,6 +1363,15 @@ module NewRelic
1348
1363
  :description => 'Configures the TCP/IP port for the trace observer Host'
1349
1364
  },
1350
1365
  # Instrumentation
1366
+ :'instrumentation.active_support_broadcast_logger' => {
1367
+ :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
1368
+ :documentation_default => 'auto',
1369
+ :dynamic_name => true,
1370
+ :public => true,
1371
+ :type => String,
1372
+ :allowed_from_server => false,
1373
+ :description => 'Controls auto-instrumentation of `ActiveSupport::BroadcastLogger` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`. Used in Rails versions >= 7.1.'
1374
+ },
1351
1375
  :'instrumentation.active_support_logger' => {
1352
1376
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
1353
1377
  :documentation_default => 'auto',
@@ -1355,7 +1379,15 @@ module NewRelic
1355
1379
  :public => true,
1356
1380
  :type => String,
1357
1381
  :allowed_from_server => false,
1358
- :description => 'Controls auto-instrumentation of `ActiveSupport::Logger` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1382
+ :description => 'Controls auto-instrumentation of `ActiveSupport::Logger` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`. Used in Rails versions below 7.1.'
1383
+ },
1384
+ :'instrumentation.async_http' => {
1385
+ :default => 'auto',
1386
+ :public => true,
1387
+ :type => String,
1388
+ :dynamic_name => true,
1389
+ :allowed_from_server => false,
1390
+ :description => 'Controls auto-instrumentation of Async::HTTP at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1359
1391
  },
1360
1392
  :'instrumentation.bunny' => {
1361
1393
  :default => 'auto',
@@ -1363,7 +1395,7 @@ module NewRelic
1363
1395
  :type => String,
1364
1396
  :dynamic_name => true,
1365
1397
  :allowed_from_server => false,
1366
- :description => 'Controls auto-instrumentation of bunny at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1398
+ :description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1367
1399
  },
1368
1400
  :'instrumentation.fiber' => {
1369
1401
  :default => 'auto',
@@ -1371,7 +1403,7 @@ module NewRelic
1371
1403
  :type => String,
1372
1404
  :dynamic_name => true,
1373
1405
  :allowed_from_server => false,
1374
- :description => 'Controls auto-instrumentation of the Fiber class at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1406
+ :description => 'Controls auto-instrumentation of the Fiber class at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1375
1407
  },
1376
1408
  :'instrumentation.concurrent_ruby' => {
1377
1409
  :default => 'auto',
@@ -1379,7 +1411,7 @@ module NewRelic
1379
1411
  :type => String,
1380
1412
  :dynamic_name => true,
1381
1413
  :allowed_from_server => false,
1382
- :description => 'Controls auto-instrumentation of the concurrent-ruby library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1414
+ :description => 'Controls auto-instrumentation of the concurrent-ruby library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1383
1415
  },
1384
1416
  :'instrumentation.curb' => {
1385
1417
  :default => 'auto',
@@ -1388,7 +1420,7 @@ module NewRelic
1388
1420
  :type => String,
1389
1421
  :dynamic_name => true,
1390
1422
  :allowed_from_server => false,
1391
- :description => 'Controls auto-instrumentation of Curb at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1423
+ :description => 'Controls auto-instrumentation of Curb at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1392
1424
  },
1393
1425
  :'instrumentation.delayed_job' => {
1394
1426
  :default => 'auto',
@@ -1397,7 +1429,7 @@ module NewRelic
1397
1429
  :type => String,
1398
1430
  :dynamic_name => true,
1399
1431
  :allowed_from_server => false,
1400
- :description => 'Controls auto-instrumentation of Delayed Job at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1432
+ :description => 'Controls auto-instrumentation of Delayed Job at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1401
1433
  },
1402
1434
  :'instrumentation.elasticsearch' => {
1403
1435
  :default => 'auto',
@@ -1405,7 +1437,15 @@ module NewRelic
1405
1437
  :type => String,
1406
1438
  :dynamic_name => true,
1407
1439
  :allowed_from_server => false,
1408
- :description => 'Controls auto-instrumentation of the elasticsearch library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1440
+ :description => 'Controls auto-instrumentation of the elasticsearch library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1441
+ },
1442
+ :'instrumentation.ethon' => {
1443
+ :default => 'auto',
1444
+ :public => true,
1445
+ :type => String,
1446
+ :dynamic_name => true,
1447
+ :allowed_from_server => false,
1448
+ :description => 'Controls auto-instrumentation of ethon at start up. May be one of [auto|prepend|chain|disabled]'
1409
1449
  },
1410
1450
  :'instrumentation.excon' => {
1411
1451
  :default => 'enabled',
@@ -1414,7 +1454,7 @@ module NewRelic
1414
1454
  :type => String,
1415
1455
  :dynamic_name => true,
1416
1456
  :allowed_from_server => false,
1417
- :description => 'Controls auto-instrumentation of Excon at start up. May be one of: `enabled`, `disabled`.'
1457
+ :description => 'Controls auto-instrumentation of Excon at start-up. May be one of: `enabled`, `disabled`.'
1418
1458
  },
1419
1459
  :'instrumentation.grape' => {
1420
1460
  :default => 'auto',
@@ -1422,7 +1462,7 @@ module NewRelic
1422
1462
  :type => String,
1423
1463
  :dynamic_name => true,
1424
1464
  :allowed_from_server => false,
1425
- :description => 'Controls auto-instrumentation of Grape at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1465
+ :description => 'Controls auto-instrumentation of Grape at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1426
1466
  },
1427
1467
  :'instrumentation.grpc_client' => {
1428
1468
  :default => 'auto',
@@ -1431,7 +1471,7 @@ module NewRelic
1431
1471
  :type => String,
1432
1472
  :dynamic_name => true,
1433
1473
  :allowed_from_server => false,
1434
- :description => 'Controls auto-instrumentation of gRPC clients at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1474
+ :description => 'Controls auto-instrumentation of gRPC clients at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1435
1475
  },
1436
1476
  :'instrumentation.grpc.host_denylist' => {
1437
1477
  :default => [],
@@ -1448,7 +1488,7 @@ module NewRelic
1448
1488
  :type => String,
1449
1489
  :dynamic_name => true,
1450
1490
  :allowed_from_server => false,
1451
- :description => 'Controls auto-instrumentation of gRPC servers at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1491
+ :description => 'Controls auto-instrumentation of gRPC servers at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1452
1492
  },
1453
1493
  :'instrumentation.httpclient' => {
1454
1494
  :default => 'auto',
@@ -1457,7 +1497,7 @@ module NewRelic
1457
1497
  :type => String,
1458
1498
  :dynamic_name => true,
1459
1499
  :allowed_from_server => false,
1460
- :description => 'Controls auto-instrumentation of HTTPClient at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1500
+ :description => 'Controls auto-instrumentation of HTTPClient at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1461
1501
  },
1462
1502
  :'instrumentation.httprb' => {
1463
1503
  :default => 'auto',
@@ -1466,7 +1506,16 @@ module NewRelic
1466
1506
  :type => String,
1467
1507
  :dynamic_name => true,
1468
1508
  :allowed_from_server => false,
1469
- :description => 'Controls auto-instrumentation of http.rb gem at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1509
+ :description => 'Controls auto-instrumentation of http.rb gem at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1510
+ },
1511
+ :'instrumentation.httpx' => {
1512
+ :default => 'auto',
1513
+ :documentation_default => 'auto',
1514
+ :public => true,
1515
+ :type => String,
1516
+ :dynamic_name => true,
1517
+ :allowed_from_server => false,
1518
+ :description => 'Controls auto-instrumentation of httpx at start up. May be one of [auto|prepend|chain|disabled]'
1470
1519
  },
1471
1520
  :'instrumentation.logger' => {
1472
1521
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
@@ -1475,7 +1524,7 @@ module NewRelic
1475
1524
  :type => String,
1476
1525
  :dynamic_name => true,
1477
1526
  :allowed_from_server => false,
1478
- :description => 'Controls auto-instrumentation of Ruby standard library Logger at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1527
+ :description => 'Controls auto-instrumentation of Ruby standard library Logger at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1479
1528
  },
1480
1529
  :'instrumentation.memcache' => {
1481
1530
  :default => 'auto',
@@ -1483,7 +1532,7 @@ module NewRelic
1483
1532
  :type => String,
1484
1533
  :dynamic_name => true,
1485
1534
  :allowed_from_server => false,
1486
- :description => 'Controls auto-instrumentation of dalli gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1535
+ :description => 'Controls auto-instrumentation of dalli gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1487
1536
  },
1488
1537
  :'instrumentation.memcached' => {
1489
1538
  :default => 'auto',
@@ -1492,7 +1541,7 @@ module NewRelic
1492
1541
  :type => String,
1493
1542
  :dynamic_name => true,
1494
1543
  :allowed_from_server => false,
1495
- :description => 'Controls auto-instrumentation of memcached gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1544
+ :description => 'Controls auto-instrumentation of memcached gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1496
1545
  },
1497
1546
  :'instrumentation.memcache_client' => {
1498
1547
  :default => 'auto',
@@ -1501,7 +1550,7 @@ module NewRelic
1501
1550
  :type => String,
1502
1551
  :dynamic_name => true,
1503
1552
  :allowed_from_server => false,
1504
- :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1553
+ :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1505
1554
  },
1506
1555
  :'instrumentation.mongo' => {
1507
1556
  :default => 'enabled',
@@ -1510,7 +1559,7 @@ module NewRelic
1510
1559
  :type => String,
1511
1560
  :dynamic_name => true,
1512
1561
  :allowed_from_server => false,
1513
- :description => 'Controls auto-instrumentation of Mongo at start up. May be one of: `enabled`, `disabled`.'
1562
+ :description => 'Controls auto-instrumentation of Mongo at start-up. May be one of: `enabled`, `disabled`.'
1514
1563
  },
1515
1564
  :'instrumentation.net_http' => {
1516
1565
  :default => 'auto',
@@ -1519,7 +1568,7 @@ module NewRelic
1519
1568
  :type => String,
1520
1569
  :dynamic_name => true,
1521
1570
  :allowed_from_server => false,
1522
- :description => 'Controls auto-instrumentation of `Net::HTTP` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1571
+ :description => 'Controls auto-instrumentation of `Net::HTTP` at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1523
1572
  },
1524
1573
  :'instrumentation.puma_rack' => {
1525
1574
  :default => value_of(:'instrumentation.rack'),
@@ -1539,7 +1588,7 @@ module NewRelic
1539
1588
  :type => String,
1540
1589
  :dynamic_name => true,
1541
1590
  :allowed_from_server => false,
1542
- :description => 'Controls auto-instrumentation of `Puma::Rack::URLMap` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1591
+ :description => 'Controls auto-instrumentation of `Puma::Rack::URLMap` at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1543
1592
  },
1544
1593
  :'instrumentation.rack' => {
1545
1594
  :default => 'auto',
@@ -1559,7 +1608,7 @@ module NewRelic
1559
1608
  :type => String,
1560
1609
  :dynamic_name => true,
1561
1610
  :allowed_from_server => false,
1562
- :description => 'Controls auto-instrumentation of `Rack::URLMap` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1611
+ :description => 'Controls auto-instrumentation of `Rack::URLMap` at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1563
1612
  },
1564
1613
  :'instrumentation.rake' => {
1565
1614
  :default => 'auto',
@@ -1567,7 +1616,7 @@ module NewRelic
1567
1616
  :type => String,
1568
1617
  :dynamic_name => true,
1569
1618
  :allowed_from_server => false,
1570
- :description => 'Controls auto-instrumentation of rake at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1619
+ :description => 'Controls auto-instrumentation of rake at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1571
1620
  },
1572
1621
  :'instrumentation.redis' => {
1573
1622
  :default => 'auto',
@@ -1575,7 +1624,7 @@ module NewRelic
1575
1624
  :type => String,
1576
1625
  :dynamic_name => true,
1577
1626
  :allowed_from_server => false,
1578
- :description => 'Controls auto-instrumentation of Redis at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1627
+ :description => 'Controls auto-instrumentation of Redis at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1579
1628
  },
1580
1629
  :'instrumentation.resque' => {
1581
1630
  :default => 'auto',
@@ -1584,7 +1633,7 @@ module NewRelic
1584
1633
  :type => String,
1585
1634
  :dynamic_name => true,
1586
1635
  :allowed_from_server => false,
1587
- :description => 'Controls auto-instrumentation of resque at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1636
+ :description => 'Controls auto-instrumentation of resque at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1588
1637
  },
1589
1638
  :'instrumentation.roda' => {
1590
1639
  :default => 'auto',
@@ -1592,7 +1641,7 @@ module NewRelic
1592
1641
  :type => String,
1593
1642
  :dynamic_name => true,
1594
1643
  :allowed_from_server => false,
1595
- :description => 'Controls auto-instrumentation of Roda at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1644
+ :description => 'Controls auto-instrumentation of Roda at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1596
1645
  },
1597
1646
  :'instrumentation.sinatra' => {
1598
1647
  :default => 'auto',
@@ -1600,7 +1649,7 @@ module NewRelic
1600
1649
  :type => String,
1601
1650
  :dynamic_name => true,
1602
1651
  :allowed_from_server => false,
1603
- :description => 'Controls auto-instrumentation of Sinatra at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1652
+ :description => 'Controls auto-instrumentation of Sinatra at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1604
1653
  },
1605
1654
  :'instrumentation.stripe' => {
1606
1655
  :default => 'enabled',
@@ -1609,6 +1658,14 @@ module NewRelic
1609
1658
  :allowed_from_server => false,
1610
1659
  :description => 'Controls auto-instrumentation of Stripe at startup. May be one of: `enabled`, `disabled`.'
1611
1660
  },
1661
+ :'instrumentation.view_component' => {
1662
+ :default => 'auto',
1663
+ :public => true,
1664
+ :type => String,
1665
+ :dynamic_name => true,
1666
+ :allowed_from_server => false,
1667
+ :description => 'Controls auto-instrumentation of ViewComponent at startup. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1668
+ },
1612
1669
  :'stripe.user_data.include' => {
1613
1670
  default: NewRelic::EMPTY_ARRAY,
1614
1671
  public: true,
@@ -1633,7 +1690,7 @@ module NewRelic
1633
1690
  An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
1634
1691
  not be reported to New Relic. Each string in this array will be turned into a regular expression via
1635
1692
  `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the
1636
- pair will not be reported. By default, no `user_data` is reported, so this option should only be used if
1693
+ pair will not be reported. By default, no `user_data` is reported, so this option should only be used if
1637
1694
  the `stripe.user_data.include` option is being used.
1638
1695
  DESCRIPTION
1639
1696
  },
@@ -1643,14 +1700,14 @@ module NewRelic
1643
1700
  :type => String,
1644
1701
  :dynamic_name => true,
1645
1702
  :allowed_from_server => false,
1646
- :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`.'
1703
+ :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`.'
1647
1704
  },
1648
1705
  :'instrumentation.thread.tracing' => {
1649
1706
  :default => true,
1650
1707
  :public => true,
1651
1708
  :type => Boolean,
1652
1709
  :allowed_from_server => false,
1653
- :description => 'Controls auto-instrumentation of the Thread class at start up to automatically add tracing to all Threads created in the application.'
1710
+ :description => 'Controls auto-instrumentation of the Thread class at start-up to automatically add tracing to all Threads created in the application.'
1654
1711
  },
1655
1712
  :'thread_ids_enabled' => {
1656
1713
  :default => false,
@@ -1665,7 +1722,7 @@ module NewRelic
1665
1722
  :type => String,
1666
1723
  :dynamic_name => true,
1667
1724
  :allowed_from_server => false,
1668
- :description => 'Controls auto-instrumentation of the Tilt template rendering library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1725
+ :description => 'Controls auto-instrumentation of the Tilt template rendering library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1669
1726
  },
1670
1727
  :'instrumentation.typhoeus' => {
1671
1728
  :default => 'auto',
@@ -1674,7 +1731,7 @@ module NewRelic
1674
1731
  :type => String,
1675
1732
  :dynamic_name => true,
1676
1733
  :allowed_from_server => false,
1677
- :description => 'Controls auto-instrumentation of Typhoeus at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1734
+ :description => 'Controls auto-instrumentation of Typhoeus at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1678
1735
  },
1679
1736
  # Message tracer
1680
1737
  :'message_tracer.segment_parameters.enabled' => {
@@ -2180,7 +2237,8 @@ module NewRelic
2180
2237
  :public => false,
2181
2238
  :type => String,
2182
2239
  :allowed_from_server => true,
2183
- :description => 'JavaScript agent loader content.'
2240
+ :description => 'JavaScript agent loader content.',
2241
+ :exclude_from_reported_settings => true
2184
2242
  },
2185
2243
  :keep_alive_timeout => {
2186
2244
  :default => 60,
@@ -2307,7 +2365,7 @@ module NewRelic
2307
2365
  :public => false,
2308
2366
  :type => Boolean,
2309
2367
  :allowed_from_server => false,
2310
- :description => 'Used in tests for the agent to start up, but not connect to the collector. Formerly used `developer_mode` in test config for this purpose.'
2368
+ :description => 'Used in tests for the agent to start-up, but not connect to the collector. Formerly used `developer_mode` in test config for this purpose.'
2311
2369
  },
2312
2370
  :'thread_profiler.max_profile_overhead' => {
2313
2371
  :default => 0.05,
@@ -2356,6 +2414,7 @@ module NewRelic
2356
2414
  :description => 'This value represents the total amount of memory available to the host (not the process), in mebibytes (1024 squared or 1,048,576 bytes).'
2357
2415
  }
2358
2416
  }.freeze
2417
+ # rubocop:enable Metrics/CollectionLiteralLength
2359
2418
  end
2360
2419
  end
2361
2420
  end
@@ -230,7 +230,7 @@ module NewRelic
230
230
  end
231
231
 
232
232
  def to_collector_hash
233
- DottedHash.new(apply_mask(flattened)).to_hash.delete_if do |k, v|
233
+ DottedHash.new(apply_mask(flattened)).to_hash.delete_if do |k, _v|
234
234
  default = DEFAULTS[k]
235
235
  if default
236
236
  default[:exclude_from_reported_settings]
@@ -364,7 +364,7 @@ module NewRelic
364
364
  def reset_cache
365
365
  return new_cache unless defined?(@cache) && @cache
366
366
 
367
- preserved = @cache.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
367
+ preserved = @cache.dup.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) }
368
368
  new_cache
369
369
  preserved.each { |k, v| @cache[k] = v }
370
370
 
@@ -376,12 +376,13 @@ module NewRelic
376
376
  end
377
377
 
378
378
  def log_config(direction, source)
379
- # Just generating this log message (specifically calling
380
- # flattened.inspect) is expensive enough that we don't want to do it
381
- # unless we're actually going to be logging the message based on our
382
- # current log level.
379
+ # Just generating this log message (specifically calling `flattened`)
380
+ # is expensive enough that we don't want to do it unless we're
381
+ # actually going to be logging the message based on our current log
382
+ # level, so use a `do` block.
383
383
  ::NewRelic::Agent.logger.debug do
384
- "Updating config (#{direction}) from #{source.class}. Results: #{flattened.inspect}"
384
+ hash = flattened.delete_if { |k, _h| DEFAULTS.fetch(k, {}).fetch(:exclude_from_reported_settings, false) }
385
+ "Updating config (#{direction}) from #{source.class}. Results: #{hash.inspect}"
385
386
  end
386
387
  end
387
388
 
@@ -128,7 +128,7 @@ module NewRelic
128
128
  end
129
129
 
130
130
  def self.drop_indexes?(name, payload)
131
- name == :deleteIndexes && payload[:selector] && payload[:selector][:index] == '*'
131
+ name == :deleteIndexes && payload[:selector] && payload[:selector][:index] == ASTERISK
132
132
  end
133
133
 
134
134
  def self.drop_index?(name, payload)
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  require 'json'
6
- require 'base64'
6
+ require 'new_relic/base64'
7
7
 
8
8
  module NewRelic
9
9
  module Agent
@@ -78,7 +78,7 @@ module NewRelic
78
78
  end
79
79
 
80
80
  def from_http_safe(http_safe_payload)
81
- decoded_payload = Base64.strict_decode64(http_safe_payload)
81
+ decoded_payload = NewRelic::Base64.strict_decode64(http_safe_payload)
82
82
  from_json(decoded_payload)
83
83
  end
84
84
 
@@ -156,7 +156,7 @@ module NewRelic
156
156
  #
157
157
  # @api public
158
158
  def http_safe
159
- Base64.strict_encode64(text)
159
+ NewRelic::Base64.strict_encode64(text)
160
160
  end
161
161
  end
162
162
  end
@@ -156,7 +156,7 @@ module NewRelic
156
156
  end
157
157
 
158
158
  if !errors.empty?
159
- ::NewRelic::Agent.logger.error("#{errors.size} error(s) running task for event '#{event}' in Agent Event Loop:", *errors)
159
+ ::NewRelic::Agent.logger.error("#{errors.size} error(s) running task for event '#{event}' in agent event loop:", *errors)
160
160
  end
161
161
  end
162
162
 
@@ -14,6 +14,10 @@ module NewRelic
14
14
  #
15
15
  # @api public
16
16
  class AbstractRequest
17
+ LHOST = 'host'
18
+ UHOST = 'Host'
19
+ COLON = ':'
20
+
17
21
  %i[[] []= type host_from_header host method headers uri].each do |name|
18
22
  define_method(name) do
19
23
  not_implemented(name)
@@ -0,0 +1,80 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ require_relative 'abstract'
6
+ require 'resolv'
7
+
8
+ module NewRelic
9
+ module Agent
10
+ module HTTPClients
11
+ class AsyncHTTPResponse < AbstractResponse
12
+ def get_status_code
13
+ get_status_code_using(:status)
14
+ end
15
+
16
+ def [](key)
17
+ to_hash[key.downcase]&.first
18
+ end
19
+
20
+ def to_hash
21
+ @wrapped_response.headers.to_h
22
+ end
23
+ end
24
+
25
+ class AsyncHTTPRequest < AbstractRequest
26
+ def initialize(connection, method, url, headers)
27
+ @connection = connection
28
+ @method = method
29
+ @url = ::NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(url)
30
+ @headers = headers
31
+ end
32
+
33
+ ASYNC_HTTP = 'Async::HTTP'
34
+
35
+ def type
36
+ ASYNC_HTTP
37
+ end
38
+
39
+ def host_from_header
40
+ if hostname = (self[LHOST] || self[UHOST])
41
+ hostname.split(COLON).first
42
+ end
43
+ end
44
+
45
+ def host
46
+ host_from_header || uri.host.to_s
47
+ end
48
+
49
+ def [](key)
50
+ return headers[key] unless headers.is_a?(Array)
51
+
52
+ headers.each do |header|
53
+ return header[1] if header[0].casecmp?(key)
54
+ end
55
+ nil
56
+ end
57
+
58
+ def []=(key, value)
59
+ if headers.is_a?(Array)
60
+ headers << [key, value]
61
+ else
62
+ headers[key] = value
63
+ end
64
+ end
65
+
66
+ def uri
67
+ @url
68
+ end
69
+
70
+ def headers
71
+ @headers
72
+ end
73
+
74
+ def method
75
+ @method
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -7,10 +7,8 @@ require_relative 'abstract'
7
7
  module NewRelic
8
8
  module Agent
9
9
  module HTTPClients
10
- class CurbRequest
10
+ class CurbRequest < AbstractRequest
11
11
  CURB = 'Curb'
12
- LHOST = 'host'
13
- UHOST = 'Host'
14
12
 
15
13
  def initialize(curlobj)
16
14
  @curlobj = curlobj