newrelic_rpm 9.3.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.build_ignore +6 -1
  3. data/CHANGELOG.md +193 -6
  4. data/README.md +4 -0
  5. data/Rakefile +1 -1
  6. data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
  7. data/lib/new_relic/agent/configuration/default_source.rb +177 -34
  8. data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
  9. data/lib/new_relic/agent/distributed_tracing.rb +1 -1
  10. data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +83 -0
  11. data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +111 -0
  12. data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +93 -0
  13. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +1 -1
  14. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +1 -2
  15. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
  16. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
  17. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
  18. data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
  19. data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +4 -0
  20. data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
  21. data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
  22. data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
  23. data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
  24. data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
  25. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +9 -0
  26. data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +2 -2
  27. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -2
  28. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +4 -0
  29. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +3 -0
  30. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +4 -1
  31. data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
  32. data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
  33. data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
  34. data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
  35. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -0
  36. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -0
  37. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +4 -0
  38. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +4 -0
  39. data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
  40. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  41. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +4 -0
  42. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
  43. data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
  44. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
  45. data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
  46. data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
  47. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
  48. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +9 -0
  49. data/lib/new_relic/agent/instrumentation/memcache.rb +2 -2
  50. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -3
  51. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -1
  52. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +4 -0
  53. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +4 -0
  54. data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
  55. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +6 -0
  56. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +4 -0
  57. data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -0
  58. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +4 -0
  59. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +4 -0
  60. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
  61. data/lib/new_relic/agent/instrumentation/roda/chain.rb +43 -0
  62. data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
  63. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +68 -0
  64. data/lib/new_relic/agent/instrumentation/roda/prepend.rb +24 -0
  65. data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +29 -0
  66. data/lib/new_relic/agent/instrumentation/roda.rb +36 -0
  67. data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
  68. data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +4 -0
  69. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
  70. data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -3
  71. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -0
  72. data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -3
  73. data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
  74. data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +77 -0
  75. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +4 -0
  76. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -1
  77. data/lib/new_relic/agent/log_event_attributes.rb +1 -1
  78. data/lib/new_relic/agent/messaging.rb +2 -2
  79. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
  80. data/lib/new_relic/agent/new_relic_service.rb +33 -17
  81. data/lib/new_relic/agent/pipe_service.rb +1 -1
  82. data/lib/new_relic/agent/rules_engine.rb +1 -1
  83. data/lib/new_relic/agent/span_event_primitive.rb +16 -4
  84. data/lib/new_relic/agent/system_info.rb +26 -0
  85. data/lib/new_relic/agent/tracer.rb +5 -6
  86. data/lib/new_relic/agent/transaction/abstract_segment.rb +55 -0
  87. data/lib/new_relic/agent/transaction/external_request_segment.rb +5 -2
  88. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -2
  89. data/lib/new_relic/agent/transaction/request_attributes.rb +46 -10
  90. data/lib/new_relic/agent/transaction.rb +30 -6
  91. data/lib/new_relic/agent/transaction_error_primitive.rb +16 -0
  92. data/lib/new_relic/agent/transaction_event_primitive.rb +19 -0
  93. data/lib/new_relic/agent/utilization/gcp.rb +1 -3
  94. data/lib/new_relic/agent/utilization/vendor.rb +5 -7
  95. data/lib/new_relic/agent.rb +19 -3
  96. data/lib/new_relic/cli/command.rb +1 -0
  97. data/lib/new_relic/constants.rb +3 -0
  98. data/lib/new_relic/control/class_methods.rb +1 -7
  99. data/lib/new_relic/control/frameworks/rails.rb +14 -2
  100. data/lib/new_relic/control/frameworks/roda.rb +20 -0
  101. data/lib/new_relic/language_support.rb +9 -0
  102. data/lib/new_relic/noticed_error.rb +5 -2
  103. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  104. data/lib/new_relic/rack/agent_middleware.rb +0 -16
  105. data/lib/new_relic/rack/browser_monitoring.rb +1 -1
  106. data/lib/new_relic/supportability_helper.rb +1 -0
  107. data/lib/new_relic/version.rb +1 -1
  108. data/lib/tasks/bump_version.rake +1 -1
  109. data/lib/tasks/config.rake +3 -2
  110. data/lib/tasks/helpers/config.html.erb +93 -0
  111. data/lib/tasks/helpers/format.rb +11 -7
  112. data/lib/tasks/helpers/version_bump.rb +2 -2
  113. data/lib/tasks/instrumentation_generator/instrumentation.thor +3 -3
  114. data/lib/tasks/newrelicyml.rake +1 -1
  115. data/lib/tasks/tests.rake +71 -0
  116. data/newrelic.yml +103 -31
  117. data/newrelic_rpm.gemspec +12 -6
  118. data/test/agent_helper.rb +1027 -0
  119. metadata +63 -8
  120. data/lib/tasks/helpers/removers.rb +0 -33
  121. data/lib/tasks/multiverse.rake +0 -6
  122. data/lib/tasks/multiverse.rb +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4538568787069b9254f2ae6e51761daba690c0936a62bd725503df73a807c225
4
- data.tar.gz: c413c62d9b122964b48631be9a5cf240200dad7ee44a84b1d92a76f0f0bf52e3
3
+ metadata.gz: e08eba5efd3af57153446155d8c29ea47a55641bbf8c593105be4242325b1613
4
+ data.tar.gz: 571ec550538228168b2cafdf64f3cb55360aaac3ab33938d1200bf63ee840506
5
5
  SHA512:
6
- metadata.gz: 351addff95df2919f155541fcb1b74a17d98f04c1ac1527383c969e38c50480a169e41ddaf725a31624f38517e7cdf1e2d172f10da6ca3ace290a757810df34d
7
- data.tar.gz: 9e1da523b1fc5aad52e1ceda6f5afd780fcf104bf5a06db370ba21364fa10d115371e876a994fd7c445ca5ccb5c56447b84a39ba472991afc9bee5c083a43f47
6
+ metadata.gz: 13fae847437ac99e08ac4bc25545074e4bf300c91abdabc2d3afcb0b3e7fb87987c1c811bdb7b7eb4a4470d3d58bc11266ee75d6d21672cdab3437418d42814c
7
+ data.tar.gz: 4eb79daba4531d41b736099e904126af44421a3ca9457fed3a0b9d89ea90973674b204d1f96d2fbe28f449b452d8b12c01b73f991bf3ceb26cfafe0bf7cf794d
data/.build_ignore CHANGED
@@ -1,4 +1,4 @@
1
- .github
1
+ .github/
2
2
  .gitignore
3
3
  .project
4
4
  .rubocop.yml
@@ -19,3 +19,8 @@ lefthook.yml
19
19
  log/
20
20
  README.md
21
21
  test/
22
+ lib/tasks/bump_version.rb
23
+ lib/tasks/coverage_report.rb
24
+ lib/tasks/multiverse.rake
25
+ lib/tasks/multiverse.rb
26
+ lib/tasks/tests.rb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,192 @@
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
+
77
+ ## v9.5.0
78
+
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?`.
80
+
81
+ - **Feature: Add Stripe instrumentation**
82
+
83
+ [Stripe](https://stripe.com/) calls are now automatically instrumented. Additionally, new `:'stripe.user_data.include'` and `:'stripe.user_data.exclude'` configuration options permit capturing custom `user_data` key-value pairs that can be stored in [Stripe events](https://github.com/stripe/stripe-ruby#instrumentation). No `user_data` key-value pairs are captured by default. The agent currently supports Stripe versions 5.38.0+. [PR#2180](https://github.com/newrelic/newrelic-ruby-agent/pull/2180)
84
+
85
+ - **Feature: Report transaction HTTP status codes when middleware instrumentation is disabled**
86
+
87
+ Previously, when `disable_middleware_instrumentation` was set to `true`, the agent would not record the value of the response code or content type on the transaction. This was due to the possibility that a middleware could alter the response, which would not be captured by the agent when the middleware instrumentation was disabled. However, based on customer feedback, the agent will now report the HTTP status code and content type on a transaction when middleware instrumentation is disabled. [PR#2175](https://github.com/newrelic/newrelic-ruby-agent/pull/2175)
88
+
89
+ - **Feature: Permit capturing only certain Sidekiq job arguments**
90
+
91
+ New `:'sidekiq.args.include'` and `:'sidekiq.args.exclude'` configuration options have been introduced to permit fine grained control over which Sidekiq job arguments (args) are reported to New Relic. By default, no Sidekiq args are reported. To report any Sidekiq options, the `:'attributes.include'` array must include the string `'jobs.sidekiq.args.*'`. With that string in place, all arguments will be reported unless one or more of the new include/exclude options are used. The `:'sidekiq.args.include'` option can be set to an array of strings. Each of those strings will be passed to `Regexp.new` and collectively serve as an allowlist for desired args. For job arguments that are hashes, if a hash's key matches one of the include patterns, then both the key and its corresponding value will be included. For scalar arguments, the string representation of the scalar will need to match one of the include patterns to be captured. The `:'sidekiq.args.exclude'` option works similarly. It can be set to an array of strings that will each be passed to `Regexp.new` to create patterns. These patterns will collectively serve as a denylist for unwanted job args. Any hash key, hash value, or scalar that matches an exclude pattern will be excluded (not sent to New Relic). [PR#2177](https://github.com/newrelic/newrelic-ruby-agent/pull/2177)
92
+
93
+ `newrelic.yml` examples:
94
+
95
+ Any string in the `:'sidekiq.args.include'` or `:'sidekiq.args.exclude'` arrays will be turned into a regular expression. Knowledge of [Ruby regular expression support](https://ruby-doc.org/3.2.2/Regexp.html) can be leveraged but is not required. If regular expression syntax is not used, inexact matches will be performed and the string "Fortune" will match both "Fortune 500" and "Fortune and Glory". For exact matches, use [regular expression anchors](https://ruby-doc.org/3.2.2/Regexp.html#class-Regexp-label-Anchors).
96
+
97
+ ```yaml
98
+ # Include any argument whose string representation matches either "apple" or "banana"
99
+ # The "apple" pattern will match both "green apple" and "red apple"
100
+ sidekiq.args.include:
101
+ - apple
102
+ - banana
103
+
104
+ # Exclude any arguments that match either "grape", "orange", or "pear"
105
+ sidekiq.args.exclude:
106
+ - grape
107
+ - orange
108
+ - pear
109
+
110
+ # Exclude any argument that is a 9 digit number
111
+ sidekiq.args.exclude:
112
+ - '\d{9}'
113
+
114
+ # Include anything that starts with "blue" but exclude anything that ends in "green"
115
+ sidekiq.args.include
116
+ - '^blue'
117
+
118
+ sidekiq.args.exclude
119
+ - 'green$'
120
+ ```
121
+
122
+ - **Bugfix: Update Elasticsearch datastore instance metric to use port instead of path**
123
+
124
+ Previously, the Elasticsearch datastore instance metric (`Datastore/instance/Elasticsearch/<host>/*`) used the path as the final value. This caused a [metrics grouping issue](https://docs.newrelic.com/docs/new-relic-solutions/solve-common-issues/troubleshooting/metric-grouping-issues) for some users, as every document ID created a unique metric. Now, the datastore instance metric has been updated to use the port as the final value. This also has the benefit of being more accurate for datastore instance metrics, as this port is directly associated with the already listed host.
125
+
126
+ - **Bugfix: Resolve inverted logic of NewRelic::Rack::AgentHooks.needed?**
127
+
128
+ Previously, `NewRelic::Rack::AgentHooks.needed?` incorrectly used inverted logic. This has now been resolved, allowing AgentHooks to be installed when `disable_middleware_instrumentation` is set to true. [PR#2175](https://github.com/newrelic/newrelic-ruby-agent/pull/2175)
129
+
130
+
131
+ ## v9.4.2
132
+
133
+ Version 9.4.2 of the agent re-addresses the 9.4.0 issue of `NoMethodError` seen when using the `uppy-s3_multipart` gem.
134
+
135
+ - **Bugfix: Resolve NoMethodError**
136
+
137
+ Ruby agent 9.4.1 attempted to fix a `NoMethodError` introduced in 9.4.0. A missing `require` prevented a method from scoping appropriately and has now been added. Thanks to [@spickermann](https://github.com/spickermann) and [@ColinOrr](https://github.com/ColinOrr) for working with us to get this resolved. [PR#2167](https://github.com/newrelic/newrelic-ruby-agent/pull/2167)
138
+
139
+ ## v9.4.1
140
+
141
+ Version 9.4.1 of the agent resolves a `NoMethodError` introduced in 9.4.0.
142
+
143
+ - **Bugfix: Resolve NoMethodError**
144
+
145
+ Ruby agent 9.4.0 introduced [Roda instrumentation](https://github.com/newrelic/newrelic-ruby-agent/pull/2144), which caused a `NoMethodError` to be raised when attempting to name a Roda transaction. This has been fixed. Thanks to [@spickermann](https://github.com/spickermann) for reporting this issue. [PR#2167](https://github.com/newrelic/newrelic-ruby-agent/pull/2167)
146
+
147
+ ## v9.4.0
148
+
149
+ Version 9.4.0 of the agent adds [Roda](https://roda.jeremyevans.net/) instrumentation, adds a new `allow_all_headers` configuration option to permit capturing all HTTP headers, introduces improved error tracking functionality by associating a transaction id with each error, and uses more reliable network timeout logic.
150
+
151
+ - **Feature: Add Roda instrumentation**
152
+
153
+ [Roda](https://roda.jeremyevans.net/) is a now an instrumented framework. The agent currently supports Roda versions 3.19.0+. [PR#2144](https://github.com/newrelic/newrelic-ruby-agent/pull/2144)
154
+
155
+ - **Feature: New allow_all_headers configuration option**
156
+
157
+ A new `allow_all_headers` configuration option brings parity with the [Node.js agent](https://docs.newrelic.com/docs/release-notes/agent-release-notes/nodejs-release-notes/node-agent-270/) to capture all HTTP request headers.
158
+
159
+ This configuration option:
160
+ * Defaults to `false`
161
+ * Is not compatible with high security mode
162
+ * Requires Rack version 2 or higher (as does Ruby on Rails version 5 and above)
163
+ * Respects all existing behavior for the `attributes.include` and `attributes.exclude` [configuration options](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#attributes)
164
+ * Captures the additional headers as attributes prefixed with `request.headers.`
165
+
166
+ This work was done in response to a feature request submitted by community member [@jamesarosen](https://github.com/jamesarosen). Thank you very much, @jamesarosen! [Issue#1029](https://github.com/newrelic/newrelic-ruby-agent/issues/1029)
167
+
168
+ - **Feature: Improved error tracking transaction linking**
169
+
170
+ Errors tracked and sent to the New Relic errors inbox will now be associated with a transaction id to enable improved UI/UX associations between transactions and errors. [PR#2035](https://github.com/newrelic/newrelic-ruby-agent/pull/2035)
171
+
172
+ - **Feature: Use Net::HTTP native timeout logic**
173
+
174
+ In line with current Ruby best practices, make use of Net::HTTP's own timeout logic and avoid the use of `Timeout.timeout()` when possible. The agent's data transmissions and cloud provider detection routines have been updated accordingly. [PR#2147](https://github.com/newrelic/newrelic-ruby-agent/pull/2147)
175
+
176
+ ## v9.3.1
177
+
178
+ Version 9.3.1 of the agent fixes `NewRelic::Agent.require_test_helper`.
179
+
180
+ - **Bugfix: Fix NewRelic::Agent.require_test_helper**
181
+
182
+ Version 9.3.0 of the agent made a change to the files distributed with the gem. This change unintentionally broke the `NewRelic::Agent.require_test_helper` API by removing the `test/agent_helper.rb` file. The file has been added back to the gem. This change also removes the `lib/new_relic/build.rb` file from the list because it is no longer created with our current release process.
183
+
184
+ Our thanks go to [@ajesler](https://github.com/ajesler) for reporting this issue and writing a test for the bug. [Issue#2113](https://github.com/newrelic/newrelic-ruby-agent/issues/2113), [PR#2115](https://github.com/newrelic/newrelic-ruby-agent/pull/2115), [Issue#2117](https://github.com/newrelic/newrelic-ruby-agent/issues/2117), [PR#2118](https://github.com/newrelic/newrelic-ruby-agent/pull/2118)
185
+
186
+ - **Source Documentation: update the Rack spec URL**
187
+
188
+ Community member [@olleolleolle](https://github.com/olleolleolle) noticed that our source code was referencing a now defunct URL for the Rack specification and submitted [PR#2121](https://github.com/newrelic/newrelic-ruby-agent/pull/2121) to update it. He also provided a terrific recommendation that we automate the checking of links to proactively catch defunct ones in future. Thanks, @olleolleolle!
189
+
3
190
  ## v9.3.0
4
191
 
5
192
  Version 9.3.0 of the agent adds log-level filtering, adds custom attributes for log events, and updates instrumentation for Action Cable. It also provides fixes for how `Fiber` args are treated, Code-Level Metrics, unnecessary files being included in the gem, and `NewRelic::Agent::Logging::DecoratingFormatter#clear_tags!` being incorrectly private.
@@ -322,7 +509,7 @@ Version 8.15.0 of the agent confirms compatibility with Ruby 3.2.0, adds instrum
322
509
 
323
510
  | Configuration name | Default | Behavior |
324
511
  | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
325
- | `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`. |
326
513
 
327
514
  - **Infinite Tracing: Use batching and compression**
328
515
 
@@ -421,7 +608,7 @@ Version 8.12.0 of the agent delivers new Elasticsearch instrumentation, increase
421
608
 
422
609
  | Configuration name | Default | Behavior |
423
610
  | --------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
424
- | `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`. |
425
612
  | `elasticsearch.capture_queries` | true | If `true`, the agent captures Elasticsearch queries in transaction traces. |
426
613
  | `elasticsearch.obfuscate_queries` | true | If `true`, the agent obfuscates Elasticsearch queries in transaction traces. |
427
614
 
@@ -1036,7 +1223,7 @@ The multiverse collection of test suites requires a variety of data handling sof
1036
1223
  - **Bugfix: Prevent browser monitoring middleware from installing to middleware multiple times**
1037
1224
 
1038
1225
  In rare cases on jRuby, the BrowserMonitoring middleware could attempt to install itself
1039
- 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
1040
1227
  thread safety to the operation. Sintra in particular can have this race condition because
1041
1228
  its middleware stack is not installed until the first request is received.
1042
1229
 
@@ -1047,7 +1234,7 @@ The multiverse collection of test suites requires a variety of data handling sof
1047
1234
  - **Bugfix: nil Middlewares injection now prevented and gracefully handled in Sinatra**
1048
1235
 
1049
1236
  Previously, the agent could potentially inject multiples of an instrumented middleware if Sinatra received many
1050
- 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.
1051
1238
  This has now been fixed and the Ruby agent correctly instruments only once as well as gracefully handles nil middleware
1052
1239
  classes in general.
1053
1240
 
@@ -3264,7 +3451,7 @@ For more details on our Resque support, see https://docs.newrelic.com/docs/agent
3264
3451
  - Support agent when starting Resque Pool from Rake task
3265
3452
 
3266
3453
  When running resque-pool with its provided rake tasks, the agent would not
3267
- start up properly. Thanks Tiago Sousa for the fix!
3454
+ start-up properly. Thanks Tiago Sousa for the fix!
3268
3455
 
3269
3456
  - Fix for DelayedJob + Rails 4.x queue depth metrics
3270
3457
 
@@ -5208,7 +5395,7 @@ Agent improvements to support future RPM enhancements
5208
5395
  - fix incompatibility in the developer mode with the safe_erb plugin
5209
5396
  - fix module namespace issue causing an error accessing
5210
5397
  NewRelic::Instrumentation modules
5211
- - 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
5212
5399
  transient network problem
5213
5400
  - fix IgnoreSilentlyException message
5214
5401
 
data/README.md CHANGED
@@ -134,6 +134,10 @@ The New Relic Ruby agent may use source code from third-party libraries. When us
134
134
 
135
135
  ## Thank You
136
136
 
137
+ We always look forward to connecting with the community. We welcome [contributions](https://github.com/newrelic/newrelic-ruby-agent#contributing) to our source code and suggestions for improvements, and would love to hear about what you like and want to see in the future.
138
+
139
+ Visit our [project board](https://github.com/orgs/newrelic/projects/84/) to see what's upcoming in a future release, what we're currently working on, and what we're planning next.
140
+
137
141
  Thank you,
138
142
 
139
143
  New Relic Ruby agent team
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
@@ -0,0 +1,109 @@
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
+ module NewRelic
6
+ module Agent
7
+ module AttributePreFiltering
8
+ module_function
9
+
10
+ PRE_FILTER_KEYS = %i[include exclude].freeze
11
+ DISCARDED = :nr_discarded
12
+
13
+ def formulate_regexp_union(option)
14
+ return if NewRelic::Agent.config[option].empty?
15
+
16
+ Regexp.union(NewRelic::Agent.config[option].map { |p| string_to_regexp(p) }.uniq.compact).freeze
17
+ rescue StandardError => e
18
+ NewRelic::Agent.logger.warn("Failed to formulate a Regexp union from the '#{option}' configuration option " +
19
+ "- #{e.class}: #{e.message}")
20
+ end
21
+
22
+ def string_to_regexp(str)
23
+ Regexp.new(str)
24
+ rescue StandardError => e
25
+ NewRelic::Agent.logger.warn("Failed to initialize Regexp from string '#{str}' - #{e.class}: #{e.message}")
26
+ end
27
+
28
+ # attribute filtering suppresses data that has already been flattened
29
+ # and coerced (serialized as text) via #flatten_and_coerce, and is
30
+ # restricted to basic text matching with a single optional wildcard.
31
+ # pre filtering operates on raw Ruby objects beforehand and uses full
32
+ # Ruby regex syntax
33
+ def pre_filter(values = [], options = {})
34
+ return values unless !options.empty? && PRE_FILTER_KEYS.any? { |k| options.key?(k) }
35
+
36
+ # if there's a prefix in play for (non-pre) attribute filtration and
37
+ # attribute filtration won't allow that prefix, then don't even bother
38
+ # with pre filtration that could only result in values that would be
39
+ # blocked
40
+ if options.key?(:attribute_namespace) &&
41
+ !NewRelic::Agent.instance.attribute_filter.might_allow_prefix?(options[:attribute_namespace])
42
+ return values
43
+ end
44
+
45
+ values.each_with_object([]) do |element, filtered|
46
+ object = pre_filter_object(element, options)
47
+ filtered << object unless discarded?(object)
48
+ end
49
+ end
50
+
51
+ def pre_filter_object(object, options)
52
+ if object.is_a?(Hash)
53
+ pre_filter_hash(object, options)
54
+ elsif object.is_a?(Array)
55
+ pre_filter_array(object, options)
56
+ else
57
+ pre_filter_scalar(object, options)
58
+ end
59
+ end
60
+
61
+ def pre_filter_hash(hash, options)
62
+ filtered_hash = hash.each_with_object({}) do |(key, value), filtered|
63
+ filtered_key = pre_filter_object(key, options)
64
+ next if discarded?(filtered_key)
65
+
66
+ # If the key is permitted, skip include filtration for the value
67
+ # but still apply exclude filtration
68
+ if options.key?(:exclude)
69
+ exclude_only = options.dup
70
+ exclude_only.delete(:include)
71
+ filtered_value = pre_filter_object(value, exclude_only)
72
+ next if discarded?(filtered_value)
73
+ else
74
+ filtered_value = value
75
+ end
76
+
77
+ filtered[filtered_key] = filtered_value
78
+ end
79
+
80
+ filtered_hash.empty? && !hash.empty? ? DISCARDED : filtered_hash
81
+ end
82
+
83
+ def pre_filter_array(array, options)
84
+ filtered_array = array.each_with_object([]) do |element, filtered|
85
+ filtered_element = pre_filter_object(element, options)
86
+ next if discarded?(filtered_element)
87
+
88
+ filtered.push(filtered_element)
89
+ end
90
+
91
+ filtered_array.empty? && !array.empty? ? DISCARDED : filtered_array
92
+ end
93
+
94
+ def pre_filter_scalar(scalar, options)
95
+ return DISCARDED if options.key?(:include) && !scalar.to_s.match?(options[:include])
96
+ return DISCARDED if options.key?(:exclude) && scalar.to_s.match?(options[:exclude])
97
+
98
+ scalar
99
+ end
100
+
101
+ # `nil`, empty enumerable objects, and `false` are all valid in their
102
+ # own right as application data, so pre-filtering uses a special value
103
+ # to indicate that filtered out data has been discarded
104
+ def discarded?(object)
105
+ object == DISCARDED
106
+ end
107
+ end
108
+ end
109
+ end