newrelic_rpm 9.18.0 → 9.20.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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +56 -0
  3. data/lib/new_relic/agent/agent.rb +2 -0
  4. data/lib/new_relic/agent/configuration/default_source.rb +112 -85
  5. data/lib/new_relic/agent/configuration/manager.rb +5 -2
  6. data/lib/new_relic/agent/configuration/yaml_source.rb +2 -2
  7. data/lib/new_relic/agent/database.rb +1 -1
  8. data/lib/new_relic/agent/database_adapter.rb +1 -1
  9. data/lib/new_relic/agent/datastores/redis.rb +1 -1
  10. data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +1 -1
  11. data/lib/new_relic/agent/distributed_tracing.rb +2 -0
  12. data/lib/new_relic/agent/external.rb +2 -0
  13. data/lib/new_relic/agent/instrumentation/action_dispatch.rb +1 -1
  14. data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +1 -1
  15. data/lib/new_relic/agent/instrumentation/action_mailbox.rb +1 -1
  16. data/lib/new_relic/agent/instrumentation/action_mailer.rb +1 -1
  17. data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
  18. data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +6 -2
  19. data/lib/new_relic/agent/instrumentation/active_record.rb +6 -4
  20. data/lib/new_relic/agent/instrumentation/active_record_helper.rb +2 -2
  21. data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +11 -9
  22. data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
  23. data/lib/new_relic/agent/instrumentation/async_http.rb +1 -1
  24. data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +1 -1
  25. data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +1 -1
  26. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -0
  27. data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
  28. data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -2
  29. data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
  30. data/lib/new_relic/agent/instrumentation/ethon.rb +1 -1
  31. data/lib/new_relic/agent/instrumentation/excon.rb +1 -1
  32. data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
  33. data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +1 -1
  34. data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -4
  35. data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +1 -1
  36. data/lib/new_relic/agent/instrumentation/httpx.rb +1 -1
  37. data/lib/new_relic/agent/instrumentation/logstasher.rb +1 -1
  38. data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +1 -1
  39. data/lib/new_relic/agent/instrumentation/memcache/helper.rb +2 -2
  40. data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +1 -1
  41. data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -1
  42. data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -1
  43. data/lib/new_relic/agent/instrumentation/net_http.rb +2 -1
  44. data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
  45. data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +2 -2
  46. data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +2 -2
  47. data/lib/new_relic/agent/instrumentation/redis/constants.rb +2 -2
  48. data/lib/new_relic/agent/instrumentation/resque.rb +2 -2
  49. data/lib/new_relic/agent/instrumentation/roda.rb +1 -1
  50. data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +1 -1
  51. data/lib/new_relic/agent/instrumentation/ruby_openai.rb +2 -2
  52. data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
  53. data/lib/new_relic/agent/instrumentation/stripe.rb +1 -1
  54. data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +2 -2
  55. data/lib/new_relic/agent/llm/chat_completion_summary.rb +1 -1
  56. data/lib/new_relic/agent/llm/embedding.rb +1 -1
  57. data/lib/new_relic/agent/local_log_decorator.rb +1 -1
  58. data/lib/new_relic/agent/logging.rb +1 -1
  59. data/lib/new_relic/agent/messaging.rb +5 -0
  60. data/lib/new_relic/agent/method_tracer.rb +3 -0
  61. data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -1
  62. data/lib/new_relic/agent/monitors/synthetics_monitor.rb +1 -1
  63. data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
  64. data/lib/new_relic/agent/opentelemetry/context/propagation/trace_propagator.rb +66 -0
  65. data/lib/new_relic/agent/opentelemetry/context/propagation.rb +15 -0
  66. data/lib/new_relic/agent/opentelemetry/context.rb +13 -0
  67. data/lib/new_relic/agent/opentelemetry/trace/span.rb +31 -0
  68. data/lib/new_relic/agent/opentelemetry/trace/tracer.rb +129 -0
  69. data/lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb +18 -0
  70. data/lib/new_relic/agent/opentelemetry/trace.rb +15 -0
  71. data/lib/new_relic/agent/opentelemetry/transaction_patch.rb +69 -0
  72. data/lib/new_relic/agent/opentelemetry_bridge.rb +32 -0
  73. data/lib/new_relic/agent/parameter_filtering.rb +1 -1
  74. data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
  75. data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
  76. data/lib/new_relic/agent/span_event_primitive.rb +8 -1
  77. data/lib/new_relic/agent/tracer.rb +1 -1
  78. data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -1
  79. data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
  80. data/lib/new_relic/agent/transaction/distributed_tracer.rb +3 -3
  81. data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
  82. data/lib/new_relic/agent/transaction/request_attributes.rb +1 -6
  83. data/lib/new_relic/agent/transaction/trace_context.rb +33 -4
  84. data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
  85. data/lib/new_relic/agent/utilization/ecs.rb +22 -0
  86. data/lib/new_relic/agent/utilization/ecs_v4.rb +22 -0
  87. data/lib/new_relic/agent/utilization_data.rb +25 -0
  88. data/lib/new_relic/agent/vm/c_ruby_vm.rb +3 -3
  89. data/lib/new_relic/agent.rb +28 -0
  90. data/lib/new_relic/constants.rb +1 -0
  91. data/lib/new_relic/control/instrumentation.rb +1 -1
  92. data/lib/new_relic/dependency_detection.rb +0 -1
  93. data/lib/new_relic/helper.rb +7 -0
  94. data/lib/new_relic/version.rb +1 -1
  95. data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
  96. data/lib/tasks/helpers/newrelicyml.rb +2 -0
  97. data/newrelic.yml +25 -15
  98. data/newrelic_rpm.gemspec +1 -1
  99. metadata +16 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb30bae7fc944221b3f08c8635e18c84c02b04f2fe36bc70814c3fed471dd8f8
4
- data.tar.gz: 01fc3c88893c0fc0d8f3e92cc394767eac9ee134f2c58d3656e8d6e6b5a95d8f
3
+ metadata.gz: 7534628f5d1c53ceff110ad76f2c63a3773d32f7f13d7146ff4c7da72ecef143
4
+ data.tar.gz: aeacda7d6851268da1e67d61376088902e9fa6080d184d91ea1bdbda632af889
5
5
  SHA512:
6
- metadata.gz: 99dc8ccbe8653343313da890dd8f6fc445638239c346fd104f3792519f33096f0ea2ec2faf96d03de72d050d38887c5c1a61caa3c7f66196d71bd5d0e057cf40
7
- data.tar.gz: bb47acdc604c90a7bf8c7ddd0dafbb1377d8de51b3841cdcb2fef377a8b789cd523f522478d0387ec84ab4b6b85d7dc8e2f5ae7881501ee38c7c5d5acc6564fb
6
+ metadata.gz: fa3dfb1d4971a14c83e57b2de5fc20298f95e7e75dbba07631ec7e70c962e263f8c10f046ed5f067d3b38ec629ebc57e5cad502679468f8a0245b0bddc1d7061
7
+ data.tar.gz: 95f05672fffa1af08da58e1d470cf40d9d0587aa2d2fa1a2db162a46b0bd11abd290e5150ef98de29dd43517ebeb2df1aaa836ae13a33f7835ef76534f14807c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # New Relic Ruby Agent Release Notes
2
2
 
3
+ ## v9.20.0
4
+
5
+ - **Feature: Add ECS Docker ID for Fargate**
6
+
7
+ Previously, the Ruby agent did not record the Docker ID when running in an AWS ECS Fargate environment. The Docker ID will now be recorded correctly. [PR#3172](https://github.com/newrelic/newrelic-ruby-agent/pull/3172)
8
+
9
+ - **Feature: Add NewRelic::Helper.version_satisfied?**
10
+
11
+ The agent has a new helper method to simplify version comparison. `NewRelic::Helper.version_satisfied?` accepts three arguments: a left-side version number, the comparison operator as a string, and a right-side version number. Our thanks go to [@kekke-n](https://github.com/kekke-n) for this contribution. [PR#3182](https://github.com/newrelic/newrelic-ruby-agent/pull/3182)
12
+
13
+ - **Feature: Add code.stacktrace attribute on datastore spans when duration exceeds configured threshold**
14
+
15
+ The agent will now add the `code.stacktrace` attribute to datastore spans when the duration exceeds the configured threshold. The threshold is configured using the `transaction_tracer.stack_trace_threshold` configuration option. [PR#3220](https://github.com/newrelic/newrelic-ruby-agent/pull/3220)
16
+
17
+ - **Feature: Consolidate "Unknown" constant values**
18
+
19
+ All references to the various capitalization styles for "Unknown" have been consolidated into two constants: `NewRelic::UNKNOWN` and `NewRelic::UNKNOWN_LOWER`. Thank you, [@tsubasa1122](https://github.com/@tsubasa1122), for your contribution! [PR#3185](https://github.com/newrelic/newrelic-ruby-agent/pull/3185)
20
+
21
+ - **Bugfix: Fix Brewfile source links**
22
+
23
+ Previously, the multiverse README's links to the Brewfile were broken. Our thanks go to [@emmanuel-ferdman](https://github.com/emmanuel-ferdman) for submitting a PR to fix them! [PR#3191](https://github.com/newrelic/newrelic-ruby-agent/pull/3191)
24
+
25
+ - **Bugfix: Fix error when using HTTPX 1.5.0**
26
+
27
+ The agent previously encountered an error when using the new HTTPX version 1.5.0. This was due to a change in the way HTTPX stores the response. The agent has been updated to handle this change correctly, and no longer encounters an error when using HTTPX 1.5.0. [PR#3203](https://github.com/newrelic/newrelic-ruby-agent/pull/3203)
28
+
29
+ - **Bugfix: Bugfixes and improvements to debug level agent logs**
30
+
31
+ Improves the information logged at the debug level by the agent when the agent reads in a configuration source. [PR#3221](https://github.com/newrelic/newrelic-ruby-agent/pull/3221)
32
+
33
+ - **Bugfix: Fix risk of server-side forgery for Slack workflow script**
34
+
35
+ Internally, we keep track of gems that are released using a GitHub actions workflow that posts updates on Slack. [@odaysec] identified a way we could reduce the risk of server-side forgery for this workflow. Thank you! [PR#3184](https://github.com/newrelic/newrelic-ruby-agent/pull/3184)
36
+
37
+ - **Bugfix: Replace JSON.load calls with JSON.parse**
38
+
39
+ Generally, JSON.parse is seen as safer than JSON.load. Thank you, [@odaysec](https://github.com/odaysec), for bringing this to our attention! [PR#3183](https://github.com/newrelic/newrelic-ruby-agent/pull/3183) [PR#3230](https://github.com/newrelic/newrelic-ruby-agent/pull/3230)
40
+
41
+ ## v9.19.0
42
+
43
+ - **Feature: Add Thread ID as attribute to all spans**
44
+
45
+ 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)
46
+
47
+ - **Feature: Add support for W3C TraceContext Trace Flag**
48
+
49
+ 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)
50
+
51
+ - **Bugfix: Include request.uri in Transaction events by default**
52
+
53
+ [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)
54
+
55
+ - **Bugfix: Fix error in Active Job instrumentation when using perform_all_later**
56
+
57
+ 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)
58
+
3
59
  ## v9.18.0
4
60
 
5
61
  - **Feature: Add elasticsearch.capture_cluster_name configuration option**
@@ -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
@@ -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
+ \t\t- one.custom.event
391
+ \t\t- another.event
392
+ \t\t- 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
+ \tThe excluded attributes include:
411
+ \t- `content` from LlmChatCompletionMessage events
412
+ \t- `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
+ \tThis 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
@@ -461,7 +461,7 @@ module NewRelic
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
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>.
464
+ \tWhen 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
465
  </Callout>
466
466
  DESCRIPTION
467
467
  },
@@ -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
+ \t- `config/newrelic.yml`
491
+ \t- `newrelic.yml`
492
+ \t- `$HOME/.newrelic/newrelic.yml`
493
+ \t- `$HOME/newrelic.yml`
494
494
  DESC
495
495
  },
496
496
  :'exclude_newrelic_header' => {
@@ -676,10 +676,10 @@ module NewRelic
676
676
  :allowed_from_server => true,
677
677
  :description => <<~DESC
678
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`.
679
+ \tBy default, this is set to `obfuscated`, which strips out the numeric and string literals.
680
+ \t- If you do not want the agent to capture query information, set this to `none`.
681
+ \t- If you want the agent to capture all query information in its original form, set this to `raw`.
682
+ \t- When you enable [high security mode](/docs/agents/manage-apm-agents/configuration/high-security-mode), this is automatically set to `obfuscated`.
683
683
  DESC
684
684
  },
685
685
 
@@ -722,9 +722,9 @@ module NewRelic
722
722
  :dynamic_name => true,
723
723
  :description => <<~DESCRIPTION
724
724
  A list of error classes that the agent should treat as expected.
725
- <Callout variant="caution">
726
- This option can't be set via environment variable.
727
- </Callout>
725
+ \t<Callout variant="caution">
726
+ \t\tThis option can't be set via environment variable.
727
+ \t</Callout>
728
728
  DESCRIPTION
729
729
  },
730
730
  :'error_collector.expected_messages' => {
@@ -735,9 +735,9 @@ module NewRelic
735
735
  :dynamic_name => true,
736
736
  :description => <<~DESCRIPTION
737
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.
738
- <Callout variant="caution">
739
- This option can't be set via environment variable.
740
- </Callout>
738
+ \t<Callout variant="caution">
739
+ \t\tThis option can't be set via environment variable.
740
+ \t</Callout>
741
741
  DESCRIPTION
742
742
  },
743
743
  :'error_collector.expected_status_codes' => {
@@ -756,22 +756,27 @@ module NewRelic
756
756
  :dynamic_name => true,
757
757
  :description => <<~DESCRIPTION
758
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>
759
+ \t<Callout variant="caution">
760
+ \t\tThis option can't be set via environment variable.
761
+ \t</Callout>
762
762
  DESCRIPTION
763
763
  },
764
764
  :'error_collector.ignore_messages' => {
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
765
769
  :default => {'ThreadError' => ['queue empty']},
770
+ :documentation_default => {'ThreadError': ['queue empty']},
766
771
  :public => true,
767
772
  :type => Hash,
768
773
  :allowed_from_server => true,
769
774
  :dynamic_name => true,
770
775
  :description => <<~DESCRIPTION
771
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.
772
- <Callout variant="caution">
773
- This option can't be set via environment variable.
774
- </Callout>
777
+ \t<Callout variant="caution">
778
+ \t\tThis option can't be set via environment variable.
779
+ \t</Callout>
775
780
  DESCRIPTION
776
781
  },
777
782
  :'error_collector.ignore_status_codes' => {
@@ -853,19 +858,19 @@ module NewRelic
853
858
  :description => <<~DESCRIPTION
854
859
  Sets the minimum level a log event must have to be forwarded to New Relic.
855
860
 
856
- This is based on the integer values of [Ruby's `Logger::Severity` constants](https://github.com/ruby/logger/blob/113b82a06b3076b93a71cd467e1605b23afb3088/lib/logger/severity.rb).
861
+ \tThis is based on the integer values of [Ruby's `Logger::Severity` constants](https://github.com/ruby/logger/blob/113b82a06b3076b93a71cd467e1605b23afb3088/lib/logger/severity.rb).
857
862
 
858
- The intention is to forward logs with the level given to the configuration, as well as any logs with a higher level of severity.
863
+ \tThe intention is to forward logs with the level given to the configuration, as well as any logs with a higher level of severity.
859
864
 
860
- 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".
865
+ \tFor 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".
861
866
 
862
- Valid values (ordered lowest to highest):
863
- - "debug"
864
- - "info"
865
- - "warn"
866
- - "error"
867
- - "fatal"
868
- - "unknown"
867
+ \tValid values (ordered lowest to highest):
868
+ \t- "debug"
869
+ \t- "info"
870
+ \t- "warn"
871
+ \t- "error"
872
+ \t- "fatal"
873
+ \t- "unknown"
869
874
  DESCRIPTION
870
875
  },
871
876
  :'application_logging.forwarding.custom_attributes' => {
@@ -1148,7 +1153,7 @@ module NewRelic
1148
1153
  :public => true,
1149
1154
  :type => Boolean,
1150
1155
  :allowed_from_server => true,
1151
- :description => "If `true`, the agent will report source code level metrics for traced methods.\nSee: " \
1156
+ :description => "If `true`, the agent will report source code level metrics for traced methods.\n\tSee: " \
1152
1157
  'https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/ruby-codestream-integration/'
1153
1158
  },
1154
1159
  # Cross application tracer
@@ -1160,7 +1165,7 @@ module NewRelic
1160
1165
  :deprecated => true,
1161
1166
  :description => deprecated_description(
1162
1167
  :'distributed_tracing.enabled',
1163
- 'If `true`, enables [cross-application tracing](/docs/agents/ruby-agent/features/cross-application-tracing-ruby/) when `distributed_tracing.enabled` is set to `false`.'
1168
+ ' If `true`, enables [cross-application tracing](/docs/agents/ruby-agent/features/cross-application-tracing-ruby/) when `distributed_tracing.enabled` is set to `false`.'
1164
1169
  )
1165
1170
  },
1166
1171
  # Custom attributes
@@ -1180,45 +1185,45 @@ module NewRelic
1180
1185
  :description => <<~DESCRIPTION
1181
1186
  An array of `CLASS#METHOD` (for instance methods) and/or `CLASS.METHOD` (for class methods) strings representing Ruby methods that the agent can automatically add custom instrumentation to. This doesn't require any modifications of the source code that defines the methods.
1182
1187
 
1183
- Use fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
1188
+ \tUse fully qualified class names (using the `::` delimiter) that include any module or class namespacing.
1184
1189
 
1185
- Here is some Ruby source code that defines a `render_png` instance method for an `Image` class and a `notify` class method for a `User` class, both within a `MyCompany` module namespace:
1190
+ \tHere is some Ruby source code that defines a `render_png` instance method for an `Image` class and a `notify` class method for a `User` class, both within a `MyCompany` module namespace:
1186
1191
 
1187
- ```rb
1188
- module MyCompany
1189
- class Image
1190
- def render_png
1191
- # code to render a PNG
1192
- end
1193
- end
1192
+ \t```rb
1193
+ \t\tmodule MyCompany
1194
+ \t\t\tclass Image
1195
+ \t\t\t\tdef render_png
1196
+ \t\t\t\t\t# code to render a PNG
1197
+ \t\t\t\tend
1198
+ \t\t\tend
1194
1199
 
1195
- class User
1196
- def self.notify
1197
- # code to notify users
1198
- end
1199
- end
1200
- end
1201
- ```
1200
+ \t\t\tclass User
1201
+ \t\t\t\tdef self.notify
1202
+ \t\t\t\t\t# code to notify users
1203
+ \t\t\t\tend
1204
+ \t\t\tend
1205
+ \t\tend
1206
+ \t```
1202
1207
 
1203
- Given that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
1208
+ \tGiven that source code, the `newrelic.yml` config file might request instrumentation for both of these methods like so:
1204
1209
 
1205
- ```yaml
1206
- automatic_custom_instrumentation_method_list:
1207
- - MyCompany::Image#render_png
1208
- - MyCompany::User.notify
1209
- ```
1210
+ \t```yaml
1211
+ \t\tautomatic_custom_instrumentation_method_list:
1212
+ \t\t\t- MyCompany::Image#render_png
1213
+ \t\t\t- MyCompany::User.notify
1214
+ \t```
1210
1215
 
1211
- That configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
1216
+ \tThat configuration example uses YAML array syntax to specify both methods. Alternatively, you can use a comma-delimited string:
1212
1217
 
1213
- ```yaml
1214
- automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
1215
- ```
1218
+ \t```yaml
1219
+ \t\tautomatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png, MyCompany::User.notify'
1220
+ \t```
1216
1221
 
1217
- Whitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, use this comma-delimited string format:
1222
+ \tWhitespace around the comma(s) in the list is optional. When configuring the agent with a list of methods via the `NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST` environment variable, use this comma-delimited string format:
1218
1223
 
1219
- ```sh
1220
- export NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
1221
- ```
1224
+ \t```sh
1225
+ \t\texport NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png, MyCompany::User.notify'
1226
+ \t```
1222
1227
  DESCRIPTION
1223
1228
  },
1224
1229
  # Custom events
@@ -1421,18 +1426,18 @@ module NewRelic
1421
1426
  :description => <<~DESCRIPTION
1422
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).
1423
1428
 
1424
- <Callout variant="important">
1425
- 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
+ \t<Callout variant="important">
1430
+ \t\tCross 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.
1426
1431
 
1427
- To continue using cross application tracing, update the following options in your `newrelic.yml` configuration file:
1432
+ \t\tTo continue using cross application tracing, update the following options in your `newrelic.yml` configuration file:
1428
1433
 
1429
- ```yaml
1430
- cross_application_tracer:
1431
- enabled: true
1432
- distributed_tracing:
1433
- enabled: false
1434
- ```
1435
- </Callout>
1434
+ \t\t```yaml
1435
+ \t\t\tcross_application_tracer:
1436
+ \t\t\t\tenabled: true
1437
+ \t\t\tdistributed_tracing:
1438
+ \t\t\t\tenabled: false
1439
+ \t\t```
1440
+ \t</Callout>
1436
1441
  DESCRIPTION
1437
1442
  },
1438
1443
  :disable_view_instrumentation => {
@@ -1458,6 +1463,20 @@ module NewRelic
1458
1463
  :allowed_from_server => true,
1459
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.'
1460
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
+ },
1461
1480
  # Elasticsearch
1462
1481
  :'elasticsearch.capture_cluster_name' => {
1463
1482
  :default => true,
@@ -1942,10 +1961,10 @@ module NewRelic
1942
1961
  :transform => DefaultSource.method(:convert_to_list),
1943
1962
  :description => <<~DESCRIPTION
1944
1963
  An array of strings to specify which keys and/or values inside a Stripe event's `user_data` hash should
1945
- not be reported to New Relic. Each string in this array will be turned into a regular expression via
1946
- `Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the pair
1947
- isn't reported. By default, no `user_data` is reported. Use this option only if the
1948
- `stripe.user_data.include` option is also used.
1964
+ \tnot be reported to New Relic. Each string in this array will be turned into a regular expression via
1965
+ \t`Regexp.new` to permit advanced matching. For each hash pair, if either the key or value is matched the pair
1966
+ \tisn't reported. By default, no `user_data` is reported. Use this option only if the
1967
+ \t`stripe.user_data.include` option is also used.
1949
1968
  DESCRIPTION
1950
1969
  },
1951
1970
  :'instrumentation.thread' => {
@@ -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
+ \tThis option may only be set by environment variable.
2050
2069
  </Callout>
2051
2070
  DESCRIPTION
2052
2071
  },
@@ -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,
@@ -382,6 +382,7 @@ module NewRelic
382
382
  @security_policy_source = nil
383
383
  @high_security_source = nil
384
384
  @environment_source = EnvironmentSource.new
385
+ log_config(:add, @environment_source) # this is the only place the EnvironmentSource is ever created, so we should log it
385
386
  @server_source = nil
386
387
  @manual_source = nil
387
388
  @yaml_source = nil
@@ -424,8 +425,10 @@ module NewRelic
424
425
  # actually going to be logging the message based on our current log
425
426
  # level, so use a `do` block.
426
427
  NewRelic::Agent.logger.debug do
427
- hash = flattened.delete_if { |k, _h| DEFAULTS.fetch(k, {}).fetch(:exclude_from_reported_settings, false) }
428
- "Updating config (#{direction}) from #{source.class}. Results: #{hash.inspect}"
428
+ source_hash = source.dup.to_h.delete_if { |k, _v| DEFAULTS.fetch(k, {}).fetch(:exclude_from_reported_settings, false) }
429
+ final_hash = flattened.delete_if { |k, _h| DEFAULTS.fetch(k, {}).fetch(:exclude_from_reported_settings, false) }
430
+
431
+ "Updating config (#{direction}) from #{source.class} with values: #{source_hash}. \nConfig Stack Results: #{final_hash.inspect}"
429
432
  end
430
433
  end
431
434
 
@@ -67,7 +67,7 @@ module NewRelic
67
67
  end
68
68
 
69
69
  def warn_missing_config_file(path)
70
- based_on = 'unknown'
70
+ based_on = NewRelic::UNKNOWN_LOWER
71
71
  source = ::NewRelic::Agent.config.source(:config_path)
72
72
  candidate_paths = [path]
73
73
 
@@ -103,7 +103,7 @@ module NewRelic
103
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
- failure_array << e.backtrace[0] if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.4.0')
106
+ failure_array << e.backtrace[0] if NewRelic::Helper.version_satisfied?(RUBY_VERSION, '>=', '3.4.0')
107
107
  log_failure(*failure_array)
108
108
  nil
109
109
  end
@@ -123,7 +123,7 @@ module NewRelic
123
123
  return @supports_with_connection if defined?(@supports_with_connection)
124
124
 
125
125
  @supports_with_connection = defined?(::ActiveRecord::VERSION::STRING) &&
126
- Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('7.2.0')
126
+ NewRelic::Helper.version_satisfied?(ActiveRecord::VERSION::STRING, '>=', '7.2.0')
127
127
  end
128
128
 
129
129
  def close_connections
@@ -25,7 +25,7 @@ module NewRelic
25
25
  end
26
26
 
27
27
  def value
28
- match = VERSIONS.keys.find { |key| version >= Gem::Version.new(key) }
28
+ match = VERSIONS.keys.find { |key| NewRelic::Helper.version_satisfied?(version, '>=', key) }
29
29
  return unless match
30
30
 
31
31
  VERSIONS[match].call(env)
@@ -83,7 +83,7 @@ module NewRelic
83
83
  end
84
84
 
85
85
  def self.is_supported_version?
86
- Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('3.0.0')
86
+ NewRelic::Helper.version_satisfied?(::Redis::VERSION, '>=', '3.0.0')
87
87
  end
88
88
 
89
89
  def self.ellipsize(result, string)
@@ -207,7 +207,7 @@ module NewRelic
207
207
  decoded_appdata.set_encoding(::Encoding::UTF_8) if
208
208
  decoded_appdata.respond_to?(:set_encoding)
209
209
 
210
- ::JSON.load(decoded_appdata)
210
+ ::JSON.parse(decoded_appdata)
211
211
  end
212
212
 
213
213
  def valid_cross_app_id?(xp_id)
@@ -39,6 +39,7 @@ module NewRelic
39
39
  # @return {Transaction} The transaction the headers were inserted from,
40
40
  # or +nil+ if headers were not inserted.
41
41
  #
42
+ # @!scope class
42
43
  # @api public
43
44
  #
44
45
  def insert_distributed_trace_headers(headers = {})
@@ -93,6 +94,7 @@ module NewRelic
93
94
  #
94
95
  # @return {Transaction} if successful, +nil+ otherwise
95
96
  #
97
+ # @!scope class
96
98
  # @api public
97
99
  #
98
100
  def accept_distributed_trace_headers(headers, transport_type = NewRelic::HTTP)
@@ -29,6 +29,7 @@ module NewRelic
29
29
  #
30
30
  # @param request_metadata [String] received obfuscated request metadata
31
31
  #
32
+ # @!scope class
32
33
  # @api public
33
34
  #
34
35
  def process_request_metadata(request_metadata)
@@ -74,6 +75,7 @@ module NewRelic
74
75
  #
75
76
  # @return [String] obfuscated response metadata to send
76
77
  #
78
+ # @!scope class
77
79
  # @api public
78
80
  #
79
81
  def get_response_metadata
@@ -16,7 +16,7 @@ DependencyDetection.defer do
16
16
  defined?(ActionDispatch) &&
17
17
  defined?(ActionPack) &&
18
18
  ActionPack.respond_to?(:gem_version) &&
19
- ActionPack.gem_version >= Gem::Version.new('6.0.0') && # notifications for dispatch added in Rails 6
19
+ NewRelic::Helper.version_satisfied?(ActionPack.gem_version, '>=', '6.0.0') && # notifications for dispatch added in Rails 6
20
20
  !NewRelic::Agent::Instrumentation::ActionDispatchSubscriber.subscribed?
21
21
  end
22
22
 
@@ -45,7 +45,7 @@ module NewRelic
45
45
  end
46
46
 
47
47
  PATTERN = /\A([^\.]+)\.action_dispatch\z/
48
- UNKNOWN = 'unknown'.freeze
48
+ UNKNOWN = NewRelic::UNKNOWN_LOWER
49
49
 
50
50
  METHOD_NAME_MAPPING = Hash.new do |h, k|
51
51
  if PATTERN =~ k
@@ -15,7 +15,7 @@ DependencyDetection.defer do
15
15
  defined?(ActiveSupport) &&
16
16
  defined?(ActionMailbox) &&
17
17
  ActionMailbox.respond_to?(:gem_version) && # 'require "action_mailbox"' doesn't require version...
18
- ActionMailbox.gem_version >= Gem::Version.new('7.1.0.alpha') && # notifications added in Rails 7.1
18
+ NewRelic::Helper.version_satisfied?(ActionMailbox.gem_version, '>=', '7.1.0.alpha') && # notifications added in Rails 7.1
19
19
  !NewRelic::Agent::Instrumentation::ActionMailboxSubscriber.subscribed?
20
20
  end
21
21
 
@@ -15,7 +15,7 @@ DependencyDetection.defer do
15
15
  defined?(ActiveSupport) &&
16
16
  defined?(ActionMailer) &&
17
17
  ActionMailer.respond_to?(:gem_version) &&
18
- ActionMailer.gem_version >= Gem::Version.new('5.0') &&
18
+ NewRelic::Helper.version_satisfied?(ActionMailer.gem_version, '>=', '5.0') &&
19
19
  !NewRelic::Agent::Instrumentation::ActionMailerSubscriber.subscribed?
20
20
  end
21
21
 
@@ -30,7 +30,7 @@ DependencyDetection.defer do
30
30
  executes do
31
31
  if defined?(ActiveSupport) &&
32
32
  ActiveJob.respond_to?(:gem_version) &&
33
- ActiveJob.gem_version >= Gem::Version.new('6.0.0') &&
33
+ NewRelic::Helper.version_satisfied?(ActiveJob.gem_version, '>=', '6.0.0') &&
34
34
  !NewRelic::Agent.config[:disable_activejob] &&
35
35
  !NewRelic::Agent::Instrumentation::ActiveJobSubscriber.subscribed?
36
36
  NewRelic::Agent.logger.info('Installing notifications based ActiveJob instrumentation')
@@ -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