newrelic_rpm 9.9.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 +463 -1
- data/CONTRIBUTING.md +2 -2
- data/README.md +16 -17
- data/Rakefile +1 -1
- data/lib/boot/strap.rb +102 -0
- data/lib/new_relic/agent/agent.rb +6 -0
- data/lib/new_relic/agent/agent_helpers/connect.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +1 -0
- data/lib/new_relic/agent/agent_helpers/startup.rb +7 -0
- data/lib/new_relic/agent/agent_logger.rb +1 -0
- data/lib/new_relic/agent/aws.rb +68 -0
- data/lib/new_relic/agent/configuration/default_source.rb +603 -105
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -1
- data/lib/new_relic/agent/configuration/manager.rb +28 -2
- data/lib/new_relic/agent/configuration/yaml_source.rb +7 -2
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +11 -11
- data/lib/new_relic/agent/database/obfuscator.rb +1 -0
- data/lib/new_relic/agent/database.rb +41 -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 +4 -2
- data/lib/new_relic/agent/error_collector.rb +37 -10
- data/lib/new_relic/agent/external.rb +2 -0
- data/lib/new_relic/agent/health_check.rb +136 -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_merchant.rb +0 -13
- data/lib/new_relic/agent/instrumentation/active_record.rb +7 -12
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +7 -3
- 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/active_record_subscriber.rb +9 -16
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +0 -2
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +0 -2
- data/lib/new_relic/agent/instrumentation/async_http.rb +2 -3
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose.rb +22 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +91 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis.rb +22 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +93 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/chain.rb +37 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/prepend.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs.rb +23 -0
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +14 -0
- data/lib/new_relic/agent/instrumentation/bunny.rb +3 -4
- data/lib/new_relic/agent/instrumentation/concurrent_ruby.rb +1 -3
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/curb.rb +4 -5
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -23
- data/lib/new_relic/agent/instrumentation/dynamodb/chain.rb +27 -0
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +64 -0
- data/lib/new_relic/agent/instrumentation/dynamodb/prepend.rb +19 -0
- data/lib/new_relic/agent/instrumentation/dynamodb.rb +23 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +53 -7
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -3
- data/lib/new_relic/agent/instrumentation/ethon.rb +1 -5
- data/lib/new_relic/agent/instrumentation/excon.rb +1 -17
- 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/fiber.rb +0 -2
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +0 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +1 -5
- data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpx.rb +1 -5
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
- data/lib/new_relic/agent/instrumentation/logstasher/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb +24 -0
- data/lib/new_relic/agent/instrumentation/logstasher/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/logstasher.rb +25 -0
- 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/memcache.rb +0 -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/opensearch/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/opensearch/instrumentation.rb +66 -0
- data/lib/{tasks/instrumentation_generator/templates/instrumentation.tt → new_relic/agent/instrumentation/opensearch/prepend.rb} +4 -4
- data/lib/new_relic/agent/instrumentation/opensearch.rb +23 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +3 -0
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +9 -5
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -2
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +72 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb +70 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +67 -0
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +25 -0
- data/lib/new_relic/agent/instrumentation/redis/cluster_middleware.rb +26 -0
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +2 -2
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +14 -11
- data/lib/new_relic/agent/instrumentation/redis/middleware.rb +3 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +11 -5
- data/lib/new_relic/agent/instrumentation/resque.rb +8 -6
- data/lib/new_relic/agent/instrumentation/roda.rb +5 -5
- data/lib/new_relic/agent/instrumentation/ruby_kafka/chain.rb +55 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +60 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +25 -0
- 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 +2 -2
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +9 -15
- data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -19
- data/lib/new_relic/agent/instrumentation/stripe.rb +1 -1
- data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +22 -1
- data/lib/new_relic/agent/instrumentation/thread.rb +0 -2
- data/lib/new_relic/agent/instrumentation/tilt.rb +0 -4
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +11 -5
- data/lib/new_relic/agent/instrumentation/view_component.rb +0 -2
- data/lib/new_relic/agent/javascript_instrumentor.rb +2 -3
- 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 +20 -3
- data/lib/new_relic/agent/log_event_aggregator.rb +119 -28
- data/lib/new_relic/agent/logging.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +16 -5
- 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 +8 -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 +247 -12
- data/lib/new_relic/agent/serverless_handler_event_sources.json +155 -0
- data/lib/new_relic/agent/serverless_handler_event_sources.rb +49 -0
- data/lib/new_relic/agent/span_event_primitive.rb +16 -11
- data/lib/new_relic/agent/system_info.rb +14 -0
- data/lib/new_relic/agent/threading/backtrace_node.rb +10 -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/external_request_segment.rb +0 -10
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +4 -1
- data/lib/new_relic/agent/transaction/request_attributes.rb +14 -7
- data/lib/new_relic/agent/transaction/trace_context.rb +34 -5
- data/lib/new_relic/agent/transaction/tracing.rb +3 -3
- data/lib/new_relic/agent/transaction.rb +4 -7
- 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 +124 -2
- data/lib/new_relic/constants.rb +1 -0
- data/lib/new_relic/control/frameworks/grape.rb +14 -0
- data/lib/new_relic/control/frameworks/padrino.rb +14 -0
- data/lib/new_relic/control/frameworks/rails4.rb +1 -3
- data/lib/new_relic/control/instance_methods.rb +6 -0
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/private_instance_methods.rb +4 -0
- data/lib/new_relic/control/security_interface.rb +57 -0
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +11 -14
- data/lib/new_relic/environment_report.rb +2 -2
- data/lib/new_relic/helper.rb +22 -0
- data/lib/new_relic/language_support.rb +3 -1
- data/lib/new_relic/local_environment.rb +1 -4
- data/lib/new_relic/rack/browser_monitoring.rb +20 -8
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +3 -2
- data/lib/tasks/config.rake +7 -3
- data/lib/tasks/gha.rake +31 -0
- data/lib/tasks/helpers/config.html.erb +3 -2
- data/lib/tasks/helpers/format.rb +1 -1
- data/lib/tasks/helpers/newrelicyml.rb +80 -13
- data/newrelic.yml +425 -162
- data/newrelic_rpm.gemspec +3 -1
- data/test/agent_helper.rb +24 -2
- metadata +91 -22
- 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 -121
- 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 -29
- 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
@@ -20,15 +20,15 @@ module NewRelic
|
|
20
20
|
# examine in order to look for a RUM insertion point.
|
21
21
|
SCAN_LIMIT = 50_000
|
22
22
|
|
23
|
-
CONTENT_TYPE = 'Content-Type'
|
24
|
-
CONTENT_DISPOSITION = 'Content-Disposition'
|
25
|
-
CONTENT_LENGTH = 'Content-Length'
|
23
|
+
CONTENT_TYPE = 'Content-Type'
|
24
|
+
CONTENT_DISPOSITION = 'Content-Disposition'
|
25
|
+
CONTENT_LENGTH = 'Content-Length'
|
26
26
|
ATTACHMENT = /attachment/.freeze
|
27
27
|
TEXT_HTML = %r{text/html}.freeze
|
28
28
|
|
29
|
-
BODY_START = '<body'
|
30
|
-
HEAD_START = '<head'
|
31
|
-
GT = '>'
|
29
|
+
BODY_START = '<body'
|
30
|
+
HEAD_START = '<head'
|
31
|
+
GT = '>'
|
32
32
|
|
33
33
|
ALREADY_INSTRUMENTED_KEY = 'newrelic.browser_monitoring_already_instrumented'
|
34
34
|
CHARSET_RE = /<\s*meta[^>]+charset\s*=[^>]*>/im.freeze
|
@@ -38,7 +38,7 @@ module NewRelic
|
|
38
38
|
result = @app.call(env)
|
39
39
|
(status, headers, response) = result
|
40
40
|
|
41
|
-
js_to_inject = NewRelic::Agent.browser_timing_header
|
41
|
+
js_to_inject = NewRelic::Agent.browser_timing_header(nonce(env))
|
42
42
|
if (js_to_inject != NewRelic::EMPTY_STR) && should_instrument?(env, status, headers)
|
43
43
|
response_string = autoinstrument_source(response, js_to_inject)
|
44
44
|
if headers.key?(CONTENT_LENGTH)
|
@@ -58,6 +58,14 @@ module NewRelic
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def nonce(env)
|
62
|
+
return unless NewRelic::Agent.config[:'browser_monitoring.content_security_policy_nonce']
|
63
|
+
return unless NewRelic::Agent.config[:framework] == :rails_notifications
|
64
|
+
return unless defined?(ActionDispatch::ContentSecurityPolicy::Request)
|
65
|
+
|
66
|
+
env[ActionDispatch::ContentSecurityPolicy::Request::NONCE]
|
67
|
+
end
|
68
|
+
|
61
69
|
def should_instrument?(env, status, headers)
|
62
70
|
NewRelic::Agent.config[:'browser_monitoring.auto_instrument'] &&
|
63
71
|
status == 200 &&
|
@@ -112,7 +120,11 @@ module NewRelic
|
|
112
120
|
end
|
113
121
|
|
114
122
|
def streaming?(env, headers)
|
115
|
-
#
|
123
|
+
# Up until version 8.0, Rails would set 'Transfer-Encoding' to 'chunked'
|
124
|
+
# to trigger the desired HTTP/1.1 based streaming functionality in Rack.
|
125
|
+
# With version v8.0+, Rails assumes that the web server will be using
|
126
|
+
# Rack v3+ or an equally modern alternative and simply leaves the
|
127
|
+
# streaming behavior up to them.
|
116
128
|
return true if headers && headers['Transfer-Encoding'] == 'chunked'
|
117
129
|
|
118
130
|
defined?(ActionController::Live) &&
|
data/lib/new_relic/version.rb
CHANGED
@@ -78,8 +78,9 @@ module Sequel
|
|
78
78
|
end
|
79
79
|
|
80
80
|
THREAD_SAFE_CONNECTION_POOL_CLASSES = [
|
81
|
-
(defined?(::Sequel::ThreadedConnectionPool) && ::Sequel::ThreadedConnectionPool)
|
82
|
-
|
81
|
+
(defined?(::Sequel::ThreadedConnectionPool) && ::Sequel::ThreadedConnectionPool),
|
82
|
+
(defined?(::Sequel::TimedQueueConnectionPool) && NewRelic::Helper.version_satisfied?(RUBY_VERSION, '>=', '3.2') && ::Sequel::TimedQueueConnectionPool)
|
83
|
+
].compact.freeze
|
83
84
|
|
84
85
|
def explainer_for(sql)
|
85
86
|
proc do |*|
|
data/lib/tasks/config.rake
CHANGED
@@ -20,15 +20,19 @@ namespace :newrelic do
|
|
20
20
|
ATTRIBUTES => '[Attributes](/docs/features/agent-attributes) are key-value pairs containing information that determines the properties of an event or transaction. These key-value pairs can be viewed within transaction traces in APM, traced errors in APM, transaction events in dashboards, and page views in dashboards. You can customize exactly which attributes will be sent to each of these destinations',
|
21
21
|
'transaction_tracer' => 'The [transaction traces](/docs/apm/traces/transaction-traces/transaction-traces) feature collects detailed information from a selection of transactions, including a summary of the calling sequence, a breakdown of time spent, and a list of SQL queries and their query plans (on mysql and postgresql). Available features depend on your New Relic subscription level.',
|
22
22
|
'error_collector' => "The agent collects and reports all uncaught exceptions by default. These configuration options allow you to customize the error collection.\n\nFor information on ignored and expected errors, [see this page on Error Analytics in APM](/docs/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-or-mark-expected/). To set expected errors via the `NewRelic::Agent.notice_error` Ruby method, [consult the Ruby agent API](/docs/agents/ruby-agent/api-guides/sending-handled-errors-new-relic/).",
|
23
|
-
'browser_monitoring' => "The browser
|
23
|
+
'browser_monitoring' => "The <InlinePopover type='browser' /> [page load timing](/docs/browser/new-relic-browser/page-load-timing/page-load-timing-process) feature (sometimes referred to as real user monitoring or RUM) gives you insight into the performance real users are experiencing with your website. This is accomplished by measuring the time it takes for your users' browsers to download and render your web pages by injecting a small amount of JavaScript code into the header and footer of each page.",
|
24
24
|
'application_logging' => "The Ruby agent supports [APM logs in context](/docs/apm/new-relic-apm/getting-started/get-started-logs-context). For some tips on configuring logs for the Ruby agent, see [Configure Ruby logs in context](/docs/logs/logs-context/configure-logs-context-ruby).\n\nAvailable logging-related config options include:",
|
25
25
|
'analytics_events' => '[New Relic dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-new-relic-one-dashboards) is a resource to gather and visualize data about your software and what it says about your business. With it you can quickly and easily create real-time dashboards to get immediate answers about end-user experiences, clickstreams, mobile activities, and server transactions.',
|
26
|
-
'ai_monitoring' => "This section includes Ruby agent configurations for setting up AI monitoring.\n\n<Callout variant='important'>You need to enable distributed tracing to capture trace and feedback data. It is turned on by default in Ruby agents 8.0.0 and higher.</Callout>"
|
26
|
+
'ai_monitoring' => "This section includes Ruby agent configurations for setting up AI monitoring.\n\n<Callout variant='important'>You need to enable distributed tracing to capture trace and feedback data. It is turned on by default in Ruby agents 8.0.0 and higher.</Callout>",
|
27
|
+
'security_agent' => "[New Relic Interactive Application Security Testing](https://docs.newrelic.com/docs/iast/introduction/) (IAST) tests your applications for any exploitable vulnerability by replaying the generated HTTP request with vulnerable payloads.\n\n<Callout variant='important'>Run IAST with non-production deployments only to avoid exposing vulnerabilities on your production software. \
|
28
|
+
IAST mode requires Ruby agent version 9.12.0 or higher and the [newrelic_security](https://rubygems.org/gems/newrelic_security) gem. Security agent configurations are disabled by default.</Callout>"
|
27
29
|
}
|
28
30
|
|
29
31
|
NAME_OVERRIDES = {
|
30
32
|
'slow_sql' => 'Slow SQL [#slow-sql]',
|
31
|
-
'custom_insights_events' => 'Custom Events [#custom-events]'
|
33
|
+
'custom_insights_events' => 'Custom Events [#custom-events]',
|
34
|
+
'ai_monitoring' => 'AI Monitoring [#ai-monitoring]',
|
35
|
+
'security_agent' => 'Security Agent [#security-agent]'
|
32
36
|
}
|
33
37
|
|
34
38
|
desc 'Describe available New Relic configuration settings'
|
data/lib/tasks/gha.rake
ADDED
@@ -0,0 +1,31 @@
|
|
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 'yaml'
|
6
|
+
require_relative 'helpers/version_bump'
|
7
|
+
|
8
|
+
# gha = GitHub Actions
|
9
|
+
namespace :gha do
|
10
|
+
# See .github/versions.yml
|
11
|
+
desc 'Update 3rd party action versions across all workflows'
|
12
|
+
task :update_versions do
|
13
|
+
gh_dir = File.expand_path('../../../.github', __FILE__)
|
14
|
+
info = YAML.load_file(File.join(gh_dir, 'versions.yml'))
|
15
|
+
workflows = Dir.glob(File.join(gh_dir, 'workflows', '*.yml'))
|
16
|
+
workflows.each do |workflow|
|
17
|
+
original = File.read(workflow)
|
18
|
+
modified = original.dup
|
19
|
+
info.each do |action, settings|
|
20
|
+
modified.gsub!(/uses: #{action}.*$/, "uses: #{action}@#{settings[:sha]} # tag #{settings[:tag]}")
|
21
|
+
end
|
22
|
+
|
23
|
+
if original != modified
|
24
|
+
File.open(workflow, 'w') { |f| f.puts modified }
|
25
|
+
puts "Updated #{workflow} with changes"
|
26
|
+
else
|
27
|
+
puts "#{workflow} remains unchanged"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -10,6 +10,7 @@ redirects:
|
|
10
10
|
- /docs/ruby/ruby-agent-configuration
|
11
11
|
- /docs/agents/ruby-agent/installation-and-configuration/ruby-agent-configuration
|
12
12
|
- /docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
|
13
|
+
freshnessValidatedDate: never
|
13
14
|
---
|
14
15
|
|
15
16
|
<CONTRIBUTOR_NOTE>
|
@@ -70,12 +71,12 @@ The Ruby agent looks for the following environment variables, in this order, to
|
|
70
71
|
|
71
72
|
If the Ruby agent doesn't detect values for any of those environment variables, it will default the application environment to `development` and read from the `development` section of the `newrelic.yml` config file.
|
72
73
|
|
73
|
-
When running the Ruby agent in a Rails app, the agent first looks for the `NEW_RELIC_ENV` environment variable to
|
74
|
+
When running the Ruby agent in a Rails app, the agent first looks for the `NEW_RELIC_ENV` environment variable to find the application environment and which section of the `newrelic.yml` to use. If `NEW_RELIC_ENV` is not present, the agent uses the Rails environment (`RAILS_ENV`).
|
74
75
|
|
75
76
|
When you edit the config file, be sure to:
|
76
77
|
|
77
78
|
* Indent only with two spaces.
|
78
|
-
* Indent only where relevant, in
|
79
|
+
* Indent only where relevant, in sections such as **`error_collector`**.
|
79
80
|
|
80
81
|
If you do not indent correctly, the agent may throw an `Unable to parse configuration file` error on startup.
|
81
82
|
|
data/lib/tasks/helpers/format.rb
CHANGED
@@ -45,6 +45,34 @@ module NewRelicYML
|
|
45
45
|
|
46
46
|
HEADER
|
47
47
|
|
48
|
+
SECURITY_BEGIN = <<-SECURITY
|
49
|
+
# BEGIN security agent
|
50
|
+
#
|
51
|
+
# NOTE: At this time, the security agent is intended for use only within
|
52
|
+
# a dedicated security testing environment with data that can tolerate
|
53
|
+
# modification or deletion. The security agent is available as a
|
54
|
+
# separate Ruby gem, newrelic_security. It is recommended that this
|
55
|
+
# separate gem only be introduced to a security testing environment
|
56
|
+
# by leveraging Bundler grouping like so:
|
57
|
+
#
|
58
|
+
# # Gemfile
|
59
|
+
# gem 'newrelic_rpm' # New Relic APM observability agent
|
60
|
+
# gem 'newrelic-infinite_tracing' # New Relic Infinite Tracing
|
61
|
+
#
|
62
|
+
# group :security do
|
63
|
+
# gem 'newrelic_security', require: false # New Relic security agent
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# NOTE: All "security.*" configuration parameters are related only to the
|
67
|
+
# security agent, and all other configuration parameters that may
|
68
|
+
# have "security" in the name somewhere are related to the APM agent.
|
69
|
+
|
70
|
+
SECURITY
|
71
|
+
|
72
|
+
SECURITY_END = <<-SECURITY
|
73
|
+
# END security agent
|
74
|
+
SECURITY
|
75
|
+
|
48
76
|
FOOTER = <<~FOOTER
|
49
77
|
# Environment-specific settings are in this section.
|
50
78
|
# RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment.
|
@@ -67,16 +95,35 @@ module NewRelicYML
|
|
67
95
|
FOOTER
|
68
96
|
|
69
97
|
def self.get_configs(defaults)
|
70
|
-
|
98
|
+
agent_configs = {}
|
99
|
+
security_configs = {}
|
100
|
+
|
101
|
+
defaults.sort.each do |key, value|
|
71
102
|
next if CRITICAL.include?(key) || SKIP.include?(key)
|
72
103
|
|
73
104
|
next unless public_config?(value) && !deprecated?(value)
|
74
105
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
106
|
+
# TODO: OLD RUBIES < 2.6
|
107
|
+
# Remove `to_s`. `start_with?` doesn't accept symbols in Ruby <2.6
|
108
|
+
if key.to_s.start_with?('security.')
|
109
|
+
description, default = build_config(key, value)
|
110
|
+
security_configs[key] = {description: description, default: default}
|
111
|
+
next
|
112
|
+
end
|
113
|
+
|
114
|
+
description, default = build_config(key, value)
|
115
|
+
agent_configs[key] = {description: description, default: default}
|
79
116
|
end
|
117
|
+
|
118
|
+
[agent_configs, security_configs]
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.build_config(key, value)
|
122
|
+
sanitized_description = sanitize_description(value[:description])
|
123
|
+
description = format_description(sanitized_description)
|
124
|
+
default = default_value(key, value)
|
125
|
+
|
126
|
+
[description, default]
|
80
127
|
end
|
81
128
|
|
82
129
|
def self.public_config?(value)
|
@@ -94,6 +141,8 @@ module NewRelicYML
|
|
94
141
|
description.gsub!(/<InlinePopover type="(.*)" \/>/, '\1')
|
95
142
|
# remove hyperlinks
|
96
143
|
description.gsub!(/\[([^\]]+)\]\([^\)]+\)/, '\1')
|
144
|
+
# delete lines with code fences including the language
|
145
|
+
description.gsub!(/```[a-zA-Z0-9_]*\n(.*?)```/m, '\1')
|
97
146
|
# remove single pairs of backticks
|
98
147
|
description.gsub!(/`([^`]+)`/, '\1')
|
99
148
|
# removed href links
|
@@ -103,10 +152,13 @@ module NewRelicYML
|
|
103
152
|
end
|
104
153
|
|
105
154
|
def self.format_description(description)
|
155
|
+
# remove all tab characters
|
156
|
+
description.delete!("\t")
|
106
157
|
# remove leading and trailing whitespace
|
107
158
|
description.strip!
|
108
|
-
# wrap text after 80 characters
|
109
|
-
|
159
|
+
# wrap text after 80 characters, assuming we're at one tabstop's (two
|
160
|
+
# spaces') level of indentation already, keep leading whitespace
|
161
|
+
description.gsub!(/(.{1,78})(\s|\Z)/, "\\1\n")
|
110
162
|
# add hashtags to lines
|
111
163
|
description = description.split("\n").map { |line| " # #{line}" }.join("\n")
|
112
164
|
|
@@ -125,15 +177,30 @@ module NewRelicYML
|
|
125
177
|
end
|
126
178
|
end
|
127
179
|
|
128
|
-
def self.
|
129
|
-
|
130
|
-
|
180
|
+
def self.agent_configs_yml(agent_configs)
|
181
|
+
agent_yml = ''
|
182
|
+
agent_configs.each do |key, value|
|
183
|
+
agent_yml += "#{value[:description]}\n # #{key}: #{value[:default]}\n\n"
|
184
|
+
end
|
185
|
+
|
186
|
+
agent_yml
|
187
|
+
end
|
131
188
|
|
132
|
-
|
133
|
-
|
189
|
+
def self.security_configs_yml(security_configs)
|
190
|
+
security_yml = ''
|
191
|
+
security_configs.each do |key, value|
|
192
|
+
security_yml += "#{value[:description]}\n # #{key}: #{value[:default]}\n\n"
|
134
193
|
end
|
135
194
|
|
136
|
-
|
195
|
+
security_yml
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.build_string(defaults)
|
199
|
+
agent_configs, security_configs = get_configs(defaults)
|
200
|
+
agent_string = agent_configs_yml(agent_configs)
|
201
|
+
security_string = security_configs_yml(security_configs)
|
202
|
+
|
203
|
+
agent_string + SECURITY_BEGIN + security_string + SECURITY_END + "\n"
|
137
204
|
end
|
138
205
|
|
139
206
|
# :nocov:
|