newrelic_rpm 9.17.0 → 9.21.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.
- checksums.yaml +4 -4
- data/.build_ignore +1 -0
- data/CHANGELOG.md +105 -1
- data/lib/new_relic/agent/agent.rb +2 -0
- data/lib/new_relic/agent/agent_helpers/connect.rb +3 -3
- data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -3
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +1 -1
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +1 -1
- data/lib/new_relic/agent/agent_helpers/startup.rb +4 -4
- data/lib/new_relic/agent/configuration/default_source.rb +145 -120
- data/lib/new_relic/agent/configuration/manager.rb +5 -2
- data/lib/new_relic/agent/configuration/yaml_source.rb +4 -4
- data/lib/new_relic/agent/database.rb +1 -1
- data/lib/new_relic/agent/database_adapter.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing.rb +2 -0
- data/lib/new_relic/agent/external.rb +2 -0
- data/lib/new_relic/agent/http_clients/uri_util.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_dispatch.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_mailbox.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_mailer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +6 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +6 -4
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +11 -9
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/async_http.rb +1 -1
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
- data/lib/new_relic/agent/instrumentation/ethon.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +1 -1
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -4
- data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpx.rb +1 -1
- data/lib/new_relic/agent/instrumentation/logstasher.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +0 -2
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +2 -2
- data/lib/new_relic/agent/instrumentation/resque.rb +2 -2
- data/lib/new_relic/agent/instrumentation/roda.rb +1 -1
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/ruby_openai.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delay_extensions.rb +24 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +9 -1
- data/lib/new_relic/agent/instrumentation/stripe.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +2 -2
- data/lib/new_relic/agent/llm/chat_completion_summary.rb +1 -1
- data/lib/new_relic/agent/llm/embedding.rb +1 -1
- data/lib/new_relic/agent/local_log_decorator.rb +1 -1
- data/lib/new_relic/agent/logging.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +5 -0
- data/lib/new_relic/agent/method_tracer.rb +3 -0
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
- data/lib/new_relic/agent/new_relic_service.rb +2 -2
- data/lib/new_relic/agent/opentelemetry/context/propagation/trace_propagator.rb +66 -0
- data/lib/new_relic/agent/opentelemetry/context/propagation.rb +15 -0
- data/lib/{tasks/instrumentation_generator/templates/Envfile.tt → new_relic/agent/opentelemetry/context.rb} +9 -5
- data/lib/new_relic/agent/opentelemetry/trace/span.rb +31 -0
- data/lib/new_relic/agent/opentelemetry/trace/tracer.rb +129 -0
- data/lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb +18 -0
- data/lib/new_relic/agent/opentelemetry/trace.rb +15 -0
- data/lib/new_relic/agent/opentelemetry/transaction_patch.rb +69 -0
- data/lib/new_relic/agent/opentelemetry_bridge.rb +32 -0
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
- data/lib/new_relic/agent/serverless_handler.rb +7 -1
- data/lib/new_relic/agent/span_event_primitive.rb +8 -1
- data/lib/new_relic/agent/tracer.rb +1 -1
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -1
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +3 -3
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/request_attributes.rb +1 -6
- data/lib/new_relic/agent/transaction/trace_context.rb +33 -4
- data/lib/new_relic/agent/transaction/tracing.rb +3 -3
- data/lib/new_relic/agent/transaction.rb +2 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
- data/lib/new_relic/agent/utilization/ecs.rb +22 -0
- data/lib/new_relic/agent/utilization/ecs_v4.rb +22 -0
- data/lib/new_relic/agent/utilization_data.rb +40 -5
- data/lib/new_relic/agent/vm/c_ruby_vm.rb +3 -3
- data/lib/new_relic/agent.rb +28 -0
- data/lib/new_relic/constants.rb +1 -0
- data/lib/new_relic/control/instance_methods.rb +5 -0
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +0 -1
- data/lib/new_relic/helper.rb +7 -0
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +1 -1
- data/lib/tasks/helpers/newrelicyml.rb +6 -2
- data/newrelic.yml +80 -43
- data/newrelic_rpm.gemspec +1 -1
- metadata +17 -19
- data/lib/tasks/instrumentation_generator/README.md +0 -63
- data/lib/tasks/instrumentation_generator/TODO.md +0 -33
- data/lib/tasks/instrumentation_generator/instrumentation.thor +0 -130
- data/lib/tasks/instrumentation_generator/templates/chain.tt +0 -21
- data/lib/tasks/instrumentation_generator/templates/chain_method.tt +0 -7
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +0 -32
- data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +0 -13
- data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +0 -3
- data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +0 -19
- data/lib/tasks/instrumentation_generator/templates/prepend.tt +0 -13
- data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +0 -3
- data/lib/tasks/instrumentation_generator/templates/test.tt +0 -15
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
|
-
#
|
45
|
-
#
|
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
|
-
#
|
77
|
-
#
|
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
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
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
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
# end
|
138
|
-
# end
|
139
|
-
#
|
140
|
-
# class User
|
141
|
-
# def self.notify
|
142
|
-
# # code to notify users
|
143
|
-
# end
|
144
|
-
# end
|
141
|
+
# class Image
|
142
|
+
# def render_png
|
143
|
+
# # code to render a PNG
|
145
144
|
# end
|
146
|
-
#
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# class User
|
148
|
+
# def self.notify
|
149
|
+
# # code to notify users
|
150
|
+
# end
|
151
|
+
# end
|
152
|
+
# end
|
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
159
|
# - MyCompany::Image#render_png
|
152
160
|
# - MyCompany::User.notify
|
153
|
-
#
|
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
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
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
|
-
#
|
249
|
-
#
|
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
|
-
#
|
433
|
-
#
|
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
|
-
#
|
825
|
+
# - Defines the maximum number of span events reported from a single harvest.
|
789
826
|
# Any Integer between 1 and 10000 is valid.'
|
790
|
-
#
|
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
|
|
data/newrelic_rpm.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.version = NewRelic::VERSION::STRING
|
11
11
|
s.required_ruby_version = '>= 2.4.0'
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to?(:required_rubygems_version=)
|
13
|
-
s.authors = ['Tanna McClure', 'Kayla Reopelle', '
|
13
|
+
s.authors = ['Tanna McClure', 'Kayla Reopelle', 'Hannah Ramadan']
|
14
14
|
s.licenses = ['Apache-2.0']
|
15
15
|
s.description = <<~EOS
|
16
16
|
New Relic is a performance management system, developed by New Relic,
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanna McClure
|
8
8
|
- Kayla Reopelle
|
9
|
-
- James Bunch
|
10
9
|
- Hannah Ramadan
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: bundler
|
@@ -245,15 +244,15 @@ description: |
|
|
245
244
|
https://github.com/newrelic/newrelic-ruby-agent/
|
246
245
|
email: support@newrelic.com
|
247
246
|
executables:
|
248
|
-
- newrelic_rpm
|
249
247
|
- newrelic
|
248
|
+
- newrelic_rpm
|
250
249
|
- nrdebug
|
251
250
|
extensions: []
|
252
251
|
extra_rdoc_files:
|
253
252
|
- CHANGELOG.md
|
253
|
+
- CONTRIBUTING.md
|
254
254
|
- LICENSE
|
255
255
|
- README.md
|
256
|
-
- CONTRIBUTING.md
|
257
256
|
- newrelic.yml
|
258
257
|
files:
|
259
258
|
- ".build_ignore"
|
@@ -555,6 +554,7 @@ files:
|
|
555
554
|
- lib/new_relic/agent/instrumentation/sequel_helper.rb
|
556
555
|
- lib/new_relic/agent/instrumentation/sidekiq.rb
|
557
556
|
- lib/new_relic/agent/instrumentation/sidekiq/client.rb
|
557
|
+
- lib/new_relic/agent/instrumentation/sidekiq/extensions/delay_extensions.rb
|
558
558
|
- lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb
|
559
559
|
- lib/new_relic/agent/instrumentation/sidekiq/server.rb
|
560
560
|
- lib/new_relic/agent/instrumentation/sinatra.rb
|
@@ -613,6 +613,15 @@ files:
|
|
613
613
|
- lib/new_relic/agent/noticeable_error.rb
|
614
614
|
- lib/new_relic/agent/null_logger.rb
|
615
615
|
- lib/new_relic/agent/obfuscator.rb
|
616
|
+
- lib/new_relic/agent/opentelemetry/context.rb
|
617
|
+
- lib/new_relic/agent/opentelemetry/context/propagation.rb
|
618
|
+
- lib/new_relic/agent/opentelemetry/context/propagation/trace_propagator.rb
|
619
|
+
- lib/new_relic/agent/opentelemetry/trace.rb
|
620
|
+
- lib/new_relic/agent/opentelemetry/trace/span.rb
|
621
|
+
- lib/new_relic/agent/opentelemetry/trace/tracer.rb
|
622
|
+
- lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb
|
623
|
+
- lib/new_relic/agent/opentelemetry/transaction_patch.rb
|
624
|
+
- lib/new_relic/agent/opentelemetry_bridge.rb
|
616
625
|
- lib/new_relic/agent/parameter_filtering.rb
|
617
626
|
- lib/new_relic/agent/payload_metric_mapping.rb
|
618
627
|
- lib/new_relic/agent/pipe_channel_manager.rb
|
@@ -673,6 +682,8 @@ files:
|
|
673
682
|
- lib/new_relic/agent/transaction_time_aggregator.rb
|
674
683
|
- lib/new_relic/agent/utilization/aws.rb
|
675
684
|
- lib/new_relic/agent/utilization/azure.rb
|
685
|
+
- lib/new_relic/agent/utilization/ecs.rb
|
686
|
+
- lib/new_relic/agent/utilization/ecs_v4.rb
|
676
687
|
- lib/new_relic/agent/utilization/gcp.rb
|
677
688
|
- lib/new_relic/agent/utilization/pcf.rb
|
678
689
|
- lib/new_relic/agent/utilization/vendor.rb
|
@@ -746,19 +757,6 @@ files:
|
|
746
757
|
- lib/tasks/helpers/prompt.rb
|
747
758
|
- lib/tasks/helpers/version_bump.rb
|
748
759
|
- lib/tasks/install.rake
|
749
|
-
- lib/tasks/instrumentation_generator/README.md
|
750
|
-
- lib/tasks/instrumentation_generator/TODO.md
|
751
|
-
- lib/tasks/instrumentation_generator/instrumentation.thor
|
752
|
-
- lib/tasks/instrumentation_generator/templates/Envfile.tt
|
753
|
-
- lib/tasks/instrumentation_generator/templates/chain.tt
|
754
|
-
- lib/tasks/instrumentation_generator/templates/chain_method.tt
|
755
|
-
- lib/tasks/instrumentation_generator/templates/dependency_detection.tt
|
756
|
-
- lib/tasks/instrumentation_generator/templates/instrumentation.tt
|
757
|
-
- lib/tasks/instrumentation_generator/templates/instrumentation_method.tt
|
758
|
-
- lib/tasks/instrumentation_generator/templates/newrelic.yml.tt
|
759
|
-
- lib/tasks/instrumentation_generator/templates/prepend.tt
|
760
|
-
- lib/tasks/instrumentation_generator/templates/prepend_method.tt
|
761
|
-
- lib/tasks/instrumentation_generator/templates/test.tt
|
762
760
|
- lib/tasks/newrelic.rb
|
763
761
|
- lib/tasks/newrelicyml.rake
|
764
762
|
- lib/tasks/tests.rake
|
@@ -789,7 +787,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
789
787
|
- !ruby/object:Gem::Version
|
790
788
|
version: 1.3.1
|
791
789
|
requirements: []
|
792
|
-
rubygems_version: 3.6.
|
790
|
+
rubygems_version: 3.6.9
|
793
791
|
specification_version: 4
|
794
792
|
summary: New Relic Ruby Agent
|
795
793
|
test_files: []
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# Instrumentation Generator
|
2
|
-
|
3
|
-
## Usage
|
4
|
-
|
5
|
-
`thor list` can be passed to get a list of all available thor commands
|
6
|
-
|
7
|
-
### instrumentation:scaffold
|
8
|
-
|
9
|
-
This task requires one parameter by default: the name of the library or class you are instrumenting. This task generates the basic file structure needed to add new instrumentation to the Ruby agent.
|
10
|
-
|
11
|
-
Run it using:
|
12
|
-
|
13
|
-
`thor instrumentation:scaffold gem_name`
|
14
|
-
|
15
|
-
It accepts two optional parameters:
|
16
|
-
|
17
|
-
- `--method`: the name of a method to instrument. Only one method can be accepted at this time. Defaults to `method_to_instrument`
|
18
|
-
- `--args`: the arguments for the instrumented method. A comma-separated list can be given if there are multiple arguments. Defaults to `*args`.
|
19
|
-
|
20
|
-
With the optional parameters, the task can be run like so:
|
21
|
-
|
22
|
-
`thor instrumentation:scaffold gem_name --method=method_to_instrument --args=arg1,arg2,arg3`
|
23
|
-
|
24
|
-
### WIP: instrumentation:add_new_method
|
25
|
-
|
26
|
-
Are you trying add instrumentation for a method within library we already instrument? This task is for you! Instead of building the entire scaffold, this task inserts only the changes needed within the `instrumentation.rb` and test files to instrument the new method. It requires one argument, the name of the existing instrumentation to add the method to. If the instrumented library does not already exist, it will create a new scaffold for that library.
|
27
|
-
|
28
|
-
Run it using:
|
29
|
-
|
30
|
-
`thor instrumentation:scaffold gem_name`
|
31
|
-
|
32
|
-
It accepts two optional parameters:
|
33
|
-
|
34
|
-
- `--method`: the name of a method to instrument. Only one method can be accepted at this time. Defaults to `method_to_instrument`
|
35
|
-
- `--args`: the arguments for the instrumented method. A comma-separated list can be given if there are multiple arguments. Defaults to `*args`.
|
36
|
-
|
37
|
-
With the optional parameters, the task can be run like so:
|
38
|
-
|
39
|
-
`thor instrumentation:add_new_method gem_name --method=method_to_instrument --args=arg1,arg2,arg3`
|
40
|
-
|
41
|
-
## Idea
|
42
|
-
|
43
|
-
Create a CLI, similar to Rails’ generators and scaffold scripts, to create the required files and basic classes for instrumenting new libraries. The hope is that the parts of adding new instrumentation that is repetitive can be eliminated and/or reduced so that it takes less time to add new instrumentation and we can spend development time considering the best attributes to collect and interactions to measure. I also hope this project will reduce the overall toil related to adding new instrumentation.
|
44
|
-
|
45
|
-
The files we create with little variation besides library and method names are:
|
46
|
-
|
47
|
-
- Lib
|
48
|
-
- Dependency detection
|
49
|
-
- Chain
|
50
|
-
- Prepend
|
51
|
-
- Instrumentation
|
52
|
-
- Tests
|
53
|
-
- configuration/newrelic.yml
|
54
|
-
- Envfile
|
55
|
-
- Test file
|
56
|
-
|
57
|
-
Furthermore, we also create very similar snippets inside the default source configuration file that could be generated by this project as well.
|
58
|
-
|
59
|
-
## Outcome
|
60
|
-
|
61
|
-
A prototype outside the agent was first created. This prototype generated the required files to add instrumentation. The prototype accepted three arguments: name (name of the library), method (method to instrument), args (arguments for the method). This prototype has evolved into the current directory.
|
62
|
-
|
63
|
-
This project leverages the Ruby gem Thor, a toolkit for building powerful command-line interfaces used in Bundler, Vagrant, Rails and others powers this CLI.
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# TODO
|
2
|
-
|
3
|
-
# - [X] Create instrumentation file
|
4
|
-
|
5
|
-
# - [X] Create chain file
|
6
|
-
|
7
|
-
# - [X] Create prepend file
|
8
|
-
|
9
|
-
# - [X] Create dependency detection file
|
10
|
-
|
11
|
-
# - [X] Add config to default source
|
12
|
-
|
13
|
-
# - [X] Create multiverse suite
|
14
|
-
|
15
|
-
# - [X] Create Envfile
|
16
|
-
|
17
|
-
# - [X] Create test file with examples
|
18
|
-
|
19
|
-
# - [X] Create option for method names to instrument
|
20
|
-
|
21
|
-
# - [X] Add entry to newrelic.yml
|
22
|
-
|
23
|
-
# - [ ] Append a new method to instrument to an existing instrumentation class (with tests?)
|
24
|
-
|
25
|
-
# - [ ] Documentation: examples of what to add in each gap (Good examples of tests, instrumentation, etc. as comments to guide users)
|
26
|
-
|
27
|
-
# - [ ] Handle multi-word gem names (camel case for classes, handle hyphens, concurrent-ruby as example)
|
28
|
-
|
29
|
-
# - [ ] Allow multiple method arguments to be passed to the command line
|
30
|
-
|
31
|
-
# - [ ] Add tests for the instrumentation_generator code
|
32
|
-
|
33
|
-
# - [ ] See if instrumentation PRs can get automatically generated when an already instrumented library adds methods to its codebase
|
@@ -1,130 +0,0 @@
|
|
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
|
-
require_relative '../../new_relic/language_support'
|
6
|
-
require 'thor'
|
7
|
-
|
8
|
-
class Instrumentation < Thor
|
9
|
-
include Thor::Actions
|
10
|
-
|
11
|
-
INSTRUMENTATION_ROOT = 'lib/new_relic/agent/instrumentation/'
|
12
|
-
MULTIVERSE_SUITE_ROOT = 'test/multiverse/suites/'
|
13
|
-
DEFAULT_SOURCE_LOCATION = 'lib/new_relic/agent/configuration/default_source.rb'
|
14
|
-
NEWRELIC_YML_LOCATION = 'newrelic.yml'
|
15
|
-
|
16
|
-
desc('scaffold NAME', 'Scaffold the required files for adding new instrumentation')
|
17
|
-
long_desc <<~LONGDESC
|
18
|
-
`instrumentation scaffold` requires one parameter by default: the name of the
|
19
|
-
library or class you are instrumenting. This task generates the basic
|
20
|
-
file structure needed to add new instrumentation to the Ruby agent.
|
21
|
-
LONGDESC
|
22
|
-
|
23
|
-
source_root(File.dirname(__FILE__))
|
24
|
-
|
25
|
-
option :method,
|
26
|
-
default: 'method_to_instrument',
|
27
|
-
desc: 'The method you would like to prepend or chain instrumentation onto'
|
28
|
-
option :args,
|
29
|
-
default: '*args',
|
30
|
-
desc: 'The arguments associated with the original method'
|
31
|
-
|
32
|
-
def scaffold(name)
|
33
|
-
@name = name
|
34
|
-
@snake_name = snake_name(@name)
|
35
|
-
@method = options[:method] if options[:method]
|
36
|
-
@args = options[:args] if options[:args]
|
37
|
-
@class_name = ::NewRelic::LanguageSupport.camelize(name)
|
38
|
-
base_path = "#{INSTRUMENTATION_ROOT}#{@snake_name}"
|
39
|
-
|
40
|
-
empty_directory(base_path)
|
41
|
-
create_instrumentation_files(base_path)
|
42
|
-
append_to_default_source(@name, @snake_name)
|
43
|
-
# append_to_newrelic_yml(@name, @snake_name) # This is now done on release, we don't need it anymore, but leaving it to be sure.
|
44
|
-
create_tests(name)
|
45
|
-
end
|
46
|
-
|
47
|
-
desc 'add_new_method NAME', 'Inserts a new method into an existing piece of instrumentation'
|
48
|
-
|
49
|
-
option :method, required: true, desc: 'The name of the method to instrument'
|
50
|
-
option :args, default: '*args', desc: 'The arguments associated with the instrumented method'
|
51
|
-
|
52
|
-
def add_new_method(name, method_name)
|
53
|
-
# Verify that existing instrumentation exists
|
54
|
-
# if it doesn't, should we just call the #scaffold method instead since we have all the stuff
|
55
|
-
# otherwise, inject the new method into the instrumentation matching the first arg
|
56
|
-
# add to only chain, instrumentation, prepend
|
57
|
-
# move the method content to a partial
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def create_instrumentation_files(base_path)
|
63
|
-
%w[chain instrumentation prepend].each do |file|
|
64
|
-
template("templates/#{file}.tt", "#{base_path}/#{file}.rb")
|
65
|
-
end
|
66
|
-
|
67
|
-
template('templates/dependency_detection.tt', "#{base_path}.rb")
|
68
|
-
end
|
69
|
-
|
70
|
-
def create_tests(name)
|
71
|
-
@name = name
|
72
|
-
@instrumentation_method_global_erb_snippet = '<%= $instrumentation_method %>'
|
73
|
-
@snake_name = snake_name(@name)
|
74
|
-
base_path = "#{MULTIVERSE_SUITE_ROOT}#{@snake_name}"
|
75
|
-
empty_directory(base_path)
|
76
|
-
template('templates/Envfile.tt', "#{base_path}/Envfile")
|
77
|
-
template('templates/test.tt', "#{base_path}/#{@snake_name}_instrumentation_test.rb")
|
78
|
-
|
79
|
-
empty_directory("#{base_path}/config")
|
80
|
-
template('templates/newrelic.yml.tt', "#{base_path}/config/newrelic.yml")
|
81
|
-
end
|
82
|
-
|
83
|
-
def append_to_default_source(name, snake_name)
|
84
|
-
insert_into_file(
|
85
|
-
DEFAULT_SOURCE_LOCATION,
|
86
|
-
config_block(name, snake_name),
|
87
|
-
after: ":description => 'Controls auto-instrumentation of bunny at start-up. May be one of: `auto`, `prepend`, `chain`, `disabled`.'
|
88
|
-
},\n"
|
89
|
-
)
|
90
|
-
end
|
91
|
-
|
92
|
-
def append_to_newrelic_yml(name, snake_name)
|
93
|
-
insert_into_file(
|
94
|
-
NEWRELIC_YML_LOCATION,
|
95
|
-
yaml_block(name, snake_name),
|
96
|
-
after: "# instrumentation.bunny: auto\n"
|
97
|
-
)
|
98
|
-
end
|
99
|
-
|
100
|
-
def config_block(name, snake_name)
|
101
|
-
# Don't change to <<~
|
102
|
-
# We want to preserve the whitespace so the config is correctly indented
|
103
|
-
<<-CONFIG
|
104
|
-
:'instrumentation.#{snake_name}' => {
|
105
|
-
:default => 'auto',
|
106
|
-
:documentation_default => 'auto',
|
107
|
-
:public => true,
|
108
|
-
:type => String,
|
109
|
-
:dynamic_name => true,
|
110
|
-
:allowed_from_server => false,
|
111
|
-
:description => 'Controls auto-instrumentation of the #{name} library at start-up. May be one of `auto`, `prepend`, `chain`, `disabled`.'
|
112
|
-
},
|
113
|
-
CONFIG
|
114
|
-
end
|
115
|
-
|
116
|
-
def yaml_block(name, snake_name)
|
117
|
-
<<~HEREDOC
|
118
|
-
|
119
|
-
# Controls auto-instrumentation of #{name} at start-up.
|
120
|
-
# May be one of [auto|prepend|chain|disabled]
|
121
|
-
# instrumentation.#{snake_name}: auto
|
122
|
-
HEREDOC
|
123
|
-
end
|
124
|
-
|
125
|
-
def snake_name(name)
|
126
|
-
name.downcase.tr('-', '_')
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
Instrumentation.start(ARGV)
|
@@ -1,21 +0,0 @@
|
|
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::Agent::Instrumentation
|
6
|
-
module <%= @class_name %>::Chain
|
7
|
-
def self.instrument!
|
8
|
-
::<%= @class_name %>.class_eval do
|
9
|
-
include NewRelic::Agent::Instrumentation::<%= @class_name %>
|
10
|
-
|
11
|
-
alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
|
12
|
-
|
13
|
-
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
14
|
-
<%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
|
15
|
-
<%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
|
2
|
-
|
3
|
-
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
4
|
-
<%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
|
5
|
-
<%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
|
6
|
-
end
|
7
|
-
end
|
@@ -1,32 +0,0 @@
|
|
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
|
-
DependencyDetection.defer do
|
6
|
-
named :<%= @snake_name %>
|
7
|
-
|
8
|
-
depends_on do
|
9
|
-
# The class that needs to be defined to prepend/chain onto. This can be used
|
10
|
-
# to determine whether the library is installed.
|
11
|
-
defined?(<%= @class_name %>)
|
12
|
-
# Add any additional requirements to verify whether this instrumentation
|
13
|
-
# should be installed
|
14
|
-
end
|
15
|
-
|
16
|
-
executes do
|
17
|
-
require_relative '<%= @snake_name.downcase %>/instrumentation'
|
18
|
-
|
19
|
-
# prepend_instrument and chain_instrument call extract_supportability_name
|
20
|
-
# to get the library name for supportability metrics and info-level logging.
|
21
|
-
# This is done by spliting on the 2nd to last spot of the instrumented
|
22
|
-
# module. If this isn't how we want the name to appear, pass in the desired
|
23
|
-
# name as a third argument.
|
24
|
-
if use_prepend?
|
25
|
-
require_relative '<%= @snake_name.downcase %>/prepend'
|
26
|
-
prepend_instrument <%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
|
27
|
-
else
|
28
|
-
require_relative '<%= @snake_name.downcase %>/chain'
|
29
|
-
chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>::Chain
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,13 +0,0 @@
|
|
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::Agent::Instrumentation
|
6
|
-
module <%= @class_name %>
|
7
|
-
|
8
|
-
def <%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %>
|
9
|
-
# add instrumentation content here
|
10
|
-
yield
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|