newrelic_rpm 6.5.0.357 → 6.6.0.358

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbc5cbd5b82f24318783bd0178088b454edea1138a4e53ec5f2a046a69a402f9
4
- data.tar.gz: e1b6f23c1f0d019849d8cf690ed3330a858730480bfc18950ce2fb94ec95ff01
3
+ metadata.gz: 6d39324de06656b928892edc72296e459eb2737929e20f054514c2ddc980bfb0
4
+ data.tar.gz: 3752b1d5dbcd79b38a808460c68141926ae627f0c50ec8cc6ded103285719844
5
5
  SHA512:
6
- metadata.gz: 7a9709ff031838e7b6faa3fc256dc9fe6a6d8ea0f5124f6d5380465ab4b8d190fa60705b61e8ca5b3b258951b0b2de002b5c0cf4f681b69a54b72dd397dee160
7
- data.tar.gz: 40b244372a8ca4f3e6cd8d1886c67fe0af51ad159f5a11cd4bfaf72dccde081959752591135c363b5025bd3ade78c6bf4e69ed7e954917a9f22f85f2142d7bd0
6
+ metadata.gz: 6f277cc9660dde4ef818de176ad156202ad1993594416882e678b31786386f547b200a96444be1a84bfa53e8385700f07b837d3c500a1e8529d2e4c5d9bbf3ab
7
+ data.tar.gz: 258bd06b3feaf43c29e8007a6d97003d2d7879b719fc818ba1a374a2167f336f1b4b4352b31d938af24afb0c917751649e62eddaaab41a7955ef55e10f56e84d
@@ -1,5 +1,26 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v6.6.0
4
+
5
+ * **Bugfix for ActionCable Instrumentation**
6
+
7
+ Previous versions of the agent sometimes caused application crashes with some versions
8
+ of ActionCable. The application would exit quickly after startup with the error:
9
+ `uninitialized constant ActionCable::Engine`.
10
+
11
+ Version 6.6.0 of the agent no longer crashes in this way.
12
+
13
+
14
+ * **Handling of disabling Error Collection**
15
+
16
+ When the agent first starts, it begins collecting Error Events and Traces before
17
+ fetching configuration from New Relic. In previous versions of the agent, those
18
+ events or traces would be sent to New Relic, even if _Error Collection_ is disabled in
19
+ the application's server-side configuration.
20
+
21
+ Version 6.6.0 of the agent drops all collected Error Events and Traces if the
22
+ configuration from the server disables _Error Collection_.
23
+
3
24
  ## v6.5.0
4
25
 
5
26
  * **Change to default setting for ActiveRecord connection resolution**
@@ -59,7 +59,7 @@ module NewRelic
59
59
  @cross_app_monitor = NewRelic::Agent::CrossAppMonitor.new(@events)
60
60
  @distributed_trace_monitor = NewRelic::Agent::DistributedTraceMonitor.new(@events)
61
61
  @synthetics_monitor = NewRelic::Agent::SyntheticsMonitor.new(@events)
62
- @error_collector = NewRelic::Agent::ErrorCollector.new
62
+ @error_collector = NewRelic::Agent::ErrorCollector.new @events
63
63
  @transaction_rules = NewRelic::Agent::RulesEngine.new
64
64
  @harvest_samplers = NewRelic::Agent::SamplerCollection.new(@events)
65
65
  @monotonic_gc_profiler = NewRelic::Agent::VM::MonotonicGCProfiler.new
@@ -70,9 +70,9 @@ module NewRelic
70
70
  @harvester = NewRelic::Agent::Harvester.new(@events)
71
71
  @after_fork_lock = Mutex.new
72
72
 
73
- @transaction_event_recorder = NewRelic::Agent::TransactionEventRecorder.new
74
- @custom_event_aggregator = NewRelic::Agent::CustomEventAggregator.new
75
- @span_event_aggregator = NewRelic::Agent::SpanEventAggregator.new
73
+ @transaction_event_recorder = NewRelic::Agent::TransactionEventRecorder.new @events
74
+ @custom_event_aggregator = NewRelic::Agent::CustomEventAggregator.new @events
75
+ @span_event_aggregator = NewRelic::Agent::SpanEventAggregator.new @events
76
76
 
77
77
  @connect_state = :pending
78
78
  @connect_attempts = 0
@@ -88,7 +88,7 @@ module NewRelic
88
88
  def setup_attribute_filter
89
89
  refresh_attribute_filter
90
90
 
91
- @events.subscribe(:finished_configuring) do
91
+ @events.subscribe(:initial_configuration_complete) do
92
92
  refresh_attribute_filter
93
93
  end
94
94
  end
@@ -531,7 +531,7 @@ module NewRelic
531
531
  check_config_and_start_agent
532
532
  log_version_and_pid
533
533
 
534
- events.subscribe(:finished_configuring) do
534
+ events.subscribe(:initial_configuration_complete) do
535
535
  log_ignore_url_regexes
536
536
  end
537
537
  end
@@ -1017,6 +1017,7 @@ module NewRelic
1017
1017
  :public => true,
1018
1018
  :type => Boolean,
1019
1019
  :allowed_from_server => true,
1020
+ :dynamic_name => true,
1020
1021
  :description => 'If <code>true</code>, the agent collects <a href="https://docs.newrelic.com/docs/insights/new-relic-insights/decorating-events/error-event-default-attributes-insights">TransactionError events</a>.'
1021
1022
  },
1022
1023
  :'error_collector.max_event_samples_stored' => {
@@ -1223,10 +1224,10 @@ module NewRelic
1223
1224
  },
1224
1225
  :backport_fast_active_record_connection_lookup => {
1225
1226
  :default => false,
1226
- :public => false,
1227
+ :public => true,
1227
1228
  :type => Boolean,
1228
1229
  :allowed_from_server => false,
1229
- :description => 'Enables patching of "sql.active_record" AS Notification to include :connection in payload. Note that this setting may not be compatible with other gems that patch ActiveRecord.'
1230
+ :description => 'Backports the faster ActiveRecord connection lookup introduced in Rails 6, which improves agent performance when instrumenting ActiveRecord. Note that this setting may not be compatible with other gems that patch ActiveRecord.'
1230
1231
  },
1231
1232
  :disable_vm_sampler => {
1232
1233
  :default => false,
@@ -1804,14 +1805,14 @@ module NewRelic
1804
1805
  },
1805
1806
  :'span_events.enabled' => {
1806
1807
  :default => true,
1807
- :public => false,
1808
+ :public => true,
1808
1809
  :type => Boolean,
1809
1810
  :allowed_from_server => true,
1810
1811
  :description => 'If <code>true</code>, enables span event sampling.'
1811
1812
  },
1812
1813
  :'span_events.max_samples_stored' => {
1813
1814
  :default => 1000,
1814
- :public => false,
1815
+ :public => true,
1815
1816
  :type => Integer,
1816
1817
  :allowed_from_server => true,
1817
1818
  :description => 'Defines the maximum number of span events reported from a single harvest.'
@@ -95,6 +95,7 @@ module NewRelic
95
95
  reset_cache
96
96
  log_config(:add, source)
97
97
 
98
+ notify_server_source_added if ServerSource === source
98
99
  notify_finished_configuring if !was_finished && finished_configuring?
99
100
  end
100
101
 
@@ -171,8 +172,19 @@ module NewRelic
171
172
  end
172
173
  end
173
174
 
175
+ # This event is intended to be fired every time the server source is
176
+ # applied. This happens after the agent's initial connect, and again
177
+ # on every forced reconnect.
178
+ def notify_server_source_added
179
+ NewRelic::Agent.instance.events.notify(:server_source_configuration_added)
180
+ end
181
+
182
+ # This event is intended to be fired once during the entire lifespan of
183
+ # an agent run, after the server source has been applied for the first
184
+ # time. This should indicate that all configuration has been applied,
185
+ # and the main functions of the agent are safe to start.
174
186
  def notify_finished_configuring
175
- NewRelic::Agent.instance.events.notify(:finished_configuring)
187
+ NewRelic::Agent.instance.events.notify(:initial_configuration_complete)
176
188
  end
177
189
 
178
190
  def finished_configuring?
@@ -35,7 +35,7 @@ module NewRelic
35
35
  @agent.stats_engine.metric_rules = RulesEngine.create_metric_rules(config_data)
36
36
 
37
37
  # If you're adding something else here to respond to the server-side config,
38
- # use Agent.instance.events.subscribe(:finished_configuring) callback instead!
38
+ # use Agent.instance.events.subscribe(:initial_configuration_complete) callback instead!
39
39
  end
40
40
 
41
41
  def add_server_side_config(config_data)
@@ -18,9 +18,9 @@ module NewRelic
18
18
  attr_reader :error_trace_aggregator, :error_event_aggregator
19
19
 
20
20
  # Returns a new error collector
21
- def initialize
21
+ def initialize events
22
22
  @error_trace_aggregator = ErrorTraceAggregator.new(MAX_ERROR_QUEUE_LENGTH)
23
- @error_event_aggregator = ErrorEventAggregator.new
23
+ @error_event_aggregator = ErrorEventAggregator.new events
24
24
 
25
25
  # lookup of exception class names to ignore. Hash for fast access
26
26
  @ignore = {}
@@ -13,7 +13,8 @@ module NewRelic
13
13
 
14
14
  named :ErrorEventAggregator
15
15
  capacity_key :'error_collector.max_event_samples_stored'
16
- enabled_key :'error_collector.capture_events'
16
+ enabled_keys :'error_collector.enabled',
17
+ :'error_collector.capture_events'
17
18
  buffer_class PrioritySampledBuffer
18
19
 
19
20
  def record noticed_error, transaction_payload = nil
@@ -91,6 +91,7 @@ module NewRelic
91
91
 
92
92
  def register_config_callbacks
93
93
  Agent.config.register_callback(:'error_collector.enabled') do |enabled|
94
+ reset! if enabled == false
94
95
  ::NewRelic::Agent.logger.debug "Error traces will #{enabled ? '' : 'not '}be sent to the New Relic service."
95
96
  end
96
97
  end
@@ -8,20 +8,6 @@ module NewRelic
8
8
  module Agent
9
9
  class EventAggregator
10
10
  class << self
11
- # This architecture requires that every aggregator
12
- # implementation provide its own `named`, `capacity_key`, and
13
- # `enabled_...` settings. In particular, we do not allow
14
- # subclasses to share these values from an intermediate
15
- # superclass.
16
-
17
- def inherited(subclass)
18
- # Prevent uninitialized variable warnings; we have to do
19
- # this as soon as the subclass is defined, before its
20
- # implementor calls enabled_key() or enabled_fn().
21
- subclass.instance_variable_set(:@enabled_key, nil)
22
- subclass.instance_variable_set(:@enabled_fn, nil)
23
- end
24
-
25
11
  def named named = nil
26
12
  named ? @named = named.to_s.freeze : @named
27
13
  end
@@ -30,10 +16,25 @@ module NewRelic
30
16
  key ? @capacity_key = key : @capacity_key
31
17
  end
32
18
 
33
- def enabled_key key = nil
34
- key ? @enabled_key = key : @enabled_key
19
+ # An aggregator can specify one or more keys to check to see if it is
20
+ # enabled. Multiple keys will be &&'d and the enabled status of the
21
+ # aggregator will be reset when agent configuration changes.
22
+
23
+ def enabled_keys *keys
24
+ if keys.empty?
25
+ @enabled_keys ||= []
26
+ else
27
+ @enabled_keys = Array(keys)
28
+ @enabled_fn = ->(){ @enabled_keys.all? { |k| Agent.config[k] } }
29
+ end
35
30
  end
36
31
 
32
+ alias_method :enabled_key, :enabled_keys
33
+
34
+ # This can be used instead of `enabled_key(s)` for more fine grained
35
+ # control over whether an aggregator should be enabled. The enabled fn
36
+ # will be reevaluated after configuration changes
37
+
37
38
  def enabled_fn fn = nil
38
39
  fn ? @enabled_fn = fn : @enabled_fn
39
40
  end
@@ -47,13 +48,13 @@ module NewRelic
47
48
  end
48
49
  end
49
50
 
50
- def initialize
51
+ def initialize events
51
52
  @lock = Mutex.new
52
53
  @buffer = self.class.buffer_class.new NewRelic::Agent.config[self.class.capacity_key]
53
- @enabled = false
54
+ @enabled = self.class.enabled_fn ? self.class.enabled_fn.call : false
54
55
  @notified_full = false
55
56
  register_capacity_callback
56
- register_enabled_callback
57
+ register_enabled_callback events
57
58
  after_initialize
58
59
  end
59
60
 
@@ -66,7 +67,6 @@ module NewRelic
66
67
  end
67
68
 
68
69
  def enabled?
69
- return self.class.enabled_fn.call if self.class.enabled_fn
70
70
  @enabled
71
71
  end
72
72
 
@@ -126,18 +126,12 @@ module NewRelic
126
126
  end
127
127
  end
128
128
 
129
- def register_enabled_callback
130
- unless self.class.enabled_key || self.class.enabled_fn
131
- ::NewRelic::Agent.logger.warn "#{self.class.named} needs an enabled_key or an enabled_fn."
132
- end
133
-
134
- return if self.class.enabled_fn
135
-
136
- NewRelic::Agent.config.register_callback(self.class.enabled_key) do |enabled|
137
- # intentionally unsynchronized for liveness
138
- @enabled = enabled
139
- ::NewRelic::Agent.logger.debug "#{self.class.named} will #{enabled ? '' : 'not '}be sent to the New Relic service."
140
- end
129
+ def register_enabled_callback events
130
+ events.subscribe(:server_source_configuration_added) {
131
+ @enabled = self.class.enabled_fn.call
132
+ reset! if @enabled == false
133
+ ::NewRelic::Agent.logger.debug "#{self.class.named} will #{@enabled ? '' : 'not '}be sent to the New Relic service."
134
+ }
141
135
  end
142
136
 
143
137
  def notify_if_full
@@ -20,8 +20,8 @@ module NewRelic
20
20
  attr_reader :obfuscator
21
21
 
22
22
  def initialize(events)
23
- events.subscribe(:finished_configuring) do
24
- # This requires :encoding_key, so must wait until :finished_configuring
23
+ events.subscribe(:initial_configuration_complete) do
24
+ # This requires :encoding_key, so must wait until :initial_configuration_complete
25
25
  setup_obfuscator
26
26
  on_finished_configuring(events)
27
27
  end
@@ -28,9 +28,8 @@ DependencyDetection.defer do
28
28
  NewRelic::Agent::Instrumentation::ActionCableSubscriber.new)
29
29
 
30
30
  ActiveSupport.on_load(:action_cable) do
31
- ::NewRelic::Agent::PrependSupportability.record_metrics_for(
32
- ::ActionCable::Engine,
33
- ::ActionCable::RemoteConnections)
31
+ ::NewRelic::Agent::PrependSupportability.record_metrics_for(::ActionCable::Engine) if defined?(::ActionCable::Engine)
32
+ ::NewRelic::Agent::PrependSupportability.record_metrics_for(::ActionCable::RemoteConnections) if defined?(::ActionCable::RemoteConnections)
34
33
  end
35
34
  end
36
35
  end
@@ -14,7 +14,7 @@ module NewRelic
14
14
  RUM_KEY_LENGTH = 13
15
15
 
16
16
  def initialize(event_listener)
17
- event_listener.subscribe(:finished_configuring, &method(:log_configuration))
17
+ event_listener.subscribe(:initial_configuration_complete, &method(:log_configuration))
18
18
  end
19
19
 
20
20
  def log_configuration
@@ -12,11 +12,8 @@ module NewRelic
12
12
  class SpanEventAggregator < EventAggregator
13
13
  named :SpanEventAggregator
14
14
  capacity_key :'span_events.max_samples_stored'
15
-
16
- enabled_fn -> {
17
- NewRelic::Agent.config[:'span_events.enabled'] &&
18
- NewRelic::Agent.config[:'distributed_tracing.enabled']
19
- }
15
+ enabled_keys :'span_events.enabled',
16
+ :'distributed_tracing.enabled'
20
17
 
21
18
  def record priority: nil, event:nil, &blk
22
19
  unless(event || priority && blk)
@@ -14,9 +14,9 @@ module NewRelic
14
14
  attr_reader :transaction_event_aggregator
15
15
  attr_reader :synthetics_event_aggregator
16
16
 
17
- def initialize
18
- @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new
19
- @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new
17
+ def initialize events
18
+ @transaction_event_aggregator = NewRelic::Agent::TransactionEventAggregator.new events
19
+ @synthetics_event_aggregator = NewRelic::Agent::SyntheticsEventAggregator.new events
20
20
  end
21
21
 
22
22
  def record payload
@@ -11,7 +11,7 @@ module NewRelic
11
11
  end
12
12
 
13
13
  MAJOR = 6
14
- MINOR = 5
14
+ MINOR = 6
15
15
  TINY = 0
16
16
 
17
17
  begin
@@ -452,6 +452,13 @@ def with_config(config_hash, at_start=true)
452
452
  end
453
453
  end
454
454
 
455
+ def with_server_source config_hash, at_start=true
456
+ with_config config_hash, at_start do
457
+ NewRelic::Agent.config.notify_server_source_added
458
+ yield
459
+ end
460
+ end
461
+
455
462
  def with_config_low_priority(config_hash)
456
463
  with_config(config_hash, false) do
457
464
  yield
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.0.357
4
+ version: 6.6.0.358
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Wear
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-06-21 00:00:00.000000000 Z
14
+ date: 2019-08-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake