newrelic_rpm 6.4.0.356 → 6.5.0.357

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: 5b076c28227c61e989c31bb41023266f4319602621a913cc403e224d7e5c5822
4
- data.tar.gz: '06062208e9ca3921d1d3353ea91dcc84423747496f6744b617053e98d8488a83'
3
+ metadata.gz: bbc5cbd5b82f24318783bd0178088b454edea1138a4e53ec5f2a046a69a402f9
4
+ data.tar.gz: e1b6f23c1f0d019849d8cf690ed3330a858730480bfc18950ce2fb94ec95ff01
5
5
  SHA512:
6
- metadata.gz: f5ab26028a95f4bb69d6ae882733b0796f0e547cae5a0c276413b0c8daf701eed0697a67b4ad87e64c43e9d1359af37dc9a187f41d59cb2e24caa8b6bbd25afe
7
- data.tar.gz: d67d418c31585f72e05173c10c858a649ca5f6615dfc80cdfaa25fee451055cf20430aac5602c4553468c7ff5018675b734902674a83a44be27f4e54c077df6c
6
+ metadata.gz: 7a9709ff031838e7b6faa3fc256dc9fe6a6d8ea0f5124f6d5380465ab4b8d190fa60705b61e8ca5b3b258951b0b2de002b5c0cf4f681b69a54b72dd397dee160
7
+ data.tar.gz: 40b244372a8ca4f3e6cd8d1886c67fe0af51ad159f5a11cd4bfaf72dccde081959752591135c363b5025bd3ade78c6bf4e69ed7e954917a9f22f85f2142d7bd0
@@ -1,5 +1,34 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v6.5.0
4
+
5
+ * **Change to default setting for ActiveRecord connection resolution**
6
+
7
+ Due to incompatibilities between the faster ActiveRecord connection resolution
8
+ released in v6.3.0 of the agent and other gems which patch ActiveRecord,
9
+ `backport_fast_active_record_connection_lookup` will now be set to `false` by default.
10
+ Because it results in a significant performance improvement, we recommend customers
11
+ whose environments include ActiveRecord change this setting to `true`
12
+ _unless_ they are using other gems which measure ActiveRecord performance, which may
13
+ lose functionality when combined with this setting. If unsure whether to enable
14
+ `backport_fast_active_record_connection_lookup`, we recommend enabling it in a
15
+ development environment to make sure other gems which patch ActiveRecord are still
16
+ working as expected.
17
+
18
+ * **Bugfix for ActiveStorage instrumentation error**
19
+
20
+ Version 6.4.0 of the agent introduced a bug that interfered with ActiveStorage
21
+ callbacks, resulting in the agent being unable to instrument ActiveStorage operations.
22
+ ActiveStorage segments are now correctly recorded.
23
+
24
+ * **Bugfix for ActiveRecord 4.1 and 4.2 exception logging**
25
+
26
+ Version 6.3.0 of the agent introduced a bug that prevented ActiveRecord versions 4.1
27
+ and 4.2 from logging exceptions that occurred within a database transaction. This
28
+ version of the agent restores the exception logging functionality from previous agent
29
+ versions.
30
+ Thanks to Oleksiy Kovyrin for the contribution!
31
+
3
32
  ## v6.4.0
4
33
 
5
34
  * **Custom Metadata Collection**
@@ -763,11 +763,20 @@ module NewRelic
763
763
  Agent.config[:send_environment_info] ? Array(EnvironmentReport.new) : []
764
764
  end
765
765
 
766
+ # Constructs and memoizes an event_harvest_config hash to be used in
767
+ # the payload sent during connect (and reconnect)
768
+ def event_harvest_config
769
+ @event_harvest_config ||= Configuration::EventHarvestConfig.from_config(Agent.config)
770
+ end
771
+
766
772
  # Builds the payload to send to the connect service,
767
773
  # connects, then configures the agent using the response from
768
774
  # the connect service
769
775
  def connect_to_server
770
- request_builder = ::NewRelic::Agent::Connect::RequestBuilder.new(@service, Agent.config)
776
+ request_builder = ::NewRelic::Agent::Connect::RequestBuilder.new \
777
+ @service,
778
+ Agent.config,
779
+ event_harvest_config
771
780
  connect_response = @service.connect request_builder.connect_payload
772
781
 
773
782
  response_handler = ::NewRelic::Agent::Connect::ResponseHandler.new(self, Agent.config)
@@ -1222,11 +1222,11 @@ module NewRelic
1222
1222
  :description => 'Controls whether to normalize string encodings prior to serializing data for the collector to JSON.'
1223
1223
  },
1224
1224
  :backport_fast_active_record_connection_lookup => {
1225
- :default => true,
1225
+ :default => false,
1226
1226
  :public => false,
1227
1227
  :type => Boolean,
1228
1228
  :allowed_from_server => false,
1229
- :description => 'Enables patching of "sql.active_record" AS Notification to include :connection in payload.'
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
1230
  },
1231
1231
  :disable_vm_sampler => {
1232
1232
  :default => false,
@@ -5,32 +5,32 @@
5
5
  module NewRelic
6
6
  module Agent
7
7
  module Configuration
8
- module EventData
8
+ module EventHarvestConfig
9
9
 
10
10
  extend self
11
11
 
12
- EVENT_DATA_CONFIG_KEY_MAPPING = {
12
+ EVENT_HARVEST_CONFIG_KEY_MAPPING = {
13
13
  :analytic_event_data => :'analytics_events.max_samples_stored',
14
14
  :custom_event_data => :'custom_insights_events.max_samples_stored',
15
15
  :error_event_data => :'error_collector.max_event_samples_stored'
16
16
  }
17
17
 
18
18
  def from_config(config)
19
- {:harvest_limits => EVENT_DATA_CONFIG_KEY_MAPPING.inject({}) do
20
- |event_data, (event_data_key, config_key)|
21
- event_data[event_data_key] = config[config_key]
22
- event_data
19
+ {:harvest_limits => EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do
20
+ |connect_payload, (connect_payload_key, config_key)|
21
+ connect_payload[connect_payload_key] = config[config_key]
22
+ connect_payload
23
23
  end
24
24
  }
25
25
  end
26
26
 
27
27
  def to_config_hash(connect_reply)
28
- config_hash = EVENT_DATA_CONFIG_KEY_MAPPING.inject({}) do
29
- |event_data, (event_data_key, config_key)|
30
- event_data[config_key] = connect_reply['event_data']['harvest_limits'][event_data_key.to_s]
31
- event_data
28
+ config_hash = EVENT_HARVEST_CONFIG_KEY_MAPPING.inject({}) do
29
+ |event_harvest_config, (connect_payload_key, config_key)|
30
+ event_harvest_config[config_key] = connect_reply['event_harvest_config']['harvest_limits'][connect_payload_key.to_s]
31
+ event_harvest_config
32
32
  end
33
- config_hash[:event_report_period] = connect_reply['event_data']['report_period_ms'] / 1000
33
+ config_hash[:event_report_period] = connect_reply['event_harvest_config']['report_period_ms'] / 1000
34
34
  config_hash
35
35
  end
36
36
  end
@@ -38,7 +38,7 @@ module NewRelic
38
38
  merge_top_level_keys(merged_settings, connect_reply)
39
39
  merge_agent_config_hash(merged_settings, connect_reply)
40
40
  fix_transaction_threshold(merged_settings)
41
- add_event_data(merged_settings, connect_reply)
41
+ add_event_harvest_config(merged_settings, connect_reply)
42
42
  filter_keys(merged_settings)
43
43
 
44
44
  apply_feature_gates(merged_settings, connect_reply, existing_config)
@@ -74,14 +74,37 @@ module NewRelic
74
74
  end
75
75
  end
76
76
 
77
- def add_event_data(merged_settings, connect_reply)
78
- if connect_reply['event_data']
79
- merged_settings.merge! EventData.to_config_hash(connect_reply)
80
- else
81
- NewRelic::Agent.logger.warn "No event data configuration found " \
82
- "in connect response; using default event report period."
83
- NewRelic::Agent.record_metric('Supportability/Agent/Collector/MissingEventData', 1)
84
- end
77
+ EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES = {
78
+ :'analytics_events.max_samples_stored' => 'Supportability/EventHarvest/AnalyticEventData/HarvestLimit',
79
+ :'custom_insights_events.max_samples_stored' => 'Supportability/EventHarvest/CustomEventData/HarvestLimit',
80
+ :'error_collector.max_event_samples_stored'=> 'Supportability/EventHarvest/ErrorEventData/HarvestLimit',
81
+ :event_report_period => 'Supportability/EventHarvest/ReportPeriod'
82
+ }
83
+
84
+ def add_event_harvest_config(merged_settings, connect_reply)
85
+ return unless event_harvest_config_is_valid connect_reply
86
+
87
+ event_harvest_config = EventHarvestConfig.to_config_hash(connect_reply)
88
+ EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES.each do |config_key, metric_name|
89
+ NewRelic::Agent.record_metric metric_name, event_harvest_config[config_key]
90
+ end
91
+
92
+ merged_settings.merge! event_harvest_config
93
+ end
94
+
95
+ def event_harvest_config_is_valid connect_reply
96
+ event_harvest_config = connect_reply['event_harvest_config']
97
+
98
+ if event_harvest_config.nil? \
99
+ || event_harvest_config['harvest_limits'].values.min < 0 \
100
+ || (event_harvest_config['report_period_ms'] / 1000) <= 0
101
+ NewRelic::Agent.logger.warn "Invalid event harvest config found " \
102
+ "in connect response; using default event report period."
103
+ NewRelic::Agent.record_metric('Supportability/Agent/Collector/MissingEventHarvestConfig', 1)
104
+ false
105
+ else
106
+ true
107
+ end
85
108
  end
86
109
 
87
110
  def filter_keys(merged_settings)
@@ -3,7 +3,7 @@
3
3
  # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
4
 
5
5
  require 'new_relic/environment_report'
6
- require 'new_relic/agent/configuration/event_data'
6
+ require 'new_relic/agent/configuration/event_harvest_config'
7
7
 
8
8
  module NewRelic
9
9
  module Agent
@@ -11,9 +11,10 @@ module NewRelic
11
11
 
12
12
  class RequestBuilder
13
13
 
14
- def initialize(new_relic_service, config)
14
+ def initialize(new_relic_service, config, event_harvest_config)
15
15
  @service = new_relic_service
16
16
  @config = config
17
+ @event_harvest_config = event_harvest_config
17
18
  end
18
19
 
19
20
 
@@ -34,7 +35,7 @@ module NewRelic
34
35
  :high_security => Agent.config[:high_security],
35
36
  :utilization => UtilizationData.new.to_collector_hash,
36
37
  :identifier => "ruby:#{local_host}:#{Agent.config.app_names.sort.join(',')}",
37
- :event_data => Configuration::EventData.from_config(Agent.config)
38
+ :event_harvest_config => @event_harvest_config
38
39
  }
39
40
  end
40
41
 
@@ -13,18 +13,13 @@ module NewRelic
13
13
  module Agent
14
14
  module Instrumentation
15
15
  module ActiveRecordNotifications
16
- module BaseExtensions41
17
- def self.included(base)
18
- base.class_eval do
19
- alias_method :log_without_performance_improvement, :log
20
- alias_method :log, :log_with_performance_improvement
21
- end
22
- end
16
+ SQL_ACTIVE_RECORD = 'sql.active_record'.freeze
23
17
 
18
+ module BaseExtensions4x
24
19
  # https://github.com/rails/rails/blob/4-1-stable/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L371
25
- def log_with_performance_improvement(sql, name = "SQL", binds = [], statement_name = nil)
20
+ def log(sql, name = "SQL", binds = [], statement_name = nil)
26
21
  @instrumenter.instrument(
27
- "sql.active_record",
22
+ SQL_ACTIVE_RECORD,
28
23
  :sql => sql,
29
24
  :name => name,
30
25
  :connection_id => object_id,
@@ -32,22 +27,20 @@ module NewRelic
32
27
  :statement_name => statement_name,
33
28
  :binds => binds) { yield }
34
29
  rescue => e
35
- raise translate_exception(e, sql)
30
+ # The translate_exception_class method got introduced in 4.1
31
+ if ::ActiveRecord::VERSION::MINOR == 0
32
+ raise translate_exception(e, sql)
33
+ else
34
+ raise translate_exception_class(e, sql)
35
+ end
36
36
  end
37
37
  end
38
38
 
39
39
  module BaseExtensions50
40
- def self.included(base)
41
- base.class_eval do
42
- alias_method :log_without_performance_improvement, :log
43
- alias_method :log, :log_with_performance_improvement
44
- end
45
- end
46
-
47
40
  # https://github.com/rails/rails/blob/5-0-stable/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L582
48
- def log_with_performance_improvement(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil)
41
+ def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil)
49
42
  @instrumenter.instrument(
50
- "sql.active_record",
43
+ SQL_ACTIVE_RECORD,
51
44
  sql: sql,
52
45
  name: name,
53
46
  binds: binds,
@@ -61,17 +54,10 @@ module NewRelic
61
54
  end
62
55
 
63
56
  module BaseExtensions51
64
- def self.included(base)
65
- base.class_eval do
66
- alias_method :log_without_performance_improvement, :log
67
- alias_method :log, :log_with_performance_improvement
68
- end
69
- end
70
-
71
57
  # https://github.com/rails/rails/blob/5-1-stable/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L603
72
- def log_with_performance_improvement(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) # :doc:
58
+ def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) # :doc:
73
59
  @instrumenter.instrument(
74
- "sql.active_record",
60
+ SQL_ACTIVE_RECORD,
75
61
  sql: sql,
76
62
  name: name,
77
63
  binds: binds,
@@ -154,19 +140,19 @@ DependencyDetection.defer do
154
140
 
155
141
  executes do
156
142
  if NewRelic::Agent.config[:backport_fast_active_record_connection_lookup]
157
-
158
- activerecord_extension = if ::ActiveRecord::VERSION::MAJOR.to_i == 4
159
- ::NewRelic::Agent::Instrumentation::ActiveRecordNotifications::BaseExtensions41
160
- elsif ::ActiveRecord::VERSION::MAJOR.to_i == 5
161
- if ::ActiveRecord::VERSION::MINOR.to_i == 0
162
- ::NewRelic::Agent::Instrumentation::ActiveRecordNotifications::BaseExtensions50
163
- elsif ::ActiveRecord::VERSION::MINOR.to_i >= 1
164
- ::NewRelic::Agent::Instrumentation::ActiveRecordNotifications::BaseExtensions51
165
- end
143
+ major_version = ::ActiveRecord::VERSION::MAJOR.to_i
144
+ minor_version = ::ActiveRecord::VERSION::MINOR.to_i
145
+
146
+ activerecord_extension = if major_version == 4
147
+ ::NewRelic::Agent::Instrumentation::ActiveRecordNotifications::BaseExtensions4x
148
+ elsif major_version == 5 && minor_version == 0
149
+ ::NewRelic::Agent::Instrumentation::ActiveRecordNotifications::BaseExtensions50
150
+ elsif major_version == 5 && minor_version == 1
151
+ ::NewRelic::Agent::Instrumentation::ActiveRecordNotifications::BaseExtensions51
166
152
  end
167
153
 
168
154
  unless activerecord_extension.nil?
169
- ::ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:include, activerecord_extension)
155
+ ::ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:prepend, activerecord_extension)
170
156
  end
171
157
  end
172
158
  end
@@ -25,11 +25,11 @@ module NewRelic
25
25
  segment = Tracer.start_segment name: metric_name(name, payload)
26
26
  segment.params[:key] = payload[:key]
27
27
  segment.params[:exist] = payload[:exist] if payload.key? :exist
28
- event_stack[id].push segment
28
+ push_segment id, segment
29
29
  end
30
30
 
31
31
  def finish_segment id
32
- segment = event_stack[id].pop
32
+ segment = pop_segment id
33
33
  segment.finish if segment
34
34
  end
35
35
 
@@ -22,6 +22,8 @@ module NewRelic
22
22
  def append(priority: nil, event: nil, &blk)
23
23
  increment_seen
24
24
 
25
+ return if @capacity == 0
26
+
25
27
  if @seen == @capacity
26
28
  @items = Heap.new(@items) { |x| priority_for(x) }
27
29
  end
@@ -11,7 +11,7 @@ module NewRelic
11
11
  end
12
12
 
13
13
  MAJOR = 6
14
- MINOR = 4
14
+ MINOR = 5
15
15
  TINY = 0
16
16
 
17
17
  begin
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.4.0.356
4
+ version: 6.5.0.357
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-05-21 00:00:00.000000000 Z
14
+ date: 2019-06-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -182,7 +182,7 @@ files:
182
182
  - lib/new_relic/agent/configuration/default_source.rb
183
183
  - lib/new_relic/agent/configuration/dotted_hash.rb
184
184
  - lib/new_relic/agent/configuration/environment_source.rb
185
- - lib/new_relic/agent/configuration/event_data.rb
185
+ - lib/new_relic/agent/configuration/event_harvest_config.rb
186
186
  - lib/new_relic/agent/configuration/high_security_source.rb
187
187
  - lib/new_relic/agent/configuration/manager.rb
188
188
  - lib/new_relic/agent/configuration/manual_source.rb