newrelic_rpm 8.6.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +83 -3
  3. data/README.md +1 -1
  4. data/Rakefile +1 -1
  5. data/docker-compose.yml +1 -1
  6. data/lib/new_relic/agent/agent.rb +5 -2
  7. data/lib/new_relic/agent/autostart.rb +13 -10
  8. data/lib/new_relic/agent/configuration/default_source.rb +144 -42
  9. data/lib/new_relic/agent/configuration/environment_source.rb +2 -0
  10. data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +2 -2
  11. data/lib/new_relic/agent/instrumentation/active_merchant.rb +14 -0
  12. data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +10 -0
  13. data/lib/new_relic/agent/instrumentation/authlogic.rb +10 -0
  14. data/lib/new_relic/agent/instrumentation/data_mapper.rb +12 -0
  15. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +19 -0
  16. data/lib/new_relic/agent/instrumentation/rack/helpers.rb +2 -0
  17. data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +11 -0
  18. data/lib/new_relic/agent/instrumentation/sidekiq.rb +15 -0
  19. data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -11
  20. data/lib/new_relic/agent/instrumentation/sunspot.rb +10 -0
  21. data/lib/new_relic/agent/instrumentation/thread/chain.rb +24 -0
  22. data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +27 -0
  23. data/lib/new_relic/agent/instrumentation/thread/prepend.rb +22 -0
  24. data/lib/new_relic/agent/instrumentation/thread.rb +20 -0
  25. data/lib/new_relic/agent/pipe_service.rb +1 -2
  26. data/lib/new_relic/agent/stats.rb +48 -23
  27. data/lib/new_relic/agent/tracer.rb +14 -1
  28. data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -1
  29. data/lib/new_relic/agent/transaction/tracing.rb +8 -3
  30. data/lib/new_relic/agent/transaction.rb +24 -4
  31. data/lib/new_relic/agent/transaction_error_primitive.rb +2 -0
  32. data/lib/new_relic/agent/transaction_metrics.rb +5 -4
  33. data/lib/new_relic/agent/vm/mri_vm.rb +13 -1
  34. data/lib/new_relic/control/instrumentation.rb +31 -0
  35. data/lib/new_relic/dependency_detection.rb +1 -1
  36. data/lib/new_relic/language_support.rb +17 -0
  37. data/lib/new_relic/local_environment.rb +2 -0
  38. data/lib/new_relic/supportability_helper.rb +1 -0
  39. data/lib/new_relic/traced_thread.rb +36 -0
  40. data/lib/new_relic/version.rb +1 -1
  41. data/lib/tasks/config.rake +11 -3
  42. data/newrelic.yml +12 -1
  43. data/newrelic_rpm.gemspec +5 -2
  44. metadata +12 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a27c57733a8526d02022000c47f15de428bda5cb685078adcdb3fd73cf11eda
4
- data.tar.gz: 8f51f79eb70cf8fb9ac70d2fe0d669e2f69eb64e5083291a544ed6210d64efd7
3
+ metadata.gz: 5346c26b9d9c2f9200860b562f1dadb5e79e3eb5d8904850d015c3096cc27d5a
4
+ data.tar.gz: acf374f8f16b88746f6a8451255bb0c6c571fbb0a3875c967648b5a8c5286217
5
5
  SHA512:
6
- metadata.gz: ff3ff2a548356d2820d90b387f41697f4ccee9e5813e18f2b82b3e77a8892f09607eac403f08c24e016c889b2f9d3892d2767985e8b513adcac174d3a8b085f2
7
- data.tar.gz: 72c0a812656455286d0e3d9af0fb1c4d5c7700039617f6cf40250d31cda0adce549a144317932b65c29abce5c220a6a602d6d5b3cdb6aab1150f544a9ab6ed04
6
+ metadata.gz: fb227c6b6d69c8900b5693567b03cc2b4f3d95e4059953e7c45287e51892cbb9ae70e6fb9b9ad6015e5eab1b162281fcc384db07ae4367174617726fca086ad0
7
+ data.tar.gz: e0bca3ab2559e65d9e2f900ddf69a1882190bc7034948760f87829772cfac441f8b14a4028c441316de2126c85b9dc18bf5acafc7587f10deae7beeb7ba0f386
data/CHANGELOG.md CHANGED
@@ -1,14 +1,94 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v8.7.0
4
+
5
+ * **APM logs-in-context log forwarding on by default**
6
+
7
+ Automatic application log forwarding is now enabled by default. This version of the agent will automatically send enriched application logs to New Relic. To learn more about about this feature see [here](https://docs.newrelic.com/docs/apm/new-relic-apm/getting-started/get-started-logs-context/), and additional configuration options are available [here](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-ruby). To learn about how to toggle log ingestion on or off by account see [here](https://docs.newrelic.com/docs/logs/logs-context/disable-automatic-logging).
8
+
9
+ * **Improved async support and Thread instrumentation**
10
+
11
+ Previously, the agent was not able to record events and metrics inside Threads created inside of an already running transaction. This release includes 2 new configuration options to support multithreaded applications to automatically instrument threads. A new configuration option,`instrumentation.thread.tracing` (disabled by default), has been introduced that, when enabled, will allow the agent to insert New Relic tracing inside of all Threads created by an application. To support applications that only want some threads instrumented by New Relic, a new class is available, `NewRelic::TracedThread`, that will create a thread that includes New Relic instrumentation, see our [API documentation](https://www.rubydoc.info/gems/newrelic_rpm/NewRelic) for more details.
12
+
13
+ New configuration options included in this release:
14
+ | Configuration name | Default | Behavior |
15
+ | ----------- | ----------- |----------- |
16
+ | `instrumentation.thread` | `auto` (enabled) | Allows the agent to correctly nest spans inside of an asyncronous transaction |
17
+ | `instrumentation.thread.tracing` | `false` (disabled) | Automatically add tracing to all Threads created in the application. This may be enabled by default in a future release. |
18
+
19
+ We'd like to thank @mikeantonelli for sharing a gist with us that provided our team with an entry point for this feature.
20
+
21
+ * **Deprecate support for Ruby 2.2**
22
+
23
+ Ruby 2.2 reached end of life on March 31, 2018. The agent has deprecated support for Ruby 2.2 and will make breaking changes for this version in its next major release.
24
+
25
+ * **Deprecate instrumentation versions with low adoption and/or versions over five years old**
26
+
27
+ This release deprecates the following instrumentation:
28
+ | Deprecated | Replacement |
29
+ | ----------- | ----------- |
30
+ | ActiveMerchant < 1.65.0 | ActiveMerchant >= 1.65.0 |
31
+ | Acts As Solr (all versions) | none |
32
+ | Authlogic (all versions) | none |
33
+ | Bunny < 2.7.0 | bunny >= 2.7.0 |
34
+ | Dalli < 3.2.1 | Dalli >= 3.2.1 |
35
+ | DataMapper (all versions) | none |
36
+ | Delayed Job < 4.1.0 | Delayed Job >= 4.1.0 |
37
+ | Excon < 0.56.0 | Excon >= 0.56.0 |
38
+ | Grape < 0.19.2 | Grape >= 0.19.2 |
39
+ | HTTPClient < 2.8.3 | HTTPClient 2.8.3 |
40
+ | HTTP.rb < 2.2.2 | HTTP.rb >= 2.2.2 |
41
+ | Mongo < 2.4.1 | Mongo >= 2.4.1 |
42
+ | Padrino < 0.15.0 | Padrino >= 0.15.0 |
43
+ | Passenger < 5.1.3 | Passenger >= 5.1.3 |
44
+ | Puma < 3.9.0 | Puma >= 3.9.0 |
45
+ | Rack < 1.6.8 | Rack >= 1.6.8 |
46
+ | Rails 3.2.x | Rails >= 4.x |
47
+ | Rainbows (all versions) | none |
48
+ | Sequel < 4.45.0 | Sequel >= 4.45.0 |
49
+ | Sidekiq < 5.0.0 | Sidekiq >= 5.0.0 |
50
+ | Sinatra < 2.0.0 | Sinatra >= 2.0.0 |
51
+ | Sunspot (all versions) | none |
52
+ | Typhoeus < 1.3.0 | Typhoeus >= 1.3.0 |
53
+ | Unicorn < 5.3.0 | Unicorn >= 5.3.0 |
54
+
55
+ For the gems with deprecated versions, we will no longer test those versions in our multiverse suite. They may, however, still be compatible with the agent. We will no longer fix bug reports for issues related to these gem versions.
56
+
57
+ * **Clarify documentation for `rake.tasks` configuration**
58
+
59
+ The `rake.tasks` description in the default `newrelic.yml` file and the [New Relic Ruby Agent Configuration docs](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration#rake-tasks) have been updated to clarify its behavior and usage. The documentation now reads:
60
+
61
+ > Specify an array of Rake tasks to automatically instrument. This configuration option converts the Array to a RegEx list. If you'd like to allow all tasks by default, use `rake.tasks: [.+]`. Rake tasks will not be instrumented unless they're added to this list. For more information, visit the (New Relic Rake Instrumentation docs)[/docs/apm/agents/ruby-agent/background-jobs/rake-instrumentation].
62
+
63
+ We thank @robotfelix for suggesting these changes.
64
+
65
+ * **Internally leverage `Object.const_get` and `Object.const_defined?`**
66
+
67
+ When dynamically checking for or obtaining a handle to a class constant from a string, leverage the `Object` class's built in methods wherever possible to enjoy simpler, more performant operations. All JRubies and CRubies v2.5 and below need a bit of assistance beyond what `Object` can provide given that those Rubies may yield an unwanted constant from a different namespace than the one that was specified. But for all other Rubies and even for those Rubies in contexts where we can 100% trust the string value coming in, leverage the `Object` class's methods and reap the benefits.
68
+
69
+ * **Enable Environment Variables setting Array configurations to be converted to Arrays**
70
+
71
+ Prior to this change, when comma-separated lists were passed as environment variables, an error would be emitted to the `newrelic_agent.log` and a String would be set as the value. Now, Arrays will be accurately coerced.
72
+
73
+ * **Bugfix: Allow TransactionEvents to be sampled at the expected rate**
74
+
75
+ The `transaction_events.max_samples_stored` capacity value within the TransactionEventAggregator did not match up with its expected harvest cycle interval, causing TransactionEvents to be over-sampled. This bugfix builds upon the updates made in [#952](https://github.com/newrelic/newrelic-ruby-agent/pull/952) so that the interval and capacity behave as expected for the renamed `transaction_events*` configuration options.
76
+
77
+ * **Bugfix: Error events missing attributes when created outside of a transaction**
78
+
79
+ Previously the agent was not assigning a priority to error events that were created by calling notice_error outside the scope of a transaction. This caused issues with sampling when the error event buffer was full, resulting in a `NoMethodError: undefined method '<' for nil:NilClass` in the newrelic_agent.log. This bugfix ensures that a priority is always assigned on error events so that the agent will be able to sample these error events correctly. Thank you to @olleolleolle for bringing this issue to our attention.
80
+
81
+
82
+
3
83
  ## v8.6.0
4
84
 
5
- * **Telemetry-in-Context: Automatic Application Logs, a quick way to view logs no matter where you are in the platform**
85
+ * **Telemetry-in-Context: Automatic Application Logs, a quick way to view logs no matter where you are in the platform**
6
86
 
7
87
  - Adds support for forwarding application logs to New Relic. This automatically sends application logs that have been enriched to power Telemetry-in-Context. This is disabled by default in this release. This may be on by default in a future release.
8
88
  - Adds support for enriching application logs written to disk or standard out. This can be used with another log forwarder to power Telemetry-in-Context if in-agent log forwarding is not desired. We recommend enabling either log forwarding or local log decorating, but not both features. This is disabled by default in this release.
9
89
  - Improves speed and Resque support for logging metrics which shows the rate of log message by severity in the Logs chart in the APM Summary view. This is enabled by default in this release.
10
90
 
11
- To learn more about Telemetry-in-Context and the configuration options please see the documentation [here](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/).
91
+ To learn more about Telemetry-in-Context and the configuration options please see the documentation [here](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/).
12
92
 
13
93
  * **Improve the usage of the 'hostname' executable and other executables**
14
94
 
@@ -25,7 +105,7 @@
25
105
  * **Bugfix: Curb - satify method_with_tracing's verb argument requirement**
26
106
 
27
107
  When Curb instrumentation is used (either via prepend or chain), be sure to always pass the verb argument over to `method_with_tracing` which requires it. Thank you to @knarewski for bringing this issue to our attention, for providing a means of reproducing an error, and for providing a fix. That fix has been replicated by the agent team with permission. See [Issue 1033](https://github.com/newrelic/newrelic-ruby-agent/issues/1033) for more details.
28
-
108
+
29
109
 
30
110
  ## v8.5.0
31
111
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
1
+ [![Blue banner - Community Plus: This code is currently maintained by New Relic engineering teams and delivered here in GitHub. See the README for troubleshooting and defect reporting instructions.](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)
2
2
 
3
3
  # New Relic Ruby Agent
4
4
 
data/Rakefile CHANGED
@@ -65,7 +65,7 @@ task :record_build, [:build_number, :stage] do |t, args|
65
65
  build_string = args.build_number
66
66
  build_string << ".#{args.stage}" unless args.stage.nil? || args.stage.empty?
67
67
 
68
- gitsha = File.exists?(".git") ? `git rev-parse HEAD` : "Unknown"
68
+ gitsha = File.exist?(".git") ? `git rev-parse HEAD` : "Unknown"
69
69
  gitsha.chomp!
70
70
 
71
71
  File.open("lib/new_relic/build.rb", "w") do |f|
data/docker-compose.yml CHANGED
@@ -53,7 +53,7 @@ services:
53
53
  build:
54
54
  context: .
55
55
  args:
56
- - ruby_version=${RUBY_VERSION}
56
+ - ruby_version=${RUBY_VERSION:-3.1}
57
57
  image: newrelic_rpm
58
58
  tty: true
59
59
  stdin_open: true
@@ -9,6 +9,7 @@ require 'logger'
9
9
  require 'zlib'
10
10
  require 'stringio'
11
11
  require 'new_relic/constants'
12
+ require 'new_relic/traced_thread'
12
13
  require 'new_relic/coerce'
13
14
  require 'new_relic/agent/autostart'
14
15
  require 'new_relic/agent/harvester'
@@ -459,6 +460,7 @@ module NewRelic
459
460
  # requests, we need to wait until the children are forked
460
461
  # before connecting, otherwise the parent process sends useless data
461
462
  def using_forking_dispatcher?
463
+ # TODO: MAJOR VERSION - remove :rainbows
462
464
  if [:puma, :passenger, :rainbows, :unicorn].include? Agent.config[:dispatcher]
463
465
  ::NewRelic::Agent.logger.info "Deferring startup of agent reporting thread because #{Agent.config[:dispatcher]} may fork."
464
466
  true
@@ -608,7 +610,7 @@ module NewRelic
608
610
  :"#{interval}_second_harvest"
609
611
  end
610
612
 
611
- ANALYTIC_EVENT_DATA = "analytic_event_data".freeze
613
+ TRANSACTION_EVENT_DATA = "transaction_event_data".freeze
612
614
  CUSTOM_EVENT_DATA = "custom_event_data".freeze
613
615
  ERROR_EVENT_DATA = "error_event_data".freeze
614
616
  SPAN_EVENT_DATA = "span_event_data".freeze
@@ -623,7 +625,7 @@ module NewRelic
623
625
  transmit_data
624
626
  end
625
627
 
626
- @event_loop.on(interval_for ANALYTIC_EVENT_DATA) do
628
+ @event_loop.on(interval_for TRANSACTION_EVENT_DATA) do
627
629
  transmit_analytic_event_data
628
630
  end
629
631
  @event_loop.on(interval_for CUSTOM_EVENT_DATA) do
@@ -638,6 +640,7 @@ module NewRelic
638
640
  @event_loop.on(interval_for LOG_EVENT_DATA) do
639
641
  transmit_log_event_data
640
642
  end
643
+
641
644
  @event_loop.on(:reset_log_once_keys) do
642
645
  ::NewRelic::Agent.logger.clear_already_logged
643
646
  end
@@ -31,10 +31,19 @@ module NewRelic
31
31
  COMMA = ",".freeze
32
32
 
33
33
  def denylisted_constants?
34
- constants = NewRelic::Agent.config[:'autostart.denylisted_constants']
35
-
36
- denylisted?(constants) do |name|
37
- constant_is_defined?(name)
34
+ denylisted?(NewRelic::Agent.config[:'autostart.denylisted_constants']) do |name|
35
+ if RUBY_PLATFORM.eql?('java')
36
+ # As of JRuby 9.3.4.0, Object.const_defined? will still cross
37
+ # namespaces to find constants, which is not what we want. This
38
+ # behavior is similar to CRuby's Object.const_get prior to v2.6.
39
+ #
40
+ # Example:
41
+ # irb> class MyClass; end; module MyModule; end
42
+ # irb> Object.const_defined?('MyModule::MyClass') # => true
43
+ !!::NewRelic::LanguageSupport.constantize(name)
44
+ else
45
+ Object.const_defined?(name)
46
+ end
38
47
  end
39
48
  end
40
49
 
@@ -44,12 +53,6 @@ module NewRelic
44
53
  end
45
54
  end
46
55
 
47
- # Lookup whether namespaced constants (e.g. ::Foo::Bar::Baz) are in the
48
- # environment.
49
- def constant_is_defined?(const_name)
50
- !!::NewRelic::LanguageSupport.constantize(const_name)
51
- end
52
-
53
56
  def denylisted?(value, &block)
54
57
  value.split(/\s*,\s*/).any?(&block)
55
58
  end