newrelic_rpm 9.4.2 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +138 -10
  3. data/Rakefile +1 -1
  4. data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
  5. data/lib/new_relic/agent/configuration/default_source.rb +153 -33
  6. data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +83 -0
  7. data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +111 -0
  8. data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +93 -0
  9. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -2
  10. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
  11. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
  12. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
  13. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
  14. data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +4 -0
  15. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
  16. data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
  17. data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
  18. data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
  19. data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
  20. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +9 -0
  21. data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +2 -2
  22. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +4 -0
  23. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +3 -0
  24. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +4 -1
  25. data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
  26. data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
  27. data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
  28. data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
  29. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -0
  30. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -0
  31. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +4 -0
  32. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +4 -0
  33. data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
  34. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  35. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +4 -0
  36. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
  37. data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
  38. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
  39. data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
  40. data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
  41. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
  42. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +9 -0
  43. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -3
  44. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -1
  45. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +4 -0
  46. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +4 -0
  47. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +6 -0
  48. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +4 -0
  49. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -0
  50. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +4 -0
  51. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +4 -0
  52. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
  53. data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
  54. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +16 -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/client.rb +4 -0
  58. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
  59. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -3
  60. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -0
  61. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -3
  62. data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
  63. data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +77 -0
  64. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +4 -0
  65. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -1
  66. data/lib/new_relic/agent/messaging.rb +2 -2
  67. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
  68. data/lib/new_relic/agent/rules_engine.rb +1 -1
  69. data/lib/new_relic/agent/span_event_primitive.rb +16 -4
  70. data/lib/new_relic/agent/system_info.rb +26 -0
  71. data/lib/new_relic/agent/tracer.rb +1 -3
  72. data/lib/new_relic/agent/transaction/abstract_segment.rb +55 -0
  73. data/lib/new_relic/agent/transaction/external_request_segment.rb +5 -2
  74. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -2
  75. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -3
  76. data/lib/new_relic/agent/transaction.rb +25 -2
  77. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -0
  78. data/lib/new_relic/agent/transaction_event_primitive.rb +19 -0
  79. data/lib/new_relic/agent/utilization/gcp.rb +1 -3
  80. data/lib/new_relic/agent.rb +18 -2
  81. data/lib/new_relic/constants.rb +3 -0
  82. data/lib/new_relic/control/frameworks/rails.rb +14 -2
  83. data/lib/new_relic/language_support.rb +4 -0
  84. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  85. data/lib/new_relic/rack/agent_middleware.rb +0 -16
  86. data/lib/new_relic/supportability_helper.rb +1 -0
  87. data/lib/new_relic/version.rb +2 -2
  88. data/lib/tasks/instrumentation_generator/instrumentation.thor +3 -3
  89. data/lib/tasks/tests.rake +71 -0
  90. data/newrelic.yml +93 -32
  91. data/newrelic_rpm.gemspec +4 -1
  92. metadata +39 -2
@@ -3,6 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  require 'forwardable'
6
+ require_relative '../../constants'
6
7
 
7
8
  module NewRelic
8
9
  module Agent
@@ -1013,7 +1014,20 @@ module NewRelic
1013
1014
  },
1014
1015
  # Autostart
1015
1016
  :'autostart.denylisted_constants' => {
1016
- :default => 'Rails::Console',
1017
+ :default => %w[Rails::Command::ConsoleCommand
1018
+ Rails::Command::CredentialsCommand
1019
+ Rails::Command::Db::System::ChangeCommand
1020
+ Rails::Command::DbConsoleCommand
1021
+ Rails::Command::DestroyCommand
1022
+ Rails::Command::DevCommand
1023
+ Rails::Command::EncryptedCommand
1024
+ Rails::Command::GenerateCommand
1025
+ Rails::Command::InitializersCommand
1026
+ Rails::Command::NotesCommand
1027
+ Rails::Command::RoutesCommand
1028
+ Rails::Command::SecretsCommand
1029
+ Rails::Console
1030
+ Rails::DBConsole].join(','),
1017
1031
  :public => true,
1018
1032
  :type => String,
1019
1033
  :allowed_from_server => false,
@@ -1212,7 +1226,13 @@ module NewRelic
1212
1226
  :public => true,
1213
1227
  :type => Boolean,
1214
1228
  :allowed_from_server => false,
1215
- :description => 'If `true`, the agent won\'t wrap third-party middlewares in instrumentation (regardless of whether they are installed via `Rack::Builder` or Rails).'
1229
+ :description => <<~DESCRIPTION
1230
+ If `true`, the agent won't wrap third-party middlewares in instrumentation (regardless of whether they are installed via `Rack::Builder` or Rails).
1231
+
1232
+ <Callout variant="important">
1233
+ When middleware instrumentation is disabled, if an application is using middleware that could alter the response code, the HTTP status code reported on the transaction may not reflect the altered value.
1234
+ </Callout>
1235
+ DESCRIPTION
1216
1236
  },
1217
1237
  :disable_samplers => {
1218
1238
  :default => false,
@@ -1341,6 +1361,15 @@ module NewRelic
1341
1361
  :description => 'Configures the TCP/IP port for the trace observer Host'
1342
1362
  },
1343
1363
  # Instrumentation
1364
+ :'instrumentation.active_support_broadcast_logger' => {
1365
+ :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
1366
+ :documentation_default => 'auto',
1367
+ :dynamic_name => true,
1368
+ :public => true,
1369
+ :type => String,
1370
+ :allowed_from_server => false,
1371
+ :description => 'Controls auto-instrumentation of `ActiveSupport::BroadcastLogger` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`. Used in Rails versions >= 7.1.'
1372
+ },
1344
1373
  :'instrumentation.active_support_logger' => {
1345
1374
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
1346
1375
  :documentation_default => 'auto',
@@ -1348,7 +1377,15 @@ module NewRelic
1348
1377
  :public => true,
1349
1378
  :type => String,
1350
1379
  :allowed_from_server => false,
1351
- :description => 'Controls auto-instrumentation of `ActiveSupport::Logger` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1380
+ :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.'
1381
+ },
1382
+ :'instrumentation.async_http' => {
1383
+ :default => 'auto',
1384
+ :public => true,
1385
+ :type => String,
1386
+ :dynamic_name => true,
1387
+ :allowed_from_server => false,
1388
+ :description => 'Controls auto-instrumentation of Async::HTTP at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1352
1389
  },
1353
1390
  :'instrumentation.bunny' => {
1354
1391
  :default => 'auto',
@@ -1356,7 +1393,7 @@ module NewRelic
1356
1393
  :type => String,
1357
1394
  :dynamic_name => true,
1358
1395
  :allowed_from_server => false,
1359
- :description => 'Controls auto-instrumentation of bunny at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1396
+ :description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1360
1397
  },
1361
1398
  :'instrumentation.fiber' => {
1362
1399
  :default => 'auto',
@@ -1364,7 +1401,7 @@ module NewRelic
1364
1401
  :type => String,
1365
1402
  :dynamic_name => true,
1366
1403
  :allowed_from_server => false,
1367
- :description => 'Controls auto-instrumentation of the Fiber class at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1404
+ :description => 'Controls auto-instrumentation of the Fiber class at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1368
1405
  },
1369
1406
  :'instrumentation.concurrent_ruby' => {
1370
1407
  :default => 'auto',
@@ -1372,7 +1409,7 @@ module NewRelic
1372
1409
  :type => String,
1373
1410
  :dynamic_name => true,
1374
1411
  :allowed_from_server => false,
1375
- :description => 'Controls auto-instrumentation of the concurrent-ruby library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1412
+ :description => 'Controls auto-instrumentation of the concurrent-ruby library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1376
1413
  },
1377
1414
  :'instrumentation.curb' => {
1378
1415
  :default => 'auto',
@@ -1381,7 +1418,7 @@ module NewRelic
1381
1418
  :type => String,
1382
1419
  :dynamic_name => true,
1383
1420
  :allowed_from_server => false,
1384
- :description => 'Controls auto-instrumentation of Curb at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1421
+ :description => 'Controls auto-instrumentation of Curb at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1385
1422
  },
1386
1423
  :'instrumentation.delayed_job' => {
1387
1424
  :default => 'auto',
@@ -1390,7 +1427,7 @@ module NewRelic
1390
1427
  :type => String,
1391
1428
  :dynamic_name => true,
1392
1429
  :allowed_from_server => false,
1393
- :description => 'Controls auto-instrumentation of Delayed Job at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1430
+ :description => 'Controls auto-instrumentation of Delayed Job at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1394
1431
  },
1395
1432
  :'instrumentation.elasticsearch' => {
1396
1433
  :default => 'auto',
@@ -1398,7 +1435,15 @@ module NewRelic
1398
1435
  :type => String,
1399
1436
  :dynamic_name => true,
1400
1437
  :allowed_from_server => false,
1401
- :description => 'Controls auto-instrumentation of the elasticsearch library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1438
+ :description => 'Controls auto-instrumentation of the elasticsearch library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1439
+ },
1440
+ :'instrumentation.ethon' => {
1441
+ :default => 'auto',
1442
+ :public => true,
1443
+ :type => String,
1444
+ :dynamic_name => true,
1445
+ :allowed_from_server => false,
1446
+ :description => 'Controls auto-instrumentation of ethon at start up. May be one of [auto|prepend|chain|disabled]'
1402
1447
  },
1403
1448
  :'instrumentation.excon' => {
1404
1449
  :default => 'enabled',
@@ -1407,7 +1452,7 @@ module NewRelic
1407
1452
  :type => String,
1408
1453
  :dynamic_name => true,
1409
1454
  :allowed_from_server => false,
1410
- :description => 'Controls auto-instrumentation of Excon at start up. May be one of: `enabled`, `disabled`.'
1455
+ :description => 'Controls auto-instrumentation of Excon at start-up. May be one of: `enabled`, `disabled`.'
1411
1456
  },
1412
1457
  :'instrumentation.grape' => {
1413
1458
  :default => 'auto',
@@ -1415,7 +1460,7 @@ module NewRelic
1415
1460
  :type => String,
1416
1461
  :dynamic_name => true,
1417
1462
  :allowed_from_server => false,
1418
- :description => 'Controls auto-instrumentation of Grape at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1463
+ :description => 'Controls auto-instrumentation of Grape at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1419
1464
  },
1420
1465
  :'instrumentation.grpc_client' => {
1421
1466
  :default => 'auto',
@@ -1424,7 +1469,7 @@ module NewRelic
1424
1469
  :type => String,
1425
1470
  :dynamic_name => true,
1426
1471
  :allowed_from_server => false,
1427
- :description => 'Controls auto-instrumentation of gRPC clients at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1472
+ :description => 'Controls auto-instrumentation of gRPC clients at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1428
1473
  },
1429
1474
  :'instrumentation.grpc.host_denylist' => {
1430
1475
  :default => [],
@@ -1441,7 +1486,7 @@ module NewRelic
1441
1486
  :type => String,
1442
1487
  :dynamic_name => true,
1443
1488
  :allowed_from_server => false,
1444
- :description => 'Controls auto-instrumentation of gRPC servers at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1489
+ :description => 'Controls auto-instrumentation of gRPC servers at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1445
1490
  },
1446
1491
  :'instrumentation.httpclient' => {
1447
1492
  :default => 'auto',
@@ -1450,7 +1495,7 @@ module NewRelic
1450
1495
  :type => String,
1451
1496
  :dynamic_name => true,
1452
1497
  :allowed_from_server => false,
1453
- :description => 'Controls auto-instrumentation of HTTPClient at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1498
+ :description => 'Controls auto-instrumentation of HTTPClient at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1454
1499
  },
1455
1500
  :'instrumentation.httprb' => {
1456
1501
  :default => 'auto',
@@ -1459,7 +1504,16 @@ module NewRelic
1459
1504
  :type => String,
1460
1505
  :dynamic_name => true,
1461
1506
  :allowed_from_server => false,
1462
- :description => 'Controls auto-instrumentation of http.rb gem at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1507
+ :description => 'Controls auto-instrumentation of http.rb gem at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1508
+ },
1509
+ :'instrumentation.httpx' => {
1510
+ :default => 'auto',
1511
+ :documentation_default => 'auto',
1512
+ :public => true,
1513
+ :type => String,
1514
+ :dynamic_name => true,
1515
+ :allowed_from_server => false,
1516
+ :description => 'Controls auto-instrumentation of httpx at start up. May be one of [auto|prepend|chain|disabled]'
1463
1517
  },
1464
1518
  :'instrumentation.logger' => {
1465
1519
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
@@ -1468,7 +1522,7 @@ module NewRelic
1468
1522
  :type => String,
1469
1523
  :dynamic_name => true,
1470
1524
  :allowed_from_server => false,
1471
- :description => 'Controls auto-instrumentation of Ruby standard library Logger at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1525
+ :description => 'Controls auto-instrumentation of Ruby standard library Logger at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1472
1526
  },
1473
1527
  :'instrumentation.memcache' => {
1474
1528
  :default => 'auto',
@@ -1476,7 +1530,7 @@ module NewRelic
1476
1530
  :type => String,
1477
1531
  :dynamic_name => true,
1478
1532
  :allowed_from_server => false,
1479
- :description => 'Controls auto-instrumentation of dalli gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1533
+ :description => 'Controls auto-instrumentation of dalli gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1480
1534
  },
1481
1535
  :'instrumentation.memcached' => {
1482
1536
  :default => 'auto',
@@ -1485,7 +1539,7 @@ module NewRelic
1485
1539
  :type => String,
1486
1540
  :dynamic_name => true,
1487
1541
  :allowed_from_server => false,
1488
- :description => 'Controls auto-instrumentation of memcached gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1542
+ :description => 'Controls auto-instrumentation of memcached gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1489
1543
  },
1490
1544
  :'instrumentation.memcache_client' => {
1491
1545
  :default => 'auto',
@@ -1494,7 +1548,7 @@ module NewRelic
1494
1548
  :type => String,
1495
1549
  :dynamic_name => true,
1496
1550
  :allowed_from_server => false,
1497
- :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1551
+ :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1498
1552
  },
1499
1553
  :'instrumentation.mongo' => {
1500
1554
  :default => 'enabled',
@@ -1503,7 +1557,7 @@ module NewRelic
1503
1557
  :type => String,
1504
1558
  :dynamic_name => true,
1505
1559
  :allowed_from_server => false,
1506
- :description => 'Controls auto-instrumentation of Mongo at start up. May be one of: `enabled`, `disabled`.'
1560
+ :description => 'Controls auto-instrumentation of Mongo at start-up. May be one of: `enabled`, `disabled`.'
1507
1561
  },
1508
1562
  :'instrumentation.net_http' => {
1509
1563
  :default => 'auto',
@@ -1512,7 +1566,7 @@ module NewRelic
1512
1566
  :type => String,
1513
1567
  :dynamic_name => true,
1514
1568
  :allowed_from_server => false,
1515
- :description => 'Controls auto-instrumentation of `Net::HTTP` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1569
+ :description => 'Controls auto-instrumentation of `Net::HTTP` at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1516
1570
  },
1517
1571
  :'instrumentation.puma_rack' => {
1518
1572
  :default => value_of(:'instrumentation.rack'),
@@ -1532,7 +1586,7 @@ module NewRelic
1532
1586
  :type => String,
1533
1587
  :dynamic_name => true,
1534
1588
  :allowed_from_server => false,
1535
- :description => 'Controls auto-instrumentation of `Puma::Rack::URLMap` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1589
+ :description => 'Controls auto-instrumentation of `Puma::Rack::URLMap` at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1536
1590
  },
1537
1591
  :'instrumentation.rack' => {
1538
1592
  :default => 'auto',
@@ -1552,7 +1606,7 @@ module NewRelic
1552
1606
  :type => String,
1553
1607
  :dynamic_name => true,
1554
1608
  :allowed_from_server => false,
1555
- :description => 'Controls auto-instrumentation of `Rack::URLMap` at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1609
+ :description => 'Controls auto-instrumentation of `Rack::URLMap` at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1556
1610
  },
1557
1611
  :'instrumentation.rake' => {
1558
1612
  :default => 'auto',
@@ -1560,7 +1614,7 @@ module NewRelic
1560
1614
  :type => String,
1561
1615
  :dynamic_name => true,
1562
1616
  :allowed_from_server => false,
1563
- :description => 'Controls auto-instrumentation of rake at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1617
+ :description => 'Controls auto-instrumentation of rake at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1564
1618
  },
1565
1619
  :'instrumentation.redis' => {
1566
1620
  :default => 'auto',
@@ -1568,7 +1622,7 @@ module NewRelic
1568
1622
  :type => String,
1569
1623
  :dynamic_name => true,
1570
1624
  :allowed_from_server => false,
1571
- :description => 'Controls auto-instrumentation of Redis at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1625
+ :description => 'Controls auto-instrumentation of Redis at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1572
1626
  },
1573
1627
  :'instrumentation.resque' => {
1574
1628
  :default => 'auto',
@@ -1577,7 +1631,7 @@ module NewRelic
1577
1631
  :type => String,
1578
1632
  :dynamic_name => true,
1579
1633
  :allowed_from_server => false,
1580
- :description => 'Controls auto-instrumentation of resque at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1634
+ :description => 'Controls auto-instrumentation of resque at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1581
1635
  },
1582
1636
  :'instrumentation.roda' => {
1583
1637
  :default => 'auto',
@@ -1585,7 +1639,7 @@ module NewRelic
1585
1639
  :type => String,
1586
1640
  :dynamic_name => true,
1587
1641
  :allowed_from_server => false,
1588
- :description => 'Controls auto-instrumentation of Roda at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1642
+ :description => 'Controls auto-instrumentation of Roda at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1589
1643
  },
1590
1644
  :'instrumentation.sinatra' => {
1591
1645
  :default => 'auto',
@@ -1593,7 +1647,42 @@ module NewRelic
1593
1647
  :type => String,
1594
1648
  :dynamic_name => true,
1595
1649
  :allowed_from_server => false,
1596
- :description => 'Controls auto-instrumentation of Sinatra at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1650
+ :description => 'Controls auto-instrumentation of Sinatra at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1651
+ },
1652
+ :'instrumentation.stripe' => {
1653
+ :default => 'enabled',
1654
+ :public => true,
1655
+ :type => String,
1656
+ :allowed_from_server => false,
1657
+ :description => 'Controls auto-instrumentation of Stripe at startup. May be one of: `enabled`, `disabled`.'
1658
+ },
1659
+ :'stripe.user_data.include' => {
1660
+ default: NewRelic::EMPTY_ARRAY,
1661
+ public: true,
1662
+ type: Array,
1663
+ dynamic_name: true,
1664
+ allowed_from_server: false,
1665
+ :transform => DefaultSource.method(:convert_to_list),
1666
+ :description => <<~DESCRIPTION
1667
+ An array of strings to specify which keys inside a Stripe event's `user_data` hash should be reported
1668
+ to New Relic. Each string in this array will be turned into a regular expression via `Regexp.new` to
1669
+ permit advanced matching. Setting the value to `["."]` will report all `user_data`.
1670
+ DESCRIPTION
1671
+ },
1672
+ :'stripe.user_data.exclude' => {
1673
+ default: NewRelic::EMPTY_ARRAY,
1674
+ public: true,
1675
+ type: Array,
1676
+ dynamic_name: true,
1677
+ allowed_from_server: false,
1678
+ :transform => DefaultSource.method(:convert_to_list),
1679
+ :description => <<~DESCRIPTION
1680
+ An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
1681
+ not be reported to New Relic. Each string in this array will be turned into a regular expression via
1682
+ `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the
1683
+ pair will not be reported. By default, no `user_data` is reported, so this option should only be used if
1684
+ the `stripe.user_data.include` option is being used.
1685
+ DESCRIPTION
1597
1686
  },
1598
1687
  :'instrumentation.thread' => {
1599
1688
  :default => 'auto',
@@ -1601,14 +1690,14 @@ module NewRelic
1601
1690
  :type => String,
1602
1691
  :dynamic_name => true,
1603
1692
  :allowed_from_server => false,
1604
- :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`.'
1693
+ :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`.'
1605
1694
  },
1606
1695
  :'instrumentation.thread.tracing' => {
1607
1696
  :default => true,
1608
1697
  :public => true,
1609
1698
  :type => Boolean,
1610
1699
  :allowed_from_server => false,
1611
- :description => 'Controls auto-instrumentation of the Thread class at start up to automatically add tracing to all Threads created in the application.'
1700
+ :description => 'Controls auto-instrumentation of the Thread class at start-up to automatically add tracing to all Threads created in the application.'
1612
1701
  },
1613
1702
  :'thread_ids_enabled' => {
1614
1703
  :default => false,
@@ -1623,7 +1712,7 @@ module NewRelic
1623
1712
  :type => String,
1624
1713
  :dynamic_name => true,
1625
1714
  :allowed_from_server => false,
1626
- :description => 'Controls auto-instrumentation of the Tilt template rendering library at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1715
+ :description => 'Controls auto-instrumentation of the Tilt template rendering library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1627
1716
  },
1628
1717
  :'instrumentation.typhoeus' => {
1629
1718
  :default => 'auto',
@@ -1632,7 +1721,7 @@ module NewRelic
1632
1721
  :type => String,
1633
1722
  :dynamic_name => true,
1634
1723
  :allowed_from_server => false,
1635
- :description => 'Controls auto-instrumentation of Typhoeus at start up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1724
+ :description => 'Controls auto-instrumentation of Typhoeus at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1636
1725
  },
1637
1726
  # Message tracer
1638
1727
  :'message_tracer.segment_parameters.enabled' => {
@@ -1709,6 +1798,37 @@ module NewRelic
1709
1798
  :transform => DefaultSource.method(:convert_to_regexp_list),
1710
1799
  :description => 'Define transactions you want the agent to ignore, by specifying a list of patterns matching the URI you want to ignore. For more detail, see [the docs on ignoring specific transactions](/docs/agents/ruby-agent/api-guides/ignoring-specific-transactions/#config-ignoring).'
1711
1800
  },
1801
+ # Sidekiq
1802
+ :'sidekiq.args.include' => {
1803
+ default: NewRelic::EMPTY_ARRAY,
1804
+ public: true,
1805
+ type: Array,
1806
+ dynamic_name: true,
1807
+ allowed_from_server: false,
1808
+ description: <<~SIDEKIQ_ARGS_INCLUDE.chomp.tr("\n", ' ')
1809
+ An array of strings that will collectively serve as an allowlist for filtering which Sidekiq
1810
+ job arguments get reported to New Relic. To capture any Sidekiq arguments,
1811
+ 'job.sidekiq.args.*' must be added to the separate `:'attributes.include'` configuration option. Each
1812
+ string in this array will be turned into a regular expression via `Regexp.new` to permit advanced
1813
+ matching. For job argument hashes, if either a key or value matches the pair will be included. All
1814
+ matching job argument array elements and job argument scalars will be included.
1815
+ SIDEKIQ_ARGS_INCLUDE
1816
+ },
1817
+ :'sidekiq.args.exclude' => {
1818
+ default: NewRelic::EMPTY_ARRAY,
1819
+ public: true,
1820
+ type: Array,
1821
+ dynamic_name: true,
1822
+ allowed_from_server: false,
1823
+ description: <<~SIDEKIQ_ARGS_EXCLUDE.chomp.tr("\n", ' ')
1824
+ An array of strings that will collectively serve as a denylist for filtering which Sidekiq
1825
+ job arguments get reported to New Relic. To capture any Sidekiq arguments,
1826
+ 'job.sidekiq.args.*' must be added to the separate `:'attributes.include'` configuration option. Each string
1827
+ in this array will be turned into a regular expression via `Regexp.new` to permit advanced matching.
1828
+ For job argument hashes, if either a key or value matches the pair will be excluded. All matching job
1829
+ argument array elements and job argument scalars will be excluded.
1830
+ SIDEKIQ_ARGS_EXCLUDE
1831
+ },
1712
1832
  # Slow SQL
1713
1833
  :'slow_sql.enabled' => {
1714
1834
  :default => value_of(:'transaction_tracer.enabled'),
@@ -2234,7 +2354,7 @@ module NewRelic
2234
2354
  :public => false,
2235
2355
  :type => Boolean,
2236
2356
  :allowed_from_server => false,
2237
- :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.'
2357
+ :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.'
2238
2358
  },
2239
2359
  :'thread_profiler.max_profile_overhead' => {
2240
2360
  :default => 0.05,
@@ -0,0 +1,83 @@
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
+ LHOST = 'host'
35
+ UHOST = 'Host'
36
+ COLON = ':'
37
+
38
+ def type
39
+ ASYNC_HTTP
40
+ end
41
+
42
+ def host_from_header
43
+ if hostname = (self[LHOST] || self[UHOST])
44
+ hostname.split(COLON).first
45
+ end
46
+ end
47
+
48
+ def host
49
+ host_from_header || uri.host.to_s
50
+ end
51
+
52
+ def [](key)
53
+ return headers[key] unless headers.is_a?(Array)
54
+
55
+ headers.each do |header|
56
+ return header[1] if header[0].casecmp?(key)
57
+ end
58
+ nil
59
+ end
60
+
61
+ def []=(key, value)
62
+ if headers.is_a?(Array)
63
+ headers << [key, value]
64
+ else
65
+ headers[key] = value
66
+ end
67
+ end
68
+
69
+ def uri
70
+ @url
71
+ end
72
+
73
+ def headers
74
+ @headers
75
+ end
76
+
77
+ def method
78
+ @method
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,111 @@
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 'uri'
6
+ require_relative 'abstract'
7
+
8
+ module NewRelic
9
+ module Agent
10
+ module HTTPClients
11
+ class EthonHTTPResponse < AbstractResponse
12
+ def initialize(easy)
13
+ @easy = easy
14
+ end
15
+
16
+ def status_code
17
+ @easy.response_code
18
+ end
19
+
20
+ def [](key)
21
+ headers[format_key(key)]
22
+ end
23
+
24
+ def headers
25
+ # Ethon::Easy#response_headers will return '' if headers are unset
26
+ @easy.response_headers.scan(/\n([^:]+?): ([^:\n]+?)\r/).each_with_object({}) do |pair, hash|
27
+ hash[format_key(pair[0])] = pair[1]
28
+ end
29
+ end
30
+ alias to_hash headers
31
+
32
+ private
33
+
34
+ def format_key(key)
35
+ key.tr('-', '_').downcase
36
+ end
37
+ end
38
+
39
+ class EthonHTTPRequest < AbstractRequest
40
+ attr_reader :uri
41
+
42
+ DEFAULT_ACTION = 'GET'
43
+ DEFAULT_HOST = 'UNKNOWN_HOST'
44
+ ETHON = 'Ethon'
45
+ LHOST = 'host'.freeze
46
+ UHOST = 'Host'.freeze
47
+
48
+ def initialize(easy)
49
+ @easy = easy
50
+ @uri = uri_from_easy
51
+ end
52
+
53
+ def type
54
+ ETHON
55
+ end
56
+
57
+ def host_from_header
58
+ self[LHOST] || self[UHOST]
59
+ end
60
+
61
+ def uri_from_easy
62
+ # anticipate `Ethon::Easy#url` being `example.com` without a protocol
63
+ # defined and use an 'http' protocol prefix for `URI.parse` to work
64
+ # with the URL as desired
65
+ url_str = @easy.url.match?(':') ? @easy.url : "http://#{@easy.url}"
66
+ begin
67
+ URI.parse(url_str)
68
+ rescue URI::InvalidURIError => e
69
+ NewRelic::Agent.logger.debug("Failed to parse URI '#{url_str}': #{e.class} - #{e.message}")
70
+ URI.parse(NewRelic::EMPTY_STR)
71
+ end
72
+ end
73
+
74
+ def host
75
+ host_from_header || uri.host&.downcase || DEFAULT_HOST
76
+ end
77
+
78
+ def method
79
+ return DEFAULT_ACTION unless @easy.instance_variable_defined?(action_instance_var)
80
+
81
+ @easy.instance_variable_get(action_instance_var)
82
+ end
83
+
84
+ def action_instance_var
85
+ NewRelic::Agent::Instrumentation::Ethon::Easy::ACTION_INSTANCE_VAR
86
+ end
87
+
88
+ def []=(key, value)
89
+ headers[key] = value
90
+ @easy.headers = headers
91
+ end
92
+
93
+ def headers
94
+ @headers ||= if @easy.instance_variable_defined?(headers_instance_var)
95
+ @easy.instance_variable_get(headers_instance_var)
96
+ else
97
+ {}
98
+ end
99
+ end
100
+
101
+ def headers_instance_var
102
+ NewRelic::Agent::Instrumentation::Ethon::Easy::HEADERS_INSTANCE_VAR
103
+ end
104
+
105
+ def [](key)
106
+ headers[key]
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end