newrelic_rpm 9.17.0 → 9.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.build_ignore +1 -0
  3. data/CHANGELOG.md +57 -1
  4. data/lib/new_relic/agent/agent.rb +2 -0
  5. data/lib/new_relic/agent/agent_helpers/connect.rb +3 -3
  6. data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -3
  7. data/lib/new_relic/agent/agent_helpers/shutdown.rb +1 -1
  8. data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +1 -1
  9. data/lib/new_relic/agent/agent_helpers/startup.rb +4 -4
  10. data/lib/new_relic/agent/configuration/default_source.rb +105 -80
  11. data/lib/new_relic/agent/configuration/yaml_source.rb +2 -2
  12. data/lib/new_relic/agent/http_clients/uri_util.rb +1 -1
  13. data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +6 -2
  14. data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -0
  15. data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +3 -3
  16. data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +0 -2
  17. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delay_extensions.rb +24 -0
  18. data/lib/new_relic/agent/instrumentation/sidekiq.rb +9 -1
  19. data/lib/new_relic/agent/new_relic_service.rb +2 -2
  20. data/lib/new_relic/agent/opentelemetry/trace/span.rb +23 -0
  21. data/lib/new_relic/agent/opentelemetry/trace/tracer.rb +38 -0
  22. data/lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb +18 -0
  23. data/lib/new_relic/agent/opentelemetry/trace.rb +15 -0
  24. data/lib/new_relic/agent/opentelemetry_bridge.rb +26 -0
  25. data/lib/new_relic/agent/span_event_primitive.rb +3 -1
  26. data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -1
  27. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -6
  28. data/lib/new_relic/agent/transaction/trace_context.rb +33 -4
  29. data/lib/new_relic/agent/transaction/tracing.rb +4 -5
  30. data/lib/new_relic/agent/transaction.rb +2 -1
  31. data/lib/new_relic/agent/utilization_data.rb +15 -5
  32. data/lib/new_relic/control/instance_methods.rb +5 -0
  33. data/lib/new_relic/version.rb +1 -1
  34. data/lib/tasks/helpers/newrelicyml.rb +4 -2
  35. data/newrelic.yml +72 -35
  36. metadata +8 -15
  37. data/lib/tasks/instrumentation_generator/README.md +0 -63
  38. data/lib/tasks/instrumentation_generator/TODO.md +0 -33
  39. data/lib/tasks/instrumentation_generator/instrumentation.thor +0 -130
  40. data/lib/tasks/instrumentation_generator/templates/Envfile.tt +0 -9
  41. data/lib/tasks/instrumentation_generator/templates/chain.tt +0 -21
  42. data/lib/tasks/instrumentation_generator/templates/chain_method.tt +0 -7
  43. data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +0 -32
  44. data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +0 -13
  45. data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +0 -3
  46. data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +0 -19
  47. data/lib/tasks/instrumentation_generator/templates/prepend.tt +0 -13
  48. data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +0 -3
  49. data/lib/tasks/instrumentation_generator/templates/test.tt +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c16c3149d187e88f60c408712fa5da2209c4cac08769477b951df4dfb780e95b
4
- data.tar.gz: d6a0c36115e0b2f9db2ceeb806435737865615dc9043b669376bab20f443dce9
3
+ metadata.gz: 3a2b588c4be509b5a02bb0516a47e9329cab3bcf79c97f614d4349291db0876f
4
+ data.tar.gz: 30f1dcd2997242e38836aa3325badb71656aaa3aa074857a2edad75f6e21972b
5
5
  SHA512:
6
- metadata.gz: fc16046f04498bc268cfe08839f9a98580fede0d249c87bd9000d00a8560b0a99ffb2d504f018bc4a752a2008e1339a106a8dc38e46687ed2ddbf76aef839abf
7
- data.tar.gz: 1b704cc45064a6ccbea20474f1537379b113bdf38788d2a0f7b283e885e0d9cc54c3ea5f935a8d41a81017a416f14adec7a814351c89dbf89d6072c044fb31ff
6
+ metadata.gz: 6915cfd19ea57029473609dd02b4e9bd110aaa3766f13af648705a0132d4608f33051ad0e44f6c03f72b037eb99c64f1992c92408d1caedd3381538e906c4b0d
7
+ data.tar.gz: 87c1d548bd4a78eb26706eae9f1932c9fb394c05f16e8d4603ce8b690e4df255fdd8748f7f2b09501a7e73770961ec20f6df07435255db293bb4e7395400094c
data/.build_ignore CHANGED
@@ -21,6 +21,7 @@ README.md
21
21
  test/
22
22
  lib/tasks/bump_version.rb
23
23
  lib/tasks/coverage_report.rb
24
+ lib/tasks/instrumentation_generator/
24
25
  lib/tasks/multiverse.rake
25
26
  lib/tasks/multiverse.rb
26
27
  lib/tasks/tests.rb
data/CHANGELOG.md CHANGED
@@ -1,11 +1,67 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.19.0
4
+
5
+ - **Feature: Add Thread ID as attribute to all spans**
6
+
7
+ The agent will now record the Thread ID as an attribute on each span. [PR#3122](https://github.com/newrelic/newrelic-ruby-agent/pull/3122)
8
+
9
+ - **Feature: Add support for W3C TraceContext Trace Flag**
10
+
11
+ Previously, the agent would not use the trace flag field of the traceparent header for sampling decisions. This could lead to fragmented traces in the UI. While the default behavior remains unchanged, two new configuration options, `distributed_tracing.sampler.remote_parent_sampled` and `distributed_tracing.sampler.remote_parent_not_sampled`, have been introduced to allow more control over the way sampling decisions are made. [PR#3135](https://github.com/newrelic/newrelic-ruby-agent/pull/3135)
12
+
13
+ - **Bugfix: Include request.uri in Transaction events by default**
14
+
15
+ [The New Relic data dictionary expects Transaction events to have the `request.uri` attribute.](https://docs.newrelic.com/attribute-dictionary/?event=Transaction&attribute=request.uri) The Ruby agent now fulfills this expectation. If you would like to exclude `request.uri` from Transaction events, you can do so by setting `transaction_events.attributes.exclude` to `'request.uri'`. [PR#3103](https://github.com/newrelic/newrelic-ruby-agent/pull/3103)
16
+
17
+ - **Bugfix: Fix error in Active Job instrumentation when using perform_all_later**
18
+
19
+ Previously, when Active Job's `perform_all_later` method was called and the agent was running, a `NoMethodError` would be raised with the message `undefined method 'queue_name' for nil`. The error has been fixed and the name of the segment will reflect the first job in the queue. Our thanks goes to [@tan-linx](https://github.com/tan-linx) for bringing this to our attention and providing a fix. [PR#3110](https://github.com/newrelic/newrelic-ruby-agent/pull/3110)
20
+
21
+ ## v9.18.0
22
+
23
+ - **Feature: Add elasticsearch.capture_cluster_name configuration option**
24
+
25
+ A new configuration option, `elasticsearch.capture_cluster_name`, has been added to control capturing Elasticsearch cluster names. Cluster names are captured by default, but can now be disabled as needed. [PR#3038](https://github.com/newrelic/newrelic-ruby-agent/pull/3038)
26
+
27
+ - **Feature: Add support for sidekiq-delay_extensions**
28
+
29
+ Sidekiq delay extensions were removed from Sidekiq in 7.x and are now avaliable through the [sidekiq-delay_extensions](https://rubygems.org/gems/sidekiq-delay_extensions) gem. Thanks to [@sobrinho](https://github.com/sobrinho), the agent now has continued support for delay extensions.[PR#3056](https://github.com/newrelic/newrelic-ruby-agent/pull/3056)
30
+
31
+ - **Feature: Parallelize calls for vendor metadata**
32
+
33
+ Previously, the agent would make calls for vendor metadata in a serial fashion. This could lead to a delay in starting the agent. Now, the agent will make these calls in parallel, reducing the time it takes to start the agent. [PR#3094](https://github.com/newrelic/newrelic-ruby-agent/pull/3094)
34
+
35
+ - **Bugfix: Prevent a nil segment from causing errors in Net::HTTP instrumentation**
36
+
37
+ When using JRuby, a race condition can happen that causes the segment creation to fail and return `nil`. This would cause an error to occur when methods were later called on the `nil` segment. These methods will no longer be called if the segment is `nil`, preventing that error from occurring. [PR#3046](https://github.com/newrelic/newrelic-ruby-agent/pull/3046)
38
+
39
+ - **Bugfix: JRuby multithreading improvements**
40
+
41
+ Added some additional nil checks and mutexes to prevent issues when using the agent on JRuby with multiple threads. Thanks to @NC-piercej for bringing this to our attention [Issue#3021](https://github.com/newrelic/newrelic-ruby-agent/issues/3021) [PR#3053](https://github.com/newrelic/newrelic-ruby-agent/pull/3053)
42
+
43
+ - **Bugfix: Stop reporting rescued Sidekiq::OverLimit exceptions**
44
+
45
+ When Sidekiq's concurrent rate limiters encounter an `OverLimit` exception, Sidekiq typically handles this by re-enqueuing the job. Previously, all occurrences of `Sidekiq::OverLimit` were logged as errors in New Relic, even when Sidekiq's middleware resolved the exception. New Relic will no longer report errors that are handled by Sidekiq's own middleware. Thanks to [@97jaz](https://github.com/97jaz) for reporting this issue. [Issue#3037](https://github.com/newrelic/newrelic-ruby-agent/issues/3037) [PR#3047](https://github.com/newrelic/newrelic-ruby-agent/pull/3047)
46
+
47
+ - **Bugfix: Protect against nil agents or health checks**
48
+
49
+ In some cases the agent or health checks may be `nil` when they are called. Safe navigation operators have been added for protection on those occasions. [PR#3049](https://github.com/newrelic/newrelic-ruby-agent/pull/3049)
50
+
51
+ - **Bugfix: Ignore Solid Queue `ThreadError: queue empty` error message by default**
52
+
53
+ When using the solid_queue gem, the agent previously generated excessive warn-level logs when the queue was empty. The agent now ignores `queue empty` error messages of the `ThreadError` class by default. This behavior can be adjusted using the `error_collector.ignore_messages` configuration option. [PR#3060](https://github.com/newrelic/newrelic-ruby-agent/pull/3060)
54
+
55
+ - **Bugfix: Refactor URI host handling to accommodate downcasing frozen strings**
56
+
57
+ When URI host string was frozen, a FrozenError would be raised when the agent attempted to downcase the host as part of its data normalization process. Now, the update is friendly for frozen strings. Thank you [@pedrol3001](https://github.com/pedrol3001) for your contribution! [PR#3097](https://github.com/newrelic/newrelic-ruby-agent/pull/3097)
58
+
3
59
  ## v9.17.0
4
60
 
5
61
  - **Feature: Support Ruby 3.4.0**
6
62
 
7
63
  The agent now supports Ruby 3.4.0. We've made incremental changes throughout the preview stage to reach compatibility. This release includes an update to the Thread Profiler for compatibility with Ruby 3.4.0's new backtrace format. [Issue#2992](https://github.com/newrelic/newrelic-ruby-agent/issues/2992) [PR#2997](https://github.com/newrelic/newrelic-ruby-agent/pull/2997)
8
-
64
+
9
65
  - **Feature: Add instrumentation for aws-sdk-firehose**
10
66
 
11
67
  The agent now has instrumentation for the [aws-sdk-firehose](https://rubygems.org/gems/aws-sdk-firehose) gem. [PR#2973](https://github.com/newrelic/newrelic-ruby-agent/pull/2973)
@@ -38,6 +38,7 @@ require 'new_relic/agent/adaptive_sampler'
38
38
  require 'new_relic/agent/serverless_handler'
39
39
  require 'new_relic/agent/connect/request_builder'
40
40
  require 'new_relic/agent/connect/response_handler'
41
+ require 'new_relic/agent/opentelemetry_bridge'
41
42
 
42
43
  require 'new_relic/agent/agent_helpers/connect'
43
44
  require 'new_relic/agent/agent_helpers/harvest'
@@ -100,6 +101,7 @@ module NewRelic
100
101
  @adaptive_sampler = AdaptiveSampler.new(Agent.config[:sampling_target],
101
102
  Agent.config[:sampling_target_period_in_seconds])
102
103
  @serverless_handler = ServerlessHandler.new
104
+ @opentelemetry_bridge = OpenTelemetryBridge.new
103
105
  end
104
106
 
105
107
  def init_event_handlers
@@ -68,7 +68,7 @@ module NewRelic
68
68
  def handle_license_error(error)
69
69
  ::NewRelic::Agent.logger.error(error.message,
70
70
  'Visit newrelic.com to obtain a valid license key, or to upgrade your account.')
71
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::INVALID_LICENSE_KEY)
71
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::INVALID_LICENSE_KEY)
72
72
  disconnect
73
73
  end
74
74
 
@@ -192,7 +192,7 @@ module NewRelic
192
192
  @connected_pid = $$
193
193
  @connect_state = :connected
194
194
  signal_connected
195
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::HEALTHY)
195
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::HEALTHY)
196
196
  rescue NewRelic::Agent::ForceDisconnectException => e
197
197
  handle_force_disconnect(e)
198
198
  rescue NewRelic::Agent::LicenseException => e
@@ -200,7 +200,7 @@ module NewRelic
200
200
  rescue NewRelic::Agent::UnrecoverableAgentException => e
201
201
  handle_unrecoverable_agent_error(e)
202
202
  rescue StandardError, Timeout::Error, NewRelic::Agent::ServerConnectionException => e
203
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
203
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
204
204
  retry if retry_from_error?(e, opts)
205
205
  rescue Exception => e
206
206
  ::NewRelic::Agent.logger.error('Exception of unexpected type during Agent#connect():', e)
@@ -119,7 +119,7 @@ module NewRelic
119
119
  rescue UnrecoverableServerException => e
120
120
  NewRelic::Agent.logger.warn("#{endpoint} data was rejected by remote service, discarding. Error: ", e)
121
121
  rescue ServerConnectionException => e
122
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
122
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
123
123
  log_remote_unavailable(endpoint, e)
124
124
  container.merge!(payload)
125
125
  rescue => e
@@ -134,11 +134,11 @@ module NewRelic
134
134
  rescue ForceRestartException, ForceDisconnectException
135
135
  raise
136
136
  rescue UnrecoverableServerException => e
137
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
137
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
138
138
  NewRelic::Agent.logger.warn('get_agent_commands message was rejected by remote service, discarding. ' \
139
139
  'Error: ', e)
140
140
  rescue ServerConnectionException => e
141
- NewRelic::Agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
141
+ NewRelic::agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_CONNECT)
142
142
  log_remote_unavailable(:get_agent_commands, e)
143
143
  rescue => e
144
144
  NewRelic::Agent.logger.info('Error during check_for_and_handle_agent_commands, will retry later: ', e)
@@ -20,7 +20,7 @@ module NewRelic
20
20
 
21
21
  @started = nil
22
22
 
23
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::SHUTDOWN) if NewRelic::Agent.agent.health_check.healthy?
23
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::SHUTDOWN) if NewRelic::Agent.agent&.health_check&.healthy?
24
24
 
25
25
  Control.reset
26
26
  end
@@ -86,7 +86,7 @@ module NewRelic
86
86
  # is the worker thread that gathers data and talks to the
87
87
  # server.
88
88
  def handle_force_disconnect(error)
89
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FORCED_DISCONNECT)
89
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FORCED_DISCONNECT)
90
90
  ::NewRelic::Agent.logger.warn('Agent received a ForceDisconnectException from the server, disconnecting. ' \
91
91
  "(#{error.message})")
92
92
  disconnect
@@ -132,7 +132,7 @@ module NewRelic
132
132
  if Agent.config[:monitor_mode]
133
133
  true
134
134
  else
135
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::AGENT_DISABLED)
135
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::AGENT_DISABLED)
136
136
  ::NewRelic::Agent.logger.warn('Agent configured not to send data in this environment.')
137
137
  false
138
138
  end
@@ -144,7 +144,7 @@ module NewRelic
144
144
  if Agent.config[:license_key] && Agent.config[:license_key].length > 0
145
145
  true
146
146
  else
147
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::MISSING_LICENSE_KEY)
147
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::MISSING_LICENSE_KEY)
148
148
  ::NewRelic::Agent.logger.warn('No license key found. ' +
149
149
  'This often means your newrelic.yml file was not found, or it lacks a section for the running ' \
150
150
  "environment, '#{NewRelic::Control.instance.env}'. You may also want to try linting your newrelic.yml " \
@@ -165,7 +165,7 @@ module NewRelic
165
165
  if key.length == 40
166
166
  true
167
167
  else
168
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::INVALID_LICENSE_KEY)
168
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::INVALID_LICENSE_KEY)
169
169
  ::NewRelic::Agent.logger.error("Invalid license key: #{key}")
170
170
  false
171
171
  end
@@ -186,7 +186,7 @@ module NewRelic
186
186
  end
187
187
 
188
188
  unless app_name_configured?
189
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::MISSING_APP_NAME)
189
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::MISSING_APP_NAME)
190
190
  NewRelic::Agent.logger.error('No application name configured.',
191
191
  'The agent cannot start without at least one. Please check your ',
192
192
  'newrelic.yml and ensure that it is valid and has at least one ',
@@ -387,9 +387,9 @@ module NewRelic
387
387
  :allowed_from_server => false,
388
388
  :description => <<~DESCRIPTION
389
389
  An array of ActiveSupport custom event names to subscribe to and instrument. For example,
390
- - one.custom.event
391
- - another.event
392
- - a.third.event
390
+ - one.custom.event
391
+ - another.event
392
+ - a.third.event
393
393
  DESCRIPTION
394
394
  },
395
395
  :'ai_monitoring.enabled' => {
@@ -407,11 +407,11 @@ module NewRelic
407
407
  :description => <<~DESCRIPTION
408
408
  If `false`, LLM instrumentation (OpenAI only for now) will not capture input and output content on specific LLM events.
409
409
 
410
- The excluded attributes include:
411
- * `content` from LlmChatCompletionMessage events
412
- * `input` from LlmEmbedding events
410
+ The excluded attributes include:
411
+ - `content` from LlmChatCompletionMessage events
412
+ - `input` from LlmEmbedding events
413
413
 
414
- This is an optional security setting to prevent recording sensitive data sent to and received from your LLMs.
414
+ This is an optional security setting to prevent recording sensitive data sent to and received from your LLMs.
415
415
  DESCRIPTION
416
416
  },
417
417
  # this is only set via server side config
@@ -460,9 +460,9 @@ module NewRelic
460
460
  :description => <<~DESCRIPTION
461
461
  When `true`, the agent captures HTTP request parameters and attaches them to transaction traces, traced errors, and [`TransactionError` events](/attribute-dictionary?attribute_name=&events_tids%5B%5D=8241).
462
462
 
463
- <Callout variant="caution">
464
- When using the `capture_params` setting, the Ruby agent will not attempt to filter secret information. `Recommendation:` To filter secret information from request parameters, use the [`attributes.include` setting](/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby) instead. For more information, see the <a href="/docs/agents/ruby-agent/attributes/ruby-attribute-examples#ex_req_params">Ruby attribute examples</a>.
465
- </Callout>
463
+ <Callout variant="caution">
464
+ When using the `capture_params` setting, the Ruby agent will not attempt to filter secret information. `Recommendation:` To filter secret information from request parameters, use the [`attributes.include` setting](/docs/agents/ruby-agent/attributes/enable-disable-attributes-ruby) instead. For more information, see the <a href="/docs/agents/ruby-agent/attributes/ruby-attribute-examples#ex_req_params">Ruby attribute examples</a>.
465
+ </Callout>
466
466
  DESCRIPTION
467
467
  },
468
468
  :'clear_transaction_state_after_fork' => {
@@ -487,10 +487,10 @@ module NewRelic
487
487
  :allowed_from_server => false,
488
488
  :description => <<~DESC
489
489
  Path to `newrelic.yml`. If undefined, the agent checks the following directories (in order):
490
- * `config/newrelic.yml`
491
- * `newrelic.yml`
492
- * `$HOME/.newrelic/newrelic.yml`
493
- * `$HOME/newrelic.yml`
490
+ - `config/newrelic.yml`
491
+ - `newrelic.yml`
492
+ - `$HOME/.newrelic/newrelic.yml`
493
+ - `$HOME/newrelic.yml`
494
494
  DESC
495
495
  },
496
496
  :'exclude_newrelic_header' => {
@@ -674,13 +674,13 @@ module NewRelic
674
674
  :public => true,
675
675
  :type => String,
676
676
  :allowed_from_server => true,
677
- :description => 'Obfuscation level for SQL queries reported in transaction trace nodes.
678
-
679
- By default, this is set to `obfuscated`, which strips out the numeric and string literals.
680
-
681
- - If you do not want the agent to capture query information, set this to `none`.
682
- - If you want the agent to capture all query information in its original form, set this to `raw`.
683
- - When you enable [high security mode](/docs/agents/manage-apm-agents/configuration/high-security-mode), this is automatically set to `obfuscated`.'
677
+ :description => <<~DESC
678
+ Obfuscation level for SQL queries reported in transaction trace nodes.
679
+ By default, this is set to `obfuscated`, which strips out the numeric and string literals.
680
+ - If you do not want the agent to capture query information, set this to `none`.
681
+ - If you want the agent to capture all query information in its original form, set this to `raw`.
682
+ - When you enable [high security mode](/docs/agents/manage-apm-agents/configuration/high-security-mode), this is automatically set to `obfuscated`.
683
+ DESC
684
684
  },
685
685
 
686
686
  :'transaction_tracer.stack_trace_threshold' => {
@@ -698,20 +698,6 @@ module NewRelic
698
698
  :description => 'Specify a threshold in seconds. Transactions with a duration longer than this threshold are eligible for transaction traces. Specify a float value or the string `apdex_f`.'
699
699
  },
700
700
  # Error collector
701
- :'error_collector.ignore_classes' => {
702
- :default => ['ActionController::RoutingError', 'Sinatra::NotFound'],
703
- :public => true,
704
- :type => Array,
705
- :allowed_from_server => true,
706
- :dynamic_name => true,
707
- :description => <<~DESCRIPTION
708
- A list of error classes that the agent should ignore.
709
-
710
- <Callout variant="caution">
711
- This option can't be set via environment variable.
712
- </Callout>
713
- DESCRIPTION
714
- },
715
701
  :'error_collector.capture_events' => {
716
702
  :default => value_of(:'error_collector.enabled'),
717
703
  :documentation_default => true,
@@ -736,10 +722,9 @@ module NewRelic
736
722
  :dynamic_name => true,
737
723
  :description => <<~DESCRIPTION
738
724
  A list of error classes that the agent should treat as expected.
739
-
740
- <Callout variant="caution">
741
- This option can't be set via environment variable.
742
- </Callout>
725
+ <Callout variant="caution">
726
+ This option can't be set via environment variable.
727
+ </Callout>
743
728
  DESCRIPTION
744
729
  },
745
730
  :'error_collector.expected_messages' => {
@@ -750,10 +735,9 @@ module NewRelic
750
735
  :dynamic_name => true,
751
736
  :description => <<~DESCRIPTION
752
737
  A map of error classes to a list of messages. When an error of one of the classes specified here occurs, if its error message contains one of the strings corresponding to it here, that error will be treated as expected.
753
-
754
- <Callout variant="caution">
755
- This option can't be set via environment variable.
756
- </Callout>
738
+ <Callout variant="caution">
739
+ This option can't be set via environment variable.
740
+ </Callout>
757
741
  DESCRIPTION
758
742
  },
759
743
  :'error_collector.expected_status_codes' => {
@@ -764,19 +748,35 @@ module NewRelic
764
748
  :dynamic_name => true,
765
749
  :description => 'A comma separated list of status codes, possibly including ranges. Errors associated with these status codes, where applicable, will be treated as expected.'
766
750
  },
767
-
751
+ :'error_collector.ignore_classes' => {
752
+ :default => ['ActionController::RoutingError', 'Sinatra::NotFound'],
753
+ :public => true,
754
+ :type => Array,
755
+ :allowed_from_server => true,
756
+ :dynamic_name => true,
757
+ :description => <<~DESCRIPTION
758
+ A list of error classes that the agent should ignore.
759
+ <Callout variant="caution">
760
+ This option can't be set via environment variable.
761
+ </Callout>
762
+ DESCRIPTION
763
+ },
768
764
  :'error_collector.ignore_messages' => {
769
- :default => {},
765
+ # we have to keep the hash rocket in the actual default so the
766
+ # class name key is treated like a string rather than a symbol.
767
+ # however, this isn't valid yaml, so document something that is
768
+ # valid yaml
769
+ :default => {'ThreadError' => ['queue empty']},
770
+ :documentation_default => {'ThreadError': ['queue empty']},
770
771
  :public => true,
771
772
  :type => Hash,
772
773
  :allowed_from_server => true,
773
774
  :dynamic_name => true,
774
775
  :description => <<~DESCRIPTION
775
776
  A map of error classes to a list of messages. When an error of one of the classes specified here occurs, if its error message contains one of the strings corresponding to it here, that error will be ignored.
776
-
777
- <Callout variant="caution">
778
- This option can't be set via environment variable.
779
- </Callout>
777
+ <Callout variant="caution">
778
+ This option can't be set via environment variable.
779
+ </Callout>
780
780
  DESCRIPTION
781
781
  },
782
782
  :'error_collector.ignore_status_codes' => {
@@ -865,12 +865,12 @@ module NewRelic
865
865
  For example, setting this value to "debug" will forward all log events to New Relic. Setting this value to "error" will only forward log events with the levels "error", "fatal", and "unknown".
866
866
 
867
867
  Valid values (ordered lowest to highest):
868
- * "debug"
869
- * "info"
870
- * "warn"
871
- * "error"
872
- * "fatal"
873
- * "unknown"
868
+ - "debug"
869
+ - "info"
870
+ - "warn"
871
+ - "error"
872
+ - "fatal"
873
+ - "unknown"
874
874
  DESCRIPTION
875
875
  },
876
876
  :'application_logging.forwarding.custom_attributes' => {
@@ -1242,8 +1242,8 @@ module NewRelic
1242
1242
  :dynamic_name => true,
1243
1243
  # Keep the extra two-space indent before the second bullet to appease translation tool
1244
1244
  :description => <<~DESC
1245
- * Specify a maximum number of custom events to buffer in memory at a time.
1246
- * When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), \
1245
+ - Specify a maximum number of custom events to buffer in memory at a time.
1246
+ - When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), \
1247
1247
  set to max value `100000`. This ensures the agent captures the maximum amount of LLM events.
1248
1248
  DESC
1249
1249
  },
@@ -1385,9 +1385,9 @@ module NewRelic
1385
1385
  :description => <<~DESCRIPTION
1386
1386
  If `true`, the agent won't wrap third-party middlewares in instrumentation (regardless of whether they are installed via `Rack::Builder` or Rails).
1387
1387
 
1388
- <Callout variant="important">
1389
- When middleware instrumentation is disabled, if an application is using middleware that could alter the response code, the HTTP status code reported on the transaction may not reflect the altered value.
1390
- </Callout>
1388
+ <Callout variant="important">
1389
+ When middleware instrumentation is disabled, if an application is using middleware that could alter the response code, the HTTP status code reported on the transaction may not reflect the altered value.
1390
+ </Callout>
1391
1391
  DESCRIPTION
1392
1392
  },
1393
1393
  :disable_samplers => {
@@ -1426,20 +1426,18 @@ module NewRelic
1426
1426
  :description => <<~DESCRIPTION
1427
1427
  If `true`, disables agent middleware for Sinatra. This middleware is responsible for advanced feature support such as [cross application tracing](/docs/apm/transactions/cross-application-traces/cross-application-tracing), [page load timing](/docs/browser/new-relic-browser/getting-started/new-relic-browser), and [error collection](/docs/apm/applications-menu/events/view-apm-error-analytics).
1428
1428
 
1429
- <Callout variant="important">
1430
- Cross application tracing is deprecated in favor of [distributed tracing](/docs/apm/distributed-tracing/getting-started/introduction-distributed-tracing). Distributed tracing is on by default for Ruby agent versions 8.0.0 and above. Middlewares are not required to support distributed tracing.
1429
+ <Callout variant="important">
1430
+ Cross application tracing is deprecated in favor of [distributed tracing](/docs/apm/distributed-tracing/getting-started/introduction-distributed-tracing). Distributed tracing is on by default for Ruby agent versions 8.0.0 and above. Middlewares are not required to support distributed tracing.
1431
1431
 
1432
- To continue using cross application tracing, update the following options in your `newrelic.yml` configuration file:
1432
+ To continue using cross application tracing, update the following options in your `newrelic.yml` configuration file:
1433
1433
 
1434
- ```yaml
1435
- # newrelic.yml
1436
-
1437
- cross_application_tracer:
1438
- enabled: true
1439
- distributed_tracing:
1440
- enabled: false
1441
- ```
1442
- </Callout>
1434
+ ```yaml
1435
+ cross_application_tracer:
1436
+ enabled: true
1437
+ distributed_tracing:
1438
+ enabled: false
1439
+ ```
1440
+ </Callout>
1443
1441
  DESCRIPTION
1444
1442
  },
1445
1443
  :disable_view_instrumentation => {
@@ -1465,7 +1463,28 @@ module NewRelic
1465
1463
  :allowed_from_server => true,
1466
1464
  :description => 'Distributed tracing lets you see the path that a request takes through your distributed system. Enabling distributed tracing changes the behavior of some New Relic features, so carefully consult the [transition guide](/docs/transition-guide-distributed-tracing) before you enable this feature.'
1467
1465
  },
1466
+ :'distributed_tracing.sampler.remote_parent_sampled' => {
1467
+ :default => 'default',
1468
+ :public => true,
1469
+ :type => String,
1470
+ :allowed_from_server => true,
1471
+ :description => 'This setting controls the behavior of transaction sampling when a remote parent is sampled and the trace flag is set in the traceparent. Available values are `default`, `always_on`, and `always_off`.'
1472
+ },
1473
+ :'distributed_tracing.sampler.remote_parent_not_sampled' => {
1474
+ :default => 'default',
1475
+ :public => true,
1476
+ :type => String,
1477
+ :allowed_from_server => true,
1478
+ :description => 'This setting controls the behavior of transaction sampling when a remote parent is not sampled and the trace flag is not set in the traceparent. Available values are `default`, `always_on`, and `always_off`.'
1479
+ },
1468
1480
  # Elasticsearch
1481
+ :'elasticsearch.capture_cluster_name' => {
1482
+ :default => true,
1483
+ :public => true,
1484
+ :type => Boolean,
1485
+ :allowed_from_server => true,
1486
+ :description => 'If `true`, the agent captures the Elasticsearch cluster name in transaction traces.'
1487
+ },
1469
1488
  :'elasticsearch.capture_queries' => {
1470
1489
  :default => true,
1471
1490
  :public => true,
@@ -2046,7 +2065,7 @@ module NewRelic
2046
2065
  If `true`, when the agent is in an application using Ruby on Rails, it will start after `config/initializers` run.
2047
2066
 
2048
2067
  <Callout variant="caution">
2049
- This option may only be set by environment variable.
2068
+ This option may only be set by environment variable.
2050
2069
  </Callout>
2051
2070
  DESCRIPTION
2052
2071
  },
@@ -2184,8 +2203,8 @@ module NewRelic
2184
2203
  :allowed_from_server => true,
2185
2204
  # Keep the extra two-space indent before the second bullet to appease translation tool
2186
2205
  :description => <<~DESC
2187
- * Defines the maximum number of span events reported from a single harvest. Any Integer between `1` and `10000` is valid.'
2188
- * When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), set to max value `10000`.\
2206
+ - Defines the maximum number of span events reported from a single harvest. Any Integer between `1` and `10000` is valid.'
2207
+ - When configuring the agent for [AI monitoring](/docs/ai-monitoring/intro-to-ai-monitoring), set to max value `10000`.\
2189
2208
  This ensures the agent captures the maximum amount of distributed traces.
2190
2209
  DESC
2191
2210
  },
@@ -2490,6 +2509,14 @@ module NewRelic
2490
2509
  :allowed_from_server => true,
2491
2510
  :description => 'Number of seconds betwixt connections to the New Relic span event collection services.'
2492
2511
  },
2512
+ # TODO: Sync with the other agents to see what the config should be named, how it should be enabled, how it should be described
2513
+ :'opentelemetry_bridge.enabled' => {
2514
+ :default => false,
2515
+ :public => false,
2516
+ :type => Boolean,
2517
+ :allowed_from_server => false,
2518
+ :description => 'Enables the creation of Transaction Trace segments and timeslice metrics from OpenTelemetry Spans. This will help drive New Relic UI experience for opentelemetry spans. **WARNING**: This is not feature complete and is not intended to be enabled yet.'
2519
+ },
2493
2520
  :force_reconnect => {
2494
2521
  :default => false,
2495
2522
  :public => false,
@@ -2528,11 +2555,9 @@ module NewRelic
2528
2555
  :allowlist => %i[none low medium high],
2529
2556
  :external => :infinite_tracing,
2530
2557
  :description => <<~DESC
2531
- Configure the compression level for data sent to the trace observer.
2532
-
2533
- May be one of: `:none`, `:low`, `:medium`, `:high`.
2534
-
2535
- Set the level to `:none` to disable compression.
2558
+ Configure the compression level for data sent to the trace observer. \
2559
+ May be one of: `:none`, `:low`, `:medium`, `:high`. \
2560
+ Set the level to `:none` to disable compression.
2536
2561
  DESC
2537
2562
  },
2538
2563
  :js_agent_file => {
@@ -36,7 +36,7 @@ module NewRelic
36
36
  erb_file = process_erb(raw_file)
37
37
  config = process_yaml(erb_file, env, config, @file_path)
38
38
  rescue ScriptError, StandardError => e
39
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
39
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
40
40
  log_failure("Failed to read or parse configuration file at #{path}", e)
41
41
  end
42
42
 
@@ -100,7 +100,7 @@ module NewRelic
100
100
  file.gsub!(/^\s*#.*$/, '#')
101
101
  ERB.new(file).result(binding)
102
102
  rescue ScriptError, StandardError => e
103
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
103
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
104
104
  message = 'Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.'
105
105
  failure_array = [message, e]
106
106
  failure_array << e.backtrace[0] if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.4.0')
@@ -36,7 +36,7 @@ module NewRelic
36
36
  uri = ::URI.parse(url)
37
37
  end
38
38
  end
39
- uri.host&.downcase!
39
+ uri.host = uri.host&.downcase
40
40
  uri
41
41
  end
42
42
 
@@ -8,7 +8,7 @@ module NewRelic
8
8
  module Agent
9
9
  module Instrumentation
10
10
  class ActiveJobSubscriber < NotificationsSubscriber
11
- PAYLOAD_KEYS = %i[adapter db_runtime error job wait]
11
+ PAYLOAD_KEYS = %i[adapter db_runtime error job wait jobs]
12
12
 
13
13
  def add_segment_params(segment, payload)
14
14
  PAYLOAD_KEYS.each do |key|
@@ -16,8 +16,12 @@ module NewRelic
16
16
  end
17
17
  end
18
18
 
19
+ # NOTE: For `enqueue_all.active_job`, only the first job is used to determine the queue.
20
+ # Therefore, this assumes all jobs given as arguments for perform_all_later share the same queue.
19
21
  def metric_name(name, payload)
20
- queue = payload[:job].queue_name
22
+ job = payload[:job] || payload[:jobs].first
23
+
24
+ queue = job.queue_name
21
25
  method = method_from_name(name)
22
26
  "Ruby/ActiveJob/#{queue}/#{method}"
23
27
  end
@@ -102,6 +102,7 @@ module NewRelic::Agent::Instrumentation
102
102
  end
103
103
 
104
104
  def nr_cluster_name
105
+ return unless NewRelic::Agent.config[:'elasticsearch.capture_cluster_name']
105
106
  return @nr_cluster_name if defined?(@nr_cluster_name)
106
107
  return if nr_hosts.empty?
107
108
 
@@ -21,7 +21,7 @@ module NewRelic
21
21
 
22
22
  begin
23
23
  response = nil
24
- segment.add_request_headers(wrapped_request)
24
+ segment&.add_request_headers(wrapped_request)
25
25
 
26
26
  # RUBY-1244 Disable further tracing in request to avoid double
27
27
  # counting if connection wasn't started (which calls request again).
@@ -34,10 +34,10 @@ module NewRelic
34
34
  wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new(response)
35
35
 
36
36
  if NewRelic::Agent::LLM.openai_parent?(segment)
37
- NewRelic::Agent::LLM.populate_openai_response_headers(wrapped_response, segment.parent)
37
+ NewRelic::Agent::LLM.populate_openai_response_headers(wrapped_response, segment&.parent)
38
38
  end
39
39
 
40
- segment.process_response_headers(wrapped_response)
40
+ segment&.process_response_headers(wrapped_response)
41
41
 
42
42
  response
43
43
  ensure
@@ -16,8 +16,6 @@ module NewRelic
16
16
  end
17
17
 
18
18
  def self.find_all_subscribers
19
- # TODO: need to talk to Rails core about an API for this,
20
- # rather than digging through Listener ivars
21
19
  instance_variable_names = [:@subscribers, :@string_subscribers, :@other_subscribers]
22
20
  all_subscribers = []
23
21