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
@@ -0,0 +1,24 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ if defined?(Sidekiq::DelayExtensions)
6
+ class Sidekiq::DelayExtensions::GenericJob
7
+ def newrelic_trace_args(msg, queue)
8
+ (target, method_name, *) = ::Sidekiq::DelayExtensions::YAML.unsafe_load(msg['args'][0])
9
+
10
+ if target.is_a?(String)
11
+ target = target.constantize
12
+ end
13
+
14
+ {
15
+ :name => method_name,
16
+ :class_name => target.class.name,
17
+ :category => 'OtherTransaction/SidekiqJob'
18
+ }
19
+ rescue => e
20
+ NewRelic::Agent.logger.error('Failure during deserializing YAML for Sidekiq::DelayExtensions::GenericJob', e)
21
+ NewRelic::Agent::Instrumentation::Sidekiq::Server.default_trace_args(msg)
22
+ end
23
+ end
24
+ end
@@ -5,6 +5,7 @@
5
5
  require_relative 'sidekiq/client'
6
6
  require_relative 'sidekiq/server'
7
7
  require_relative 'sidekiq/extensions/delayed_class'
8
+ require_relative 'sidekiq/extensions/delay_extensions'
8
9
 
9
10
  DependencyDetection.defer do
10
11
  @name = :sidekiq
@@ -29,7 +30,14 @@ DependencyDetection.defer do
29
30
  chain.add(NewRelic::Agent::Instrumentation::Sidekiq::Client)
30
31
  end
31
32
  config.server_middleware do |chain|
32
- chain.add(NewRelic::Agent::Instrumentation::Sidekiq::Server)
33
+ # We started prepending v chaining NR middleware in 9.18.0 in response to:
34
+ # https://github.com/newrelic/newrelic-ruby-agent/issues/3037
35
+ # This way, exceptions resolved by Sidekiq's own middleware are not reported in the agent
36
+ if chain.respond_to?(:prepend)
37
+ chain.prepend(NewRelic::Agent::Instrumentation::Sidekiq::Server)
38
+ else
39
+ chain.add(NewRelic::Agent::Instrumentation::Sidekiq::Server)
40
+ end
33
41
  end
34
42
 
35
43
  if config.respond_to?(:error_handlers)
@@ -455,7 +455,7 @@ module NewRelic
455
455
  end
456
456
 
457
457
  def handle_error_response(response, endpoint)
458
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::HTTP_ERROR, [response.code, endpoint])
458
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::HTTP_ERROR, [response.code, endpoint])
459
459
 
460
460
  case response
461
461
  when Net::HTTPRequestTimeOut,
@@ -641,7 +641,7 @@ module NewRelic
641
641
  response = relay_request(request, opts)
642
642
 
643
643
  if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPAccepted)
644
- NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::HEALTHY)
644
+ NewRelic::Agent.agent&.health_check&.update_status(NewRelic::Agent::HealthCheck::HEALTHY)
645
645
  response
646
646
  else
647
647
  handle_error_response(response, opts[:endpoint])
@@ -0,0 +1,23 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module OpenTelemetry
8
+ module Trace
9
+ class Span < ::OpenTelemetry::Trace::Span
10
+ attr_reader :context
11
+
12
+ def initialize(segment:, transaction:)
13
+ @context = ::OpenTelemetry::Trace::SpanContext.new(
14
+ trace_id: transaction.trace_id,
15
+ span_id: segment.guid,
16
+ trace_flags: 1
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,38 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module OpenTelemetry
8
+ module Trace
9
+ class Tracer < ::OpenTelemetry::Trace::Tracer
10
+ def initialize(name = nil, version = nil)
11
+ @name = name || ''
12
+ @version = version || ''
13
+ end
14
+
15
+ def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
16
+ case kind
17
+ when :internal
18
+ begin
19
+ return yield unless NewRelic::Agent::Tracer.current_transaction
20
+
21
+ segment = NewRelic::Agent::Tracer.start_segment(name: name)
22
+ span = Span.new(segment: segment, transaction: segment.transaction)
23
+
24
+ ::OpenTelemetry::Trace.with_span(span) do
25
+ yield
26
+ end
27
+ ensure
28
+ segment&.finish
29
+ end
30
+ else
31
+ NewRelic::Agent.logger.debug("Span kind: #{kind} is not supported yet")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,18 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module OpenTelemetry
8
+ module Trace
9
+ class TracerProvider < ::OpenTelemetry::Trace::TracerProvider
10
+ # TODO: Add a registration mechanism for tracers like exists in the SDK
11
+ def tracer(name = nil, version = nil)
12
+ @tracer ||= Tracer.new(name, version)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module OpenTelemetry
8
+ module Trace
9
+ require_relative 'trace/tracer_provider'
10
+ require_relative 'trace/tracer'
11
+ require_relative 'trace/span'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ # This file is distributed under New Relic's license terms.
2
+ # See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
3
+ # frozen_string_literal: true
4
+
5
+ module NewRelic
6
+ module Agent
7
+ class OpenTelemetryBridge
8
+ def initialize
9
+ # no-op without OpenTelemetry API & config
10
+ return unless defined?(OpenTelemetry) &&
11
+ NewRelic::Agent.config[:'opentelemetry_bridge.enabled']
12
+
13
+ OpenTelemetryBridge.install
14
+ end
15
+
16
+ private
17
+
18
+ def self.install
19
+ require 'opentelemetry' # requires the opentelemetry-api gem
20
+ require_relative 'opentelemetry/trace'
21
+
22
+ ::OpenTelemetry.tracer_provider = NewRelic::Agent::OpenTelemetry::Trace::TracerProvider.new
23
+ end
24
+ end
25
+ end
26
+ end
@@ -44,6 +44,7 @@ module NewRelic
44
44
  TRUSTED_PARENT_KEY = 'trustedParentId'
45
45
  TRACING_VENDORS_KEY = 'tracingVendors'
46
46
  TRANSACTION_NAME_KEY = 'transaction.name'
47
+ THREAD_ID_KEY = 'thread.id'
47
48
 
48
49
  # Strings for static values of the event structure
49
50
  EVENT_TYPE = 'Span'
@@ -135,7 +136,8 @@ module NewRelic
135
136
  PRIORITY_KEY => segment.transaction.priority,
136
137
  TIMESTAMP_KEY => milliseconds_since_epoch(segment),
137
138
  DURATION_KEY => segment.duration,
138
- NAME_KEY => segment.name
139
+ NAME_KEY => segment.name,
140
+ THREAD_ID_KEY => segment.thread_id
139
141
  }
140
142
 
141
143
  # with infinite-tracing, transactions may or may not be sampled!
@@ -19,7 +19,7 @@ module NewRelic
19
19
  # after its parent. We will use the optimized exclusive duration
20
20
  # calculation in all other cases.
21
21
  #
22
- attr_reader :start_time, :end_time, :duration, :exclusive_duration, :guid, :starting_segment_key
22
+ attr_reader :start_time, :end_time, :duration, :exclusive_duration, :guid, :starting_segment_key, :thread_id
23
23
  attr_accessor :name, :parent, :children_time, :transaction, :transaction_name, :llm_event
24
24
  attr_writer :record_metrics, :record_scoped_metric, :record_on_finish
25
25
  attr_reader :noticed_error
@@ -30,6 +30,7 @@ module NewRelic
30
30
  def initialize(name = nil, start_time = nil)
31
31
  @name = name
32
32
  @starting_segment_key = NewRelic::Agent::Tracer.current_segment_key
33
+ @thread_id = Thread.current.object_id
33
34
  @transaction_name = nil
34
35
  @transaction = nil
35
36
  @guid = NewRelic::Agent::GuidGenerator.generate_guid
@@ -43,12 +43,7 @@ module NewRelic
43
43
  end
44
44
 
45
45
  if request_path
46
- destinations = if allow_other_headers?
47
- default_destinations
48
- else
49
- AttributeFilter::DST_TRANSACTION_TRACER | AttributeFilter::DST_ERROR_COLLECTOR
50
- end
51
- txn.add_agent_attribute(:'request.uri', request_path, destinations)
46
+ txn.add_agent_attribute(:'request.uri', request_path, default_destinations)
52
47
  end
53
48
 
54
49
  if accept
@@ -136,10 +136,8 @@ module NewRelic
136
136
 
137
137
  transaction.distributed_tracer.parent_transaction_id = payload.transaction_id
138
138
 
139
- unless payload.sampled.nil?
140
- transaction.sampled = payload.sampled
141
- transaction.priority = payload.priority if payload.priority
142
- end
139
+ determine_sampling_decision(payload, header_data)
140
+
143
141
  NewRelic::Agent.increment_metric(ACCEPT_SUCCESS_METRIC)
144
142
  true
145
143
  rescue => e
@@ -148,6 +146,37 @@ module NewRelic
148
146
  false
149
147
  end
150
148
 
149
+ def determine_sampling_decision(payload, header_data)
150
+ if header_data.trace_parent['trace_flags'] == '01'
151
+ set_priority_and_sampled(NewRelic::Agent.config[:'distributed_tracing.sampler.remote_parent_sampled'], payload)
152
+ elsif header_data.trace_parent['trace_flags'] == '00'
153
+ set_priority_and_sampled(NewRelic::Agent.config[:'distributed_tracing.sampler.remote_parent_not_sampled'], payload)
154
+ else
155
+ use_nr_tracestate_sampled(payload)
156
+ end
157
+ rescue
158
+ use_nr_tracestate_sampled(payload)
159
+ end
160
+
161
+ def use_nr_tracestate_sampled(payload)
162
+ unless payload.sampled.nil?
163
+ transaction.sampled = payload.sampled
164
+ transaction.priority = payload.priority if payload.priority
165
+ end
166
+ end
167
+
168
+ def set_priority_and_sampled(config, payload)
169
+ if config == 'always_on'
170
+ transaction.sampled = true
171
+ transaction.priority = 2.0
172
+ elsif config == 'always_off'
173
+ transaction.sampled = false
174
+ transaction.priority = 0
175
+ else # default
176
+ use_nr_tracestate_sampled(payload)
177
+ end
178
+ end
179
+
151
180
  def ignore_trace_context?
152
181
  if trace_context_header_data
153
182
  NewRelic::Agent.increment_metric(IGNORE_MULTIPLE_ACCEPT_METRIC)
@@ -25,7 +25,7 @@ module NewRelic
25
25
  segment.parent = parent || thread_starting_span || current_segment
26
26
  set_current_segment(segment)
27
27
  if @segments.length < segment_limit
28
- @segments << segment
28
+ @segment_lock.synchronize { @segments << segment }
29
29
  else
30
30
  segment.record_on_finish = true
31
31
  ::NewRelic::Agent.logger.debug("Segment limit of #{segment_limit} reached, ceasing collection.")
@@ -42,8 +42,7 @@ module NewRelic
42
42
  def thread_starting_span
43
43
  # if the previous current segment was in another thread, use the thread local parent
44
44
  if ThreadLocalStorage[:newrelic_thread_span_parent] &&
45
- current_segment &&
46
- current_segment.starting_segment_key != NewRelic::Agent::Tracer.current_segment_key
45
+ current_segment&.starting_segment_key != NewRelic::Agent::Tracer.current_segment_key
47
46
 
48
47
  ThreadLocalStorage[:newrelic_thread_span_parent]
49
48
  end
@@ -51,7 +50,7 @@ module NewRelic
51
50
 
52
51
  def segment_complete(segment)
53
52
  # if parent was in another thread, remove the current_segment entry for this thread
54
- if segment.parent && segment.parent.starting_segment_key != NewRelic::Agent::Tracer.current_segment_key
53
+ if segment.parent&.starting_segment_key != NewRelic::Agent::Tracer.current_segment_key
55
54
  remove_current_segment_by_thread_id(NewRelic::Agent::Tracer.current_segment_key)
56
55
  else
57
56
  set_current_segment(segment.parent)
@@ -65,7 +64,7 @@ module NewRelic
65
64
  private
66
65
 
67
66
  def finalize_segments
68
- segments.each { |s| s.finalize }
67
+ @segment_lock.synchronize { segments.each { |s| s&.finalize } }
69
68
  end
70
69
 
71
70
  WEB_TRANSACTION_TOTAL_TIME = 'WebTransactionTotalTime'.freeze
@@ -215,6 +215,7 @@ module NewRelic
215
215
  @nesting_max_depth = 0
216
216
  @current_segment_by_thread = {}
217
217
  @current_segment_lock = Mutex.new
218
+ @segment_lock = Mutex.new
218
219
  @segments = []
219
220
 
220
221
  self.default_name = options[:transaction_name]
@@ -437,7 +438,7 @@ module NewRelic
437
438
  end
438
439
 
439
440
  def initial_segment
440
- segments.first
441
+ segments&.first
441
442
  end
442
443
 
443
444
  def finished?
@@ -85,17 +85,27 @@ module NewRelic
85
85
  end
86
86
 
87
87
  def append_vendor_info(collector_hash)
88
+ threads = []
89
+ complete = false
90
+
88
91
  VENDORS.each_pair do |klass, config_option|
89
92
  next unless Agent.config[config_option]
90
93
 
91
- vendor = klass.new
94
+ threads << Thread.new do
95
+ vendor = klass.new
96
+
97
+ if vendor.detect
98
+ collector_hash[:vendors] ||= {}
99
+ collector_hash[:vendors][vendor.vendor_name.to_sym] = vendor.metadata
92
100
 
93
- if vendor.detect
94
- collector_hash[:vendors] ||= {}
95
- collector_hash[:vendors][vendor.vendor_name.to_sym] = vendor.metadata
96
- break
101
+ complete = true
102
+ end
97
103
  end
98
104
  end
105
+
106
+ while complete == false && threads.any?(&:alive?)
107
+ sleep 0.01
108
+ end
99
109
  end
100
110
 
101
111
  def append_docker_info(collector_hash)
@@ -74,6 +74,7 @@ module NewRelic
74
74
  NewRelic::Agent.agent = NewRelic::Agent::Agent.instance
75
75
  init_instrumentation
76
76
  init_security_agent
77
+ report_agent_version_metric
77
78
  end
78
79
 
79
80
  def determine_env(options)
@@ -171,6 +172,10 @@ module NewRelic
171
172
  def stdout
172
173
  STDOUT
173
174
  end
175
+
176
+ def report_agent_version_metric
177
+ NewRelic::Agent.record_metric_once("Supportability/AgentVersion/newrelic_rpm/#{NewRelic::VERSION::STRING}")
178
+ end
174
179
  end
175
180
  include InstanceMethods
176
181
  end
@@ -6,7 +6,7 @@
6
6
  module NewRelic
7
7
  module VERSION # :nodoc:
8
8
  MAJOR = 9
9
- MINOR = 17
9
+ MINOR = 19
10
10
  TINY = 0
11
11
 
12
12
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
@@ -141,6 +141,8 @@ module NewRelicYML
141
141
  description.gsub!(/<InlinePopover type="(.*)" \/>/, '\1')
142
142
  # remove hyperlinks
143
143
  description.gsub!(/\[([^\]]+)\]\([^\)]+\)/, '\1')
144
+ # delete lines with code fences including the language
145
+ description.gsub!(/```[a-zA-Z0-9_]*\n(.*?)```/m, '\1')
144
146
  # remove single pairs of backticks
145
147
  description.gsub!(/`([^`]+)`/, '\1')
146
148
  # removed href links
@@ -153,8 +155,8 @@ module NewRelicYML
153
155
  # remove leading and trailing whitespace
154
156
  description.strip!
155
157
  # wrap text after 80 characters, assuming we're at one tabstop's (two
156
- # spaces') level of indentation already
157
- description.gsub!(/(.{1,78})(\s+|\Z)/, "\\1\n")
158
+ # spaces') level of indentation already, keep leading whitespace
159
+ description.gsub!(/(.{1,78})(\s|\Z)/, "\\1\n")
158
160
  # add hashtags to lines
159
161
  description = description.split("\n").map { |line| " # #{line}" }.join("\n")
160
162
 
data/newrelic.yml CHANGED
@@ -40,9 +40,11 @@ common: &default_settings
40
40
 
41
41
  # If false, LLM instrumentation (OpenAI only for now) will not capture input and
42
42
  # output content on specific LLM events.
43
+ #
43
44
  # The excluded attributes include:
44
- # * content from LlmChatCompletionMessage events
45
- # * input from LlmEmbedding events
45
+ # - content from LlmChatCompletionMessage events
46
+ # - input from LlmEmbedding events
47
+ #
46
48
  # This is an optional security setting to prevent recording sensitive data sent
47
49
  # to and received from your LLMs.
48
50
  # ai_monitoring.record_content.enabled: true
@@ -73,20 +75,23 @@ common: &default_settings
73
75
  # application_logging.forwarding.labels.exclude: []
74
76
 
75
77
  # Sets the minimum level a log event must have to be forwarded to New Relic.
76
- # This is based on the integer values of Ruby's Logger::Severity constants:
77
- # https://github.com/ruby/logger/blob/113b82a06b3076b93a71cd467e1605b23afb3088/lib/logger/severity.rb
78
+ #
79
+ # This is based on the integer values of Ruby's Logger::Severity constants.
80
+ #
78
81
  # The intention is to forward logs with the level given to the configuration, as
79
82
  # well as any logs with a higher level of severity.
83
+ #
80
84
  # For example, setting this value to "debug" will forward all log events to New
81
85
  # Relic. Setting this value to "error" will only forward log events with the
82
86
  # levels "error", "fatal", and "unknown".
87
+ #
83
88
  # Valid values (ordered lowest to highest):
84
- # * "debug"
85
- # * "info"
86
- # * "warn"
87
- # * "error"
88
- # * "fatal"
89
- # * "unknown"
89
+ # - "debug"
90
+ # - "info"
91
+ # - "warn"
92
+ # - "error"
93
+ # - "fatal"
94
+ # - "unknown"
90
95
  # application_logging.forwarding.log_level: debug
91
96
 
92
97
  # Defines the maximum number of log records to buffer in memory at a time.
@@ -124,48 +129,52 @@ common: &default_settings
124
129
  # methods) strings representing Ruby methods that the agent can automatically
125
130
  # add custom instrumentation to. This doesn't require any modifications of the
126
131
  # source code that defines the methods.
132
+ #
127
133
  # Use fully qualified class names (using the :: delimiter) that include any
128
134
  # module or class namespacing.
135
+ #
129
136
  # Here is some Ruby source code that defines a render_png instance method for an
130
137
  # Image class and a notify class method for a User class, both within a
131
138
  # MyCompany module namespace:
132
- #
139
+ #
133
140
  # module MyCompany
134
141
  # class Image
135
142
  # def render_png
136
143
  # # code to render a PNG
137
144
  # end
138
145
  # end
139
- #
146
+ #
140
147
  # class User
141
148
  # def self.notify
142
149
  # # code to notify users
143
150
  # end
144
151
  # end
145
152
  # end
146
- #
153
+ #
154
+ #
147
155
  # Given that source code, the newrelic.yml config file might request
148
156
  # instrumentation for both of these methods like so:
149
- #
157
+ #
150
158
  # automatic_custom_instrumentation_method_list:
151
- # - MyCompany::Image#render_png
152
- # - MyCompany::User.notify
153
- #
159
+ # - MyCompany::Image#render_png
160
+ # - MyCompany::User.notify
161
+ #
162
+ #
154
163
  # That configuration example uses YAML array syntax to specify both methods.
155
164
  # Alternatively, you can use a comma-delimited string:
156
- #
165
+ #
157
166
  # automatic_custom_instrumentation_method_list: 'MyCompany::Image#render_png,
158
167
  # MyCompany::User.notify'
159
- #
168
+ #
169
+ #
160
170
  # Whitespace around the comma(s) in the list is optional. When configuring the
161
171
  # agent with a list of methods via the
162
172
  # NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST environment variable,
163
173
  # use this comma-delimited string format:
164
- #
174
+ #
165
175
  # export
166
176
  # NEW_RELIC_AUTOMATIC_CUSTOM_INSTRUMENTATION_METHOD_LIST='MyCompany::Image#render_png,
167
177
  # MyCompany::User.notify'
168
- #
169
178
  # automatic_custom_instrumentation_method_list: []
170
179
 
171
180
  # Specify a list of constants that should prevent the agent from starting
@@ -214,6 +223,7 @@ common: &default_settings
214
223
 
215
224
  # When true, the agent captures HTTP request parameters and attaches them to
216
225
  # transaction traces, traced errors, and TransactionError events.
226
+ #
217
227
  # When using the capture_params setting, the Ruby agent will not attempt to
218
228
  # filter secret information. Recommendation: To filter secret information from
219
229
  # request parameters, use the attributes.include setting instead. For more
@@ -233,10 +243,10 @@ common: &default_settings
233
243
 
234
244
  # Path to newrelic.yml. If undefined, the agent checks the following directories
235
245
  # (in order):
236
- # * config/newrelic.yml
237
- # * newrelic.yml
238
- # * $HOME/.newrelic/newrelic.yml
239
- # * $HOME/newrelic.yml
246
+ # - config/newrelic.yml
247
+ # - newrelic.yml
248
+ # - $HOME/.newrelic/newrelic.yml
249
+ # - $HOME/newrelic.yml
240
250
  # config_path: newrelic.yml
241
251
 
242
252
  # If false, custom attributes will not be sent on events.
@@ -245,9 +255,9 @@ common: &default_settings
245
255
  # If true, the agent captures custom events.
246
256
  # custom_insights_events.enabled: true
247
257
 
248
- # * Specify a maximum number of custom events to buffer in memory at a time.
249
- # * When configuring the agent for AI monitoring, set to max value 100000. This
250
- # ensures the agent captures the maximum amount of LLM events.
258
+ # - Specify a maximum number of custom events to buffer in memory at a time.
259
+ # - When configuring the agent for AI monitoring, set to max value 100000.
260
+ # This ensures the agent captures the maximum amount of LLM events.
251
261
  # custom_insights_events.max_samples_stored: 3000
252
262
 
253
263
  # If false, the agent will not add database_name parameter to transaction or
@@ -300,6 +310,7 @@ common: &default_settings
300
310
 
301
311
  # If true, the agent won't wrap third-party middlewares in instrumentation
302
312
  # (regardless of whether they are installed via Rack::Builder or Rails).
313
+ #
303
314
  # When middleware instrumentation is disabled, if an application is using
304
315
  # middleware that could alter the response code, the HTTP status code reported
305
316
  # on the transaction may not reflect the altered value.
@@ -322,6 +333,18 @@ common: &default_settings
322
333
  # If true, disables agent middleware for Sinatra. This middleware is responsible
323
334
  # for advanced feature support such as cross application tracing, page load
324
335
  # timing, and error collection.
336
+ #
337
+ # Cross application tracing is deprecated in favor of distributed tracing.
338
+ # Distributed tracing is on by default for Ruby agent versions 8.0.0 and above.
339
+ # Middlewares are not required to support distributed tracing.
340
+ #
341
+ # To continue using cross application tracing, update the following options in
342
+ # your newrelic.yml configuration file:
343
+ #
344
+ # cross_application_tracer:
345
+ # enabled: true
346
+ # distributed_tracing:
347
+ # enabled: false
325
348
  # disable_sinatra_auto_middleware: false
326
349
 
327
350
  # If true, disables view instrumentation.
@@ -336,6 +359,20 @@ common: &default_settings
336
359
  # enable this feature.
337
360
  # distributed_tracing.enabled: true
338
361
 
362
+ # This setting controls the behavior of transaction sampling when a remote
363
+ # parent is not sampled and the trace flag is not set in the traceparent.
364
+ # Available values are default, always_on, and always_off.
365
+ # distributed_tracing.sampler.remote_parent_not_sampled: default
366
+
367
+ # This setting controls the behavior of transaction sampling when a remote
368
+ # parent is sampled and the trace flag is set in the traceparent. Available
369
+ # values are default, always_on, and always_off.
370
+ # distributed_tracing.sampler.remote_parent_sampled: default
371
+
372
+ # If true, the agent captures the Elasticsearch cluster name in transaction
373
+ # traces.
374
+ # elasticsearch.capture_cluster_name: true
375
+
339
376
  # If true, the agent captures Elasticsearch queries in transaction traces.
340
377
  # elasticsearch.capture_queries: true
341
378
 
@@ -382,7 +419,7 @@ common: &default_settings
382
419
  # classes specified here occurs, if its error message contains one of the
383
420
  # strings corresponding to it here, that error will be ignored.
384
421
  # This option can't be set via environment variable.
385
- # error_collector.ignore_messages: {}
422
+ # error_collector.ignore_messages: {ThreadError: ["queue empty"]}
386
423
 
387
424
  # A comma separated list of status codes, possibly including ranges. Errors
388
425
  # associated with these status codes, where applicable, will be ignored.
@@ -428,9 +465,9 @@ common: &default_settings
428
465
  # sending each span individually.
429
466
  # infinite_tracing.batching: true
430
467
 
431
- # Configure the compression level for data sent to the trace observer.
432
- # May be one of: :none, :low, :medium, :high.
433
- # Set the level to :none to disable compression.
468
+ # Configure the compression level for data sent to the trace observer. May be
469
+ # one of: :none, :low, :medium, :high. Set the level to :none to disable
470
+ # compression.
434
471
  # infinite_tracing.compression_level: high
435
472
 
436
473
  # Configures the hostname for the trace observer Host. When configured, enables
@@ -785,9 +822,9 @@ common: &default_settings
785
822
  # If true, enables span event sampling.
786
823
  # span_events.enabled: true
787
824
 
788
- # * Defines the maximum number of span events reported from a single harvest.
825
+ # - Defines the maximum number of span events reported from a single harvest.
789
826
  # Any Integer between 1 and 10000 is valid.'
790
- # * When configuring the agent for AI monitoring, set to max value 10000.This
827
+ # - When configuring the agent for AI monitoring, set to max value 10000.This
791
828
  # ensures the agent captures the maximum amount of distributed traces.
792
829
  # span_events.max_samples_stored: 2000
793
830
 
@@ -957,7 +994,7 @@ common: &default_settings
957
994
  # NOTE: All "security.*" configuration parameters are related only to the
958
995
  # security agent, and all other configuration parameters that may
959
996
  # have "security" in the name somewhere are related to the APM agent.
960
-
997
+
961
998
  # If true, the security agent is loaded (a Ruby 'require' is performed)
962
999
  # security.agent.enabled: false
963
1000