newrelic_rpm 9.5.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -6
  3. data/Rakefile +1 -1
  4. data/lib/new_relic/agent/configuration/default_source.rb +80 -33
  5. data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +83 -0
  6. data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +111 -0
  7. data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +93 -0
  8. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -2
  9. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
  10. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
  11. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
  12. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
  13. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
  14. data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
  15. data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
  16. data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
  17. data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
  18. data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
  19. data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
  20. data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
  21. data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
  22. data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
  23. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
  24. data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
  25. data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
  26. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -3
  27. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +1 -1
  28. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -0
  29. data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
  30. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +12 -0
  31. data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +1 -2
  32. data/lib/new_relic/agent/instrumentation/roda.rb +2 -0
  33. data/lib/new_relic/agent/instrumentation/sidekiq.rb +3 -1
  34. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -3
  35. data/lib/new_relic/agent/messaging.rb +2 -2
  36. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
  37. data/lib/new_relic/agent/rules_engine.rb +1 -1
  38. data/lib/new_relic/agent/span_event_primitive.rb +16 -4
  39. data/lib/new_relic/agent/system_info.rb +26 -0
  40. data/lib/new_relic/agent/tracer.rb +1 -3
  41. data/lib/new_relic/agent/transaction/abstract_segment.rb +3 -0
  42. data/lib/new_relic/agent/transaction/external_request_segment.rb +5 -2
  43. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -2
  44. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -3
  45. data/lib/new_relic/agent/transaction.rb +25 -2
  46. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -0
  47. data/lib/new_relic/agent/transaction_event_primitive.rb +19 -0
  48. data/lib/new_relic/agent/utilization/gcp.rb +1 -3
  49. data/lib/new_relic/agent.rb +6 -2
  50. data/lib/new_relic/constants.rb +3 -0
  51. data/lib/new_relic/control/frameworks/rails.rb +14 -2
  52. data/lib/new_relic/language_support.rb +4 -0
  53. data/lib/new_relic/version.rb +1 -1
  54. data/lib/tasks/instrumentation_generator/instrumentation.thor +3 -3
  55. data/lib/tasks/tests.rake +71 -0
  56. data/newrelic.yml +49 -33
  57. data/newrelic_rpm.gemspec +4 -1
  58. metadata +36 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5e1f4605a4afe166aa2035486a2433f91f4d0432666b787e6d9c5af9e5ee717
4
- data.tar.gz: 16e7707b8c81774ea0c2bea54825d023c2849d0a03ab553e25800c131d9c2972
3
+ metadata.gz: e08eba5efd3af57153446155d8c29ea47a55641bbf8c593105be4242325b1613
4
+ data.tar.gz: 571ec550538228168b2cafdf64f3cb55360aaac3ab33938d1200bf63ee840506
5
5
  SHA512:
6
- metadata.gz: 8180f7caa158ce2ea794914376f441f5f912f46fbce8caca074b8c2c9a06fb84ca5e290eab2aa63dfa68f5385e6f7f9f3ede8ee00ee97fbc30d692b93721ec8e
7
- data.tar.gz: 21062253bf9236563dcd226ccc4e5e2f8d1fceaed24f6047fb6ed23f485f8b0e4607bbe9b7985c4a63809767c2f4b5785e4ec52c25ff6d2ac186ff7fb8a149f7
6
+ metadata.gz: 13fae847437ac99e08ac4bc25545074e4bf300c91abdabc2d3afcb0b3e7fb87987c1c811bdb7b7eb4a4470d3d58bc11266ee75d6d21672cdab3437418d42814c
7
+ data.tar.gz: 4eb79daba4531d41b736099e904126af44421a3ca9457fed3a0b9d89ea90973674b204d1f96d2fbe28f449b452d8b12c01b73f991bf3ceb26cfafe0bf7cf794d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.6.0
4
+
5
+ Version 9.6.0 adds instrumentation for Async::HTTP, Ethon, and HTTPX, adds the ability to ignore specific routes with Roda, gleans Docker container IDs from cgroups v2-based containers, records additional synthetics attributes, fixes an issue with Rails 7.1 that could cause duplicate log records to be sent to New Relic, fixes a deprecation warning for the Sidekiq error handler, adds additional attributes for OpenTelemetry compatibility, and resolves some technical debt, thanks to the community.
6
+
7
+ - **Feature: Add instrumentation for Async::HTTP**
8
+
9
+ The agent will now record spans for Async::HTTP requests. Versions 0.59.0 and above of the async-http gem are supported. [PR#2272](https://github.com/newrelic/newrelic-ruby-agent/pull/2272)
10
+
11
+ - **Feature: Add instrumentation for Ethon**
12
+
13
+ Instrumentation has been added for the [Ethon](https://github.com/typhoeus/ethon) HTTP client gem. Versions 0.12.0 and above are supported. The agent will now record external request segments for invocations of `Ethon::Easy#perform` and `Ethon::Multi#perform`. NOTE: The [Typhoeus](https://github.com/typhoeus/typhoeus) gem is maintained by the same team that maintains Ethon and depends on Ethon for its functionality. To prevent duplicate reporting for each HTTP request, the Ethon instrumentation will be disabled when Typhoeus is detected. [PR#2260](https://github.com/newrelic/newrelic-ruby-agent/pull/2260)
14
+
15
+ - **Feature: Add instrumentation for HTTPX**
16
+
17
+ The agent now offers instrumentation for the HTTP client [HTTPX](https://honeyryderchuck.gitlab.io/httpx/), provided the gem is at version 1.0.0 or above. [PR#2278](https://github.com/newrelic/newrelic-ruby-agent/pull/2278)
18
+
19
+ - **Feature: Prevent the agent from starting in "rails" commands in Rails 7**
20
+
21
+ Previously, the agent ignored many Rails commands by default, such as `rails routes`, using Rake-specific logic. This was accomplished by setting these commands as default values for the config option `autostart.denylisted_rake_tasks`. However, Rails 7 no longer uses Rake for these commands, causing the agent to start running and attempting to record data when running these commands. The commands have now been added to the default value for the config option `autostart.denylisted_constants`, which will allow the agent to recognize these commands correctly in Rails 7 and prevent the agent from starting during ignored tasks. Note that the agent will continue to start-up when the `rails server` and `rails runner` commands are invoked. [PR#2239](https://github.com/newrelic/newrelic-ruby-agent/pull/2239)
22
+
23
+ - **Feature: Glean Docker container ID for cgroups v2-based containers**
24
+
25
+ Previously, the agent was only capable of determining a host Docker container's ID if the container was based on cgroups v1. Now, containers based on cgroups v2 will also have their container IDs reported to New Relic. [PR#2229](https://github.com/newrelic/newrelic-ruby-agent/issues/2229).
26
+
27
+ - **Feature: Update events with additional synthetics attributes when available**
28
+
29
+ The agent will now record additional synthetics attributes on synthetics events if these attributes are available. [PR#2203](https://github.com/newrelic/newrelic-ruby-agent/pull/2203)
30
+
31
+ - **Feature: Declare a gem dependency on the Ruby Base 64 gem 'base64'**
32
+
33
+ For compatibility with Ruby 3.4 and to silence compatibility warnings present in Ruby 3.3, declare a dependency on the `base64` gem. The New Relic Ruby agent uses the native Ruby `base64` gem for Base 64 encoding/decoding. The agent is joined by Ruby on Rails ([rails/rails@3e52adf](https://github.com/rails/rails/commit/3e52adf28e90af490f7e3bdc4bcc85618a4e0867)) and others in making this change in preparation for Ruby 3.3/3.4. [PR#2238](https://github.com/newrelic/newrelic-ruby-agent/pull/2238)
34
+
35
+ - **Feature: Add Roda support for the newrelic_ignore\* family of methods**
36
+
37
+ The agent can now selectively disable instrumentation for particular requests within Roda applications. Supported methods include:
38
+ - `newrelic_ignore`: ignore a given route.
39
+ - `newrelic_ignore_apdex`: exclude a given route from consideration in overall Apdex calculations.
40
+ - `newrelic_ignore_enduser`: prevent automatic injection of the page load timing JavaScript when a route is rendered.
41
+
42
+ For more information, see [Roda Instrumentation](https://docs.newrelic.com/docs/apm/agents/ruby-agent/instrumented-gems/roda-instrumentation/). [PR#2267](https://github.com/newrelic/newrelic-ruby-agent/pull/2267)
43
+
44
+ - **Feature: Add additional span attributes for OpenTelemetry compatibility**
45
+
46
+ For improved compatibility with OpenTelemetry's semantic conventions, the agent's datastore (for databases) and external request (for HTTP clients) segments have been updated with additional attributes.
47
+
48
+ Datastore segments now offer 3 additional attributes:
49
+ - `db.system`: The database system. For Ruby we use the database adapter name here.
50
+ - `server.address`: The database host.
51
+ - `server.port`: The database port.
52
+
53
+ External request segments now offer 3 additional attributes:
54
+ - `http.request.method`: The HTTP method (ex: 'GET')
55
+ - `server.address`: The target host.
56
+ - `server.port`: The target port.
57
+
58
+ For maximum backwards compatibility, no existing attributes have been renamed or removed. [PR#2283](https://github.com/newrelic/newrelic-ruby-agent/pull/2283)
59
+
60
+ - **Bugfix: Stop sending duplicate log events for Rails 7.1 users**
61
+
62
+ Rails 7.1 introduced the public API [`ActiveSupport::BroadcastLogger`](https://api.rubyonrails.org/classes/ActiveSupport/BroadcastLogger.html). This logger replaces a private API, `ActiveSupport::Logger.broadcast`. In Rails versions below 7.1, the agent uses the `broadcast` method to stop duplicate logs from being recoded by broadcasted loggers. Now, we've updated the code to provide a similar duplication fix for the `ActiveSupport::BroadcastLogger` class. [PR#2252](https://github.com/newrelic/newrelic-ruby-agent/pull/2252)
63
+
64
+ - **Bugfix: Resolve Sidekiq 8.0 error handler deprecation warning**
65
+
66
+ Sidekiq 8.0 will require procs passed to the error handler to include three arguments: error, context, and config. Users running sidekiq/main would receive a deprecation warning with this change any time an error was raised within a job. Thank you, [@fukayatsu](https://github.com/fukayatsu) for your proactive fix! [PR#2261](https://github.com/newrelic/newrelic-ruby-agent/pull/2261)
67
+
68
+ - **Community: Resolve technical debt**
69
+
70
+ We also received some great contributions from community members to resolve some outstanding technical debt issues. Thank you for your contributions!
71
+ * Add and Replace SLASH and ROOT constants: [PR#2256](https://github.com/newrelic/newrelic-ruby-agent/pull/2256) [chahmedejaz](https://github.com/chahmedejaz)
72
+ * Remove pry as a dev dependency: [PR#2665](https://github.com/newrelic/newrelic-ruby-agent/pull/2265), [PR#2273](https://github.com/newrelic/newrelic-ruby-agent/pull/2273) [AlajeBash](https://github.com/AlajeBash)
73
+ * Replace "start up" with "start-up": [PR#2249](https://github.com/newrelic/newrelic-ruby-agent/pull/2249) [chahmedejaz](https://github.com/chahmedejaz)
74
+ * Remove unused variables in test suites: [PR#2250](https://github.com/newrelic/newrelic-ruby-agent/pull/2250)
75
+
76
+
3
77
  ## v9.5.0
4
78
 
5
79
  Version 9.5.0 introduces Stripe instrumentation, allows the agent to record additional response information on a transaction when middleware instrumentation is disabled, introduces new `:'sidekiq.args.include'` and `:'sidekiq.args.exclude:` configuration options to permit capturing only certain Sidekiq job arguments, updates Elasticsearch datastore instance metrics, and fixes a bug in `NewRelic::Rack::AgentHooks.needed?`.
@@ -435,7 +509,7 @@ Version 8.15.0 of the agent confirms compatibility with Ruby 3.2.0, adds instrum
435
509
 
436
510
  | Configuration name | Default | Behavior |
437
511
  | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
438
- | `instrumentation.concurrent_ruby` | auto | Controls auto-instrumentation of the concurrent-ruby library at start up. May be one of `auto`, `prepend`, `chain`, `disabled`. |
512
+ | `instrumentation.concurrent_ruby` | auto | Controls auto-instrumentation of the concurrent-ruby library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`. |
439
513
 
440
514
  - **Infinite Tracing: Use batching and compression**
441
515
 
@@ -534,7 +608,7 @@ Version 8.12.0 of the agent delivers new Elasticsearch instrumentation, increase
534
608
 
535
609
  | Configuration name | Default | Behavior |
536
610
  | --------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
537
- | `instrumentation.elasticsearch` | auto | Controls auto-instrumentation of the elasticsearch library at start up. May be one of `auto`, `prepend`, `chain`, `disabled`. |
611
+ | `instrumentation.elasticsearch` | auto | Controls auto-instrumentation of the elasticsearch library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`. |
538
612
  | `elasticsearch.capture_queries` | true | If `true`, the agent captures Elasticsearch queries in transaction traces. |
539
613
  | `elasticsearch.obfuscate_queries` | true | If `true`, the agent obfuscates Elasticsearch queries in transaction traces. |
540
614
 
@@ -1149,7 +1223,7 @@ The multiverse collection of test suites requires a variety of data handling sof
1149
1223
  - **Bugfix: Prevent browser monitoring middleware from installing to middleware multiple times**
1150
1224
 
1151
1225
  In rare cases on jRuby, the BrowserMonitoring middleware could attempt to install itself
1152
- multiple times at start up. This bug fix addresses that by using a mutex to introduce
1226
+ multiple times at start-up. This bug fix addresses that by using a mutex to introduce
1153
1227
  thread safety to the operation. Sintra in particular can have this race condition because
1154
1228
  its middleware stack is not installed until the first request is received.
1155
1229
 
@@ -1160,7 +1234,7 @@ The multiverse collection of test suites requires a variety of data handling sof
1160
1234
  - **Bugfix: nil Middlewares injection now prevented and gracefully handled in Sinatra**
1161
1235
 
1162
1236
  Previously, the agent could potentially inject multiples of an instrumented middleware if Sinatra received many
1163
- requests at once during start up and initialization due to Sinatra's ability to delay full start up as long as possible.
1237
+ requests at once during start-up and initialization due to Sinatra's ability to delay full start-up as long as possible.
1164
1238
  This has now been fixed and the Ruby agent correctly instruments only once as well as gracefully handles nil middleware
1165
1239
  classes in general.
1166
1240
 
@@ -3377,7 +3451,7 @@ For more details on our Resque support, see https://docs.newrelic.com/docs/agent
3377
3451
  - Support agent when starting Resque Pool from Rake task
3378
3452
 
3379
3453
  When running resque-pool with its provided rake tasks, the agent would not
3380
- start up properly. Thanks Tiago Sousa for the fix!
3454
+ start-up properly. Thanks Tiago Sousa for the fix!
3381
3455
 
3382
3456
  - Fix for DelayedJob + Rails 4.x queue depth metrics
3383
3457
 
@@ -5321,7 +5395,7 @@ Agent improvements to support future RPM enhancements
5321
5395
  - fix incompatibility in the developer mode with the safe_erb plugin
5322
5396
  - fix module namespace issue causing an error accessing
5323
5397
  NewRelic::Instrumentation modules
5324
- - fix issue where the agent sometimes failed to start up if there was a
5398
+ - fix issue where the agent sometimes failed to start-up if there was a
5325
5399
  transient network problem
5326
5400
  - fix IgnoreSilentlyException message
5327
5401
 
data/Rakefile CHANGED
@@ -131,7 +131,7 @@ end
131
131
 
132
132
  desc 'Start an interactive console session'
133
133
  task :console do
134
- require 'pry'
134
+ require 'pry' if ENV['ENABLE_PRY']
135
135
  require 'newrelic_rpm'
136
136
  ARGV.clear
137
137
  Pry.start
@@ -1014,7 +1014,20 @@ module NewRelic
1014
1014
  },
1015
1015
  # Autostart
1016
1016
  :'autostart.denylisted_constants' => {
1017
- :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(','),
1018
1031
  :public => true,
1019
1032
  :type => String,
1020
1033
  :allowed_from_server => false,
@@ -1348,6 +1361,15 @@ module NewRelic
1348
1361
  :description => 'Configures the TCP/IP port for the trace observer Host'
1349
1362
  },
1350
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
+ },
1351
1373
  :'instrumentation.active_support_logger' => {
1352
1374
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
1353
1375
  :documentation_default => 'auto',
@@ -1355,7 +1377,15 @@ module NewRelic
1355
1377
  :public => true,
1356
1378
  :type => String,
1357
1379
  :allowed_from_server => false,
1358
- :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`.'
1359
1389
  },
1360
1390
  :'instrumentation.bunny' => {
1361
1391
  :default => 'auto',
@@ -1363,7 +1393,7 @@ module NewRelic
1363
1393
  :type => String,
1364
1394
  :dynamic_name => true,
1365
1395
  :allowed_from_server => false,
1366
- :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`.'
1367
1397
  },
1368
1398
  :'instrumentation.fiber' => {
1369
1399
  :default => 'auto',
@@ -1371,7 +1401,7 @@ module NewRelic
1371
1401
  :type => String,
1372
1402
  :dynamic_name => true,
1373
1403
  :allowed_from_server => false,
1374
- :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`.'
1375
1405
  },
1376
1406
  :'instrumentation.concurrent_ruby' => {
1377
1407
  :default => 'auto',
@@ -1379,7 +1409,7 @@ module NewRelic
1379
1409
  :type => String,
1380
1410
  :dynamic_name => true,
1381
1411
  :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`.'
1412
+ :description => 'Controls auto-instrumentation of the concurrent-ruby library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1383
1413
  },
1384
1414
  :'instrumentation.curb' => {
1385
1415
  :default => 'auto',
@@ -1388,7 +1418,7 @@ module NewRelic
1388
1418
  :type => String,
1389
1419
  :dynamic_name => true,
1390
1420
  :allowed_from_server => false,
1391
- :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`.'
1392
1422
  },
1393
1423
  :'instrumentation.delayed_job' => {
1394
1424
  :default => 'auto',
@@ -1397,7 +1427,7 @@ module NewRelic
1397
1427
  :type => String,
1398
1428
  :dynamic_name => true,
1399
1429
  :allowed_from_server => false,
1400
- :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`.'
1401
1431
  },
1402
1432
  :'instrumentation.elasticsearch' => {
1403
1433
  :default => 'auto',
@@ -1405,7 +1435,15 @@ module NewRelic
1405
1435
  :type => String,
1406
1436
  :dynamic_name => true,
1407
1437
  :allowed_from_server => false,
1408
- :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]'
1409
1447
  },
1410
1448
  :'instrumentation.excon' => {
1411
1449
  :default => 'enabled',
@@ -1414,7 +1452,7 @@ module NewRelic
1414
1452
  :type => String,
1415
1453
  :dynamic_name => true,
1416
1454
  :allowed_from_server => false,
1417
- :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`.'
1418
1456
  },
1419
1457
  :'instrumentation.grape' => {
1420
1458
  :default => 'auto',
@@ -1422,7 +1460,7 @@ module NewRelic
1422
1460
  :type => String,
1423
1461
  :dynamic_name => true,
1424
1462
  :allowed_from_server => false,
1425
- :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`.'
1426
1464
  },
1427
1465
  :'instrumentation.grpc_client' => {
1428
1466
  :default => 'auto',
@@ -1431,7 +1469,7 @@ module NewRelic
1431
1469
  :type => String,
1432
1470
  :dynamic_name => true,
1433
1471
  :allowed_from_server => false,
1434
- :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`.'
1435
1473
  },
1436
1474
  :'instrumentation.grpc.host_denylist' => {
1437
1475
  :default => [],
@@ -1448,7 +1486,7 @@ module NewRelic
1448
1486
  :type => String,
1449
1487
  :dynamic_name => true,
1450
1488
  :allowed_from_server => false,
1451
- :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`.'
1452
1490
  },
1453
1491
  :'instrumentation.httpclient' => {
1454
1492
  :default => 'auto',
@@ -1457,7 +1495,7 @@ module NewRelic
1457
1495
  :type => String,
1458
1496
  :dynamic_name => true,
1459
1497
  :allowed_from_server => false,
1460
- :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`.'
1461
1499
  },
1462
1500
  :'instrumentation.httprb' => {
1463
1501
  :default => 'auto',
@@ -1466,7 +1504,16 @@ module NewRelic
1466
1504
  :type => String,
1467
1505
  :dynamic_name => true,
1468
1506
  :allowed_from_server => false,
1469
- :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]'
1470
1517
  },
1471
1518
  :'instrumentation.logger' => {
1472
1519
  :default => instrumentation_value_from_boolean(:'application_logging.enabled'),
@@ -1475,7 +1522,7 @@ module NewRelic
1475
1522
  :type => String,
1476
1523
  :dynamic_name => true,
1477
1524
  :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`.'
1525
+ :description => 'Controls auto-instrumentation of Ruby standard library Logger at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1479
1526
  },
1480
1527
  :'instrumentation.memcache' => {
1481
1528
  :default => 'auto',
@@ -1483,7 +1530,7 @@ module NewRelic
1483
1530
  :type => String,
1484
1531
  :dynamic_name => true,
1485
1532
  :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`.'
1533
+ :description => 'Controls auto-instrumentation of dalli gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1487
1534
  },
1488
1535
  :'instrumentation.memcached' => {
1489
1536
  :default => 'auto',
@@ -1492,7 +1539,7 @@ module NewRelic
1492
1539
  :type => String,
1493
1540
  :dynamic_name => true,
1494
1541
  :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`.'
1542
+ :description => 'Controls auto-instrumentation of memcached gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1496
1543
  },
1497
1544
  :'instrumentation.memcache_client' => {
1498
1545
  :default => 'auto',
@@ -1501,7 +1548,7 @@ module NewRelic
1501
1548
  :type => String,
1502
1549
  :dynamic_name => true,
1503
1550
  :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`.'
1551
+ :description => 'Controls auto-instrumentation of memcache-client gem for Memcache at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1505
1552
  },
1506
1553
  :'instrumentation.mongo' => {
1507
1554
  :default => 'enabled',
@@ -1510,7 +1557,7 @@ module NewRelic
1510
1557
  :type => String,
1511
1558
  :dynamic_name => true,
1512
1559
  :allowed_from_server => false,
1513
- :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`.'
1514
1561
  },
1515
1562
  :'instrumentation.net_http' => {
1516
1563
  :default => 'auto',
@@ -1519,7 +1566,7 @@ module NewRelic
1519
1566
  :type => String,
1520
1567
  :dynamic_name => true,
1521
1568
  :allowed_from_server => false,
1522
- :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`.'
1523
1570
  },
1524
1571
  :'instrumentation.puma_rack' => {
1525
1572
  :default => value_of(:'instrumentation.rack'),
@@ -1539,7 +1586,7 @@ module NewRelic
1539
1586
  :type => String,
1540
1587
  :dynamic_name => true,
1541
1588
  :allowed_from_server => false,
1542
- :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`.'
1543
1590
  },
1544
1591
  :'instrumentation.rack' => {
1545
1592
  :default => 'auto',
@@ -1559,7 +1606,7 @@ module NewRelic
1559
1606
  :type => String,
1560
1607
  :dynamic_name => true,
1561
1608
  :allowed_from_server => false,
1562
- :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`.'
1563
1610
  },
1564
1611
  :'instrumentation.rake' => {
1565
1612
  :default => 'auto',
@@ -1567,7 +1614,7 @@ module NewRelic
1567
1614
  :type => String,
1568
1615
  :dynamic_name => true,
1569
1616
  :allowed_from_server => false,
1570
- :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`.'
1571
1618
  },
1572
1619
  :'instrumentation.redis' => {
1573
1620
  :default => 'auto',
@@ -1575,7 +1622,7 @@ module NewRelic
1575
1622
  :type => String,
1576
1623
  :dynamic_name => true,
1577
1624
  :allowed_from_server => false,
1578
- :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`.'
1579
1626
  },
1580
1627
  :'instrumentation.resque' => {
1581
1628
  :default => 'auto',
@@ -1584,7 +1631,7 @@ module NewRelic
1584
1631
  :type => String,
1585
1632
  :dynamic_name => true,
1586
1633
  :allowed_from_server => false,
1587
- :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`.'
1588
1635
  },
1589
1636
  :'instrumentation.roda' => {
1590
1637
  :default => 'auto',
@@ -1592,7 +1639,7 @@ module NewRelic
1592
1639
  :type => String,
1593
1640
  :dynamic_name => true,
1594
1641
  :allowed_from_server => false,
1595
- :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`.'
1596
1643
  },
1597
1644
  :'instrumentation.sinatra' => {
1598
1645
  :default => 'auto',
@@ -1600,7 +1647,7 @@ module NewRelic
1600
1647
  :type => String,
1601
1648
  :dynamic_name => true,
1602
1649
  :allowed_from_server => false,
1603
- :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`.'
1604
1651
  },
1605
1652
  :'instrumentation.stripe' => {
1606
1653
  :default => 'enabled',
@@ -1633,7 +1680,7 @@ module NewRelic
1633
1680
  An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
1634
1681
  not be reported to New Relic. Each string in this array will be turned into a regular expression via
1635
1682
  `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
1683
+ pair will not be reported. By default, no `user_data` is reported, so this option should only be used if
1637
1684
  the `stripe.user_data.include` option is being used.
1638
1685
  DESCRIPTION
1639
1686
  },
@@ -1643,14 +1690,14 @@ module NewRelic
1643
1690
  :type => String,
1644
1691
  :dynamic_name => true,
1645
1692
  :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`.'
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`.'
1647
1694
  },
1648
1695
  :'instrumentation.thread.tracing' => {
1649
1696
  :default => true,
1650
1697
  :public => true,
1651
1698
  :type => Boolean,
1652
1699
  :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.'
1700
+ :description => 'Controls auto-instrumentation of the Thread class at start-up to automatically add tracing to all Threads created in the application.'
1654
1701
  },
1655
1702
  :'thread_ids_enabled' => {
1656
1703
  :default => false,
@@ -1665,7 +1712,7 @@ module NewRelic
1665
1712
  :type => String,
1666
1713
  :dynamic_name => true,
1667
1714
  :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`.'
1715
+ :description => 'Controls auto-instrumentation of the Tilt template rendering library at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
1669
1716
  },
1670
1717
  :'instrumentation.typhoeus' => {
1671
1718
  :default => 'auto',
@@ -1674,7 +1721,7 @@ module NewRelic
1674
1721
  :type => String,
1675
1722
  :dynamic_name => true,
1676
1723
  :allowed_from_server => false,
1677
- :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`.'
1678
1725
  },
1679
1726
  # Message tracer
1680
1727
  :'message_tracer.segment_parameters.enabled' => {
@@ -2307,7 +2354,7 @@ module NewRelic
2307
2354
  :public => false,
2308
2355
  :type => Boolean,
2309
2356
  :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.'
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.'
2311
2358
  },
2312
2359
  :'thread_profiler.max_profile_overhead' => {
2313
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