newrelic_rpm 9.2.2 → 9.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.build_ignore +26 -0
  3. data/CHANGELOG.md +168 -0
  4. data/README.md +8 -4
  5. data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
  6. data/lib/new_relic/agent/configuration/default_source.rb +176 -32
  7. data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
  8. data/lib/new_relic/agent/configuration/manager.rb +3 -2
  9. data/lib/new_relic/agent/configuration/yaml_source.rb +13 -0
  10. data/lib/new_relic/agent/distributed_tracing.rb +1 -1
  11. data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +1 -1
  12. data/lib/new_relic/agent/instrumentation/active_record.rb +1 -1
  13. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +2 -1
  14. data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +4 -0
  15. data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +9 -0
  16. data/lib/new_relic/agent/instrumentation/concurrent_ruby/chain.rb +1 -1
  17. data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +3 -4
  18. data/lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb +1 -1
  19. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -2
  20. data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +4 -0
  21. data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +3 -0
  22. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +4 -1
  23. data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -0
  24. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +10 -3
  25. data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +1 -2
  26. data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +10 -3
  27. data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -0
  28. data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +4 -0
  29. data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +4 -0
  30. data/lib/new_relic/agent/instrumentation/grpc_client.rb +1 -1
  31. data/lib/new_relic/agent/instrumentation/grpc_server.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +4 -0
  33. data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
  34. data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
  35. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +12 -3
  36. data/lib/new_relic/agent/instrumentation/memcache.rb +2 -2
  37. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +4 -0
  38. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +4 -0
  39. data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +4 -0
  40. data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
  41. data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +6 -0
  42. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +4 -0
  43. data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +1 -1
  44. data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +4 -0
  45. data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +4 -0
  46. data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
  47. data/lib/new_relic/agent/instrumentation/roda/chain.rb +43 -0
  48. data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +56 -0
  49. data/lib/new_relic/agent/instrumentation/roda/prepend.rb +24 -0
  50. data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +30 -0
  51. data/lib/new_relic/agent/instrumentation/roda.rb +34 -0
  52. data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
  53. data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +4 -0
  54. data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
  55. data/lib/new_relic/agent/instrumentation/sidekiq.rb +2 -2
  56. data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -0
  57. data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
  58. data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +77 -0
  59. data/lib/new_relic/agent/instrumentation/thread/chain.rb +1 -1
  60. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +0 -1
  61. data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
  62. data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +4 -0
  63. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -1
  64. data/lib/new_relic/agent/log_event_aggregator.rb +49 -2
  65. data/lib/new_relic/agent/log_event_attributes.rb +115 -0
  66. data/lib/new_relic/agent/logging.rb +4 -4
  67. data/lib/new_relic/agent/method_tracer_helpers.rb +26 -5
  68. data/lib/new_relic/agent/new_relic_service.rb +33 -17
  69. data/lib/new_relic/agent/pipe_service.rb +1 -1
  70. data/lib/new_relic/agent/tracer.rb +6 -5
  71. data/lib/new_relic/agent/transaction/abstract_segment.rb +52 -0
  72. data/lib/new_relic/agent/transaction/request_attributes.rb +45 -7
  73. data/lib/new_relic/agent/transaction.rb +5 -4
  74. data/lib/new_relic/agent/utilization/vendor.rb +5 -7
  75. data/lib/new_relic/agent.rb +50 -1
  76. data/lib/new_relic/cli/command.rb +1 -0
  77. data/lib/new_relic/control/class_methods.rb +1 -7
  78. data/lib/new_relic/control/frameworks/roda.rb +20 -0
  79. data/lib/new_relic/dependency_detection.rb +6 -0
  80. data/lib/new_relic/language_support.rb +5 -0
  81. data/lib/new_relic/latest_changes.rb +1 -1
  82. data/lib/new_relic/noticed_error.rb +5 -2
  83. data/lib/new_relic/rack/agent_hooks.rb +1 -1
  84. data/lib/new_relic/rack/agent_middleware.rb +0 -16
  85. data/lib/new_relic/rack/browser_monitoring.rb +1 -1
  86. data/lib/new_relic/supportability_helper.rb +2 -0
  87. data/lib/new_relic/traced_thread.rb +2 -3
  88. data/lib/new_relic/version.rb +2 -2
  89. data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
  90. data/lib/tasks/bump_version.rake +21 -0
  91. data/lib/tasks/config.rake +3 -2
  92. data/lib/tasks/helpers/config.html.erb +93 -0
  93. data/lib/tasks/helpers/format.rb +11 -7
  94. data/lib/tasks/helpers/newrelicyml.rb +144 -0
  95. data/lib/tasks/helpers/version_bump.rb +62 -0
  96. data/lib/tasks/newrelicyml.rake +13 -0
  97. data/newrelic.yml +362 -265
  98. data/newrelic_rpm.gemspec +11 -7
  99. metadata +36 -25
  100. data/.gitignore +0 -43
  101. data/.project +0 -23
  102. data/.rubocop.yml +0 -1845
  103. data/.rubocop_todo.yml +0 -61
  104. data/.simplecov +0 -16
  105. data/.snyk +0 -11
  106. data/.yardopts +0 -27
  107. data/Brewfile +0 -13
  108. data/DOCKER.md +0 -167
  109. data/Dockerfile +0 -10
  110. data/Guardfile +0 -27
  111. data/config/database.yml +0 -5
  112. data/config.dot +0 -278
  113. data/docker-compose.yml +0 -107
  114. data/lefthook.yml +0 -9
  115. data/lib/tasks/helpers/removers.rb +0 -33
  116. data/lib/tasks/multiverse.rake +0 -6
  117. data/lib/tasks/multiverse.rb +0 -84
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd188401ae5aad975a09ff40578156c88aac17e12320f41ce4bee8149c769aaf
4
- data.tar.gz: e32201ee58712dd1520f03ae23a46bd1c804c2991b835151a68643c00cf140e3
3
+ metadata.gz: e5e1f4605a4afe166aa2035486a2433f91f4d0432666b787e6d9c5af9e5ee717
4
+ data.tar.gz: 16e7707b8c81774ea0c2bea54825d023c2849d0a03ab553e25800c131d9c2972
5
5
  SHA512:
6
- metadata.gz: cf9190f9bece2103511dc53071120f3dc758dba82cf042c1892d3376dc73a7b66e8898908bfe8406d85ba49ad67f7c6f5b2826e8e9b2a07d29ea05f5a99b701c
7
- data.tar.gz: 5a240785708c245119750b33df64e5467e7f9b8abf9daae8b568a452da1913f40862788323232928ecc6da489fc7b998118f2397293a55e4d371e3f0a1ae0ad5
6
+ metadata.gz: 8180f7caa158ce2ea794914376f441f5f912f46fbce8caca074b8c2c9a06fb84ca5e290eab2aa63dfa68f5385e6f7f9f3ede8ee00ee97fbc30d692b93721ec8e
7
+ data.tar.gz: 21062253bf9236563dcd226ccc4e5e2f8d1fceaed24f6047fb6ed23f485f8b0e4607bbe9b7985c4a63809767c2f4b5785e4ec52c25ff6d2ac186ff7fb8a149f7
data/.build_ignore ADDED
@@ -0,0 +1,26 @@
1
+ .github/
2
+ .gitignore
3
+ .project
4
+ .rubocop.yml
5
+ .rubocop_todo.yml
6
+ .simplecov
7
+ .snyk
8
+ .yardopts
9
+ Brewfile
10
+ CONTRIBUTING.md
11
+ Dockerfile
12
+ DOCKER.md
13
+ docker-compose.yml
14
+ config/
15
+ config.dot
16
+ infinite_tracing/
17
+ Guardfile
18
+ lefthook.yml
19
+ log/
20
+ README.md
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,173 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.5.0
4
+
5
+ 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?`.
6
+
7
+ - **Feature: Add Stripe instrumentation**
8
+
9
+ [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)
10
+
11
+ - **Feature: Report transaction HTTP status codes when middleware instrumentation is disabled**
12
+
13
+ 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)
14
+
15
+ - **Feature: Permit capturing only certain Sidekiq job arguments**
16
+
17
+ 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)
18
+
19
+ `newrelic.yml` examples:
20
+
21
+ 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).
22
+
23
+ ```yaml
24
+ # Include any argument whose string representation matches either "apple" or "banana"
25
+ # The "apple" pattern will match both "green apple" and "red apple"
26
+ sidekiq.args.include:
27
+ - apple
28
+ - banana
29
+
30
+ # Exclude any arguments that match either "grape", "orange", or "pear"
31
+ sidekiq.args.exclude:
32
+ - grape
33
+ - orange
34
+ - pear
35
+
36
+ # Exclude any argument that is a 9 digit number
37
+ sidekiq.args.exclude:
38
+ - '\d{9}'
39
+
40
+ # Include anything that starts with "blue" but exclude anything that ends in "green"
41
+ sidekiq.args.include
42
+ - '^blue'
43
+
44
+ sidekiq.args.exclude
45
+ - 'green$'
46
+ ```
47
+
48
+ - **Bugfix: Update Elasticsearch datastore instance metric to use port instead of path**
49
+
50
+ 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.
51
+
52
+ - **Bugfix: Resolve inverted logic of NewRelic::Rack::AgentHooks.needed?**
53
+
54
+ 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)
55
+
56
+
57
+ ## v9.4.2
58
+
59
+ Version 9.4.2 of the agent re-addresses the 9.4.0 issue of `NoMethodError` seen when using the `uppy-s3_multipart` gem.
60
+
61
+ - **Bugfix: Resolve NoMethodError**
62
+
63
+ 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)
64
+
65
+ ## v9.4.1
66
+
67
+ Version 9.4.1 of the agent resolves a `NoMethodError` introduced in 9.4.0.
68
+
69
+ - **Bugfix: Resolve NoMethodError**
70
+
71
+ 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)
72
+
73
+ ## v9.4.0
74
+
75
+ 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.
76
+
77
+ - **Feature: Add Roda instrumentation**
78
+
79
+ [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)
80
+
81
+ - **Feature: New allow_all_headers configuration option**
82
+
83
+ 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.
84
+
85
+ This configuration option:
86
+ * Defaults to `false`
87
+ * Is not compatible with high security mode
88
+ * Requires Rack version 2 or higher (as does Ruby on Rails version 5 and above)
89
+ * 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)
90
+ * Captures the additional headers as attributes prefixed with `request.headers.`
91
+
92
+ 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)
93
+
94
+ - **Feature: Improved error tracking transaction linking**
95
+
96
+ 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)
97
+
98
+ - **Feature: Use Net::HTTP native timeout logic**
99
+
100
+ 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)
101
+
102
+ ## v9.3.1
103
+
104
+ Version 9.3.1 of the agent fixes `NewRelic::Agent.require_test_helper`.
105
+
106
+ - **Bugfix: Fix NewRelic::Agent.require_test_helper**
107
+
108
+ 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.
109
+
110
+ 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)
111
+
112
+ - **Source Documentation: update the Rack spec URL**
113
+
114
+ 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!
115
+
116
+ ## v9.3.0
117
+
118
+ 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.
119
+
120
+ - **Feature: Filter forwarded logs based on level**
121
+
122
+ Previously, all log events, regardless of their level, were forwarded to New Relic when log forwarding was enabled. Now, you may specify the lowest log level you'd like forwarded to New Relic.
123
+
124
+ | Configuration name | Default | Behavior | Valid values |
125
+ | --------------------------- | ------- | ------------------------------------------------------ | ------ |
126
+ | `application_logging.forwarding.log_level` | `debug` | Sets the minimum log level for events forwarded to New Relic | `debug`, `info`, `warn`, `error`, `fatal`, `unknown` |
127
+
128
+ This setting uses [Ruby's Logger::Severity constants integer values](https://github.com/ruby/ruby/blob/master/lib/logger/severity.rb#L6-L17) to determine precedence.
129
+
130
+ - **Feature: Custom attributes for logs**
131
+
132
+ You can now add custom attributes to log events forwarded to New Relic! You can pass these attributes using an API and/or a configuration option.
133
+
134
+ | Configuration name | Default | Behavior |
135
+ | --------------------------- | ------- | ------------------------------------------------------ |
136
+ | `application_logging.forwarding.custom_attributes` | `{}` | A hash with key/value pairs to add as custom attributes to all log events forwarded to New Relic. If sending using an environment variable, the value must be formatted like: "key1=value1,key2=value2" |
137
+
138
+
139
+ Call the API using `NewRelic::Agent.add_custom_log_attributes` and passing your attributes as a hash. For example, you could call: `NewRelic::Agent.add_custom_log_attributes(dyno: ENV['DYNO'], pod_name: ENV['POD_NAME'])`, to add the attributes `dyno` and `pod_name` to your log events.
140
+
141
+ Attributes passed to the API or the configuration will be added to all log events.
142
+
143
+ Thanks to [@rajpawar02](https://github.com/rajpawar02) for raising this issue and [@askreet](https://github.com/askreet) for helping us with the solution. [Issue#1141](https://github.com/newrelic/newrelic-ruby-agent/issues/1141), [PR#2084](https://github.com/newrelic/newrelic-ruby-agent/pull/2084), [PR#2087](https://github.com/newrelic/newrelic-ruby-agent/pull/2087)
144
+
145
+ - **Feature: Instrument transmit_subscription-related Action Cable actions**
146
+
147
+ This change subscribes the agent to the Active Support notifications for:
148
+ * `transmit_subscription_confirmation.action_cable`
149
+ * `transmit_subscription_rejection.action_cable`
150
+
151
+ - **Bugfix: Removed unwanted files from being included in file_list in gemspec**
152
+
153
+ Previously, the agent was including some files in the gem that were not needed but added to the size of the gem. These files will no longer be included. Thanks to [@manuraj17](https://github.com/manuraj17) for the contribution! [PR#2089](https://github.com/newrelic/newrelic-ruby-agent/pull/2089)
154
+
155
+ - **Bugfix: Report Code-Level Metrics for Rails controller methods**
156
+
157
+ Controllers in Rails automatically render views with names that correspond to valid routes. This means that a controller method may not have a corresponding method in the controller class. Code-Level Metrics now report on these methods and don't log false warnings. Thanks to [@jcrisp](https://github.com/jcrisp) for reporting this issue. [PR#2061](https://github.com/newrelic/newrelic-ruby-agent/pull/2061)
158
+
159
+ - **Bugfix: Code-Level Metrics for ActiveRecord models**
160
+
161
+ Classes that inherit from ActiveRecord were not reporting Code-Level Metrics due to an error in the agent when identifying the class name. This has been fixed and Code-Level Metrics will now report for ActiveRecord models. Thanks to [@abigail-rolling](https://github.com/abigail-rolling) for reporting this issue. [PR#2092](https://github.com/newrelic/newrelic-ruby-agent/pull/2092).
162
+
163
+ - **Bugfix: Private method `clear_tags!` for NewRelic::Agent::Logging::DecoratingFormatter**
164
+
165
+ As part of a refactor included in a previous release of the agent, the method `NewRelic::Agent::Logging::DecoratingFormatter#clear_tags!` was incorrectly made private. This method is now public again. Thanks to [@dark-panda](https://github.com/dark-panda) for reporting this issue. [PR#](https://github.com/newrelic/newrelic-ruby-agent/pull/2078)
166
+
167
+ - **Bugfix: Fix the way args are handled for Fibers**
168
+
169
+ Previously, the agent treated Fiber args the same as it was treating Thread args, which is not correct. Args are passed to `Fiber#resume`, and not `Fiber.new`. This has been fixed, and the agent will properly preserve args for both Fiber and Thread classes. This also caused an error to occur when using Async 2.6.2, due to mismatching initalize definitions for Fiber prepended modules. This has been fixed as well. Thanks to [@travisbell](https://github.com/travisbell) for bringing this to our attention. [PR#2083](https://github.com/newrelic/newrelic-ruby-agent/pull/2083)
170
+
3
171
  ## v9.2.2
4
172
 
5
173
  Version 9.2.2 of the agent fixes a bug with the `Transaction#finished?` method.
data/README.md CHANGED
@@ -9,7 +9,7 @@ You can also extend the agent's performance monitoring to
9
9
  to help you improve the customer experience and make data-driven business decisions.
10
10
 
11
11
  The New Relic Ruby agent is dual-purposed as either a Gem or a Rails plugin,
12
- hosted on [github](https://github.com/newrelic/newrelic-ruby-agent).
12
+ hosted on [GitHub](https://github.com/newrelic/newrelic-ruby-agent).
13
13
 
14
14
  This code is actively maintained by New Relic engineering teams and delivered here in GitHub. See below for troubleshooting and defect reporting instructions.
15
15
 
@@ -25,7 +25,7 @@ Environments" section below.
25
25
 
26
26
  ## Installing and Using
27
27
 
28
- The latest released gem for the Ruby agent can be found at [Rubygems.org](https://rubygems.org/gems/newrelic_rpm)
28
+ The latest released gem for the Ruby agent can be found at [RubyGems.org](https://rubygems.org/gems/newrelic_rpm)
29
29
 
30
30
  ### Quick Start
31
31
 
@@ -88,7 +88,7 @@ for more information.
88
88
 
89
89
  Should you need assistance with New Relic products, you are in good hands with several support diagnostic tools and support channels.
90
90
 
91
- This [troubleshooting framework](https://discuss.newrelic.com/t/ruby-troubleshooting-framework-install/108685) steps you through common troubleshooting questions.
91
+ This [troubleshooting framework](https://forum.newrelic.com/s/hubtopic/aAX8W0000008bSgWAI/ruby-troubleshooting-framework-install) steps you through common troubleshooting questions.
92
92
 
93
93
  New Relic offers NRDiag, [a client-side diagnostic utility](https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/troubleshooting/new-relic-diagnostics) that automatically detects common problems with New Relic agents. If NRDiag detects a problem, it suggests troubleshooting steps. NRDiag can also automatically attach troubleshooting data to a New Relic Support ticket.
94
94
 
@@ -97,7 +97,7 @@ If the issue has been confirmed as a bug or is a Feature request, please file a
97
97
  **Support Channels**
98
98
 
99
99
  * [New Relic Documentation](https://docs.newrelic.com/docs/agents/ruby-agent): Comprehensive guidance for using our platform
100
- * [New Relic Community](https://discuss.newrelic.com/tags/rubyagent): The best place to engage in troubleshooting questions
100
+ * [New Relic Community](https://forum.newrelic.com): The best place to engage in troubleshooting questions
101
101
  * [New Relic Developer](https://developer.newrelic.com/): Resources for building a custom observability applications
102
102
  * [New Relic University](https://learn.newrelic.com/): A range of online training for New Relic users of every level
103
103
  * [New Relic Technical Support](https://support.newrelic.com/) 24/7/365 ticketed support. Read more about our [Technical Support Offerings](https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/support-plan).
@@ -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
@@ -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