newrelic_rpm 8.16.0 → 9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -41
- data/.rubocop_todo.yml +13 -14
- data/.simplecov +1 -1
- data/CHANGELOG.md +184 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -1
- data/Guardfile +7 -7
- data/README.md +3 -2
- data/Rakefile +8 -8
- data/Thorfile +1 -1
- data/bin/nrdebug +36 -36
- data/init.rb +1 -1
- data/lib/new_relic/agent/agent.rb +3 -16
- data/lib/new_relic/agent/agent_helpers/connect.rb +5 -10
- data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
- data/lib/new_relic/agent/agent_helpers/special_startup.rb +3 -4
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
- data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
- data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
- data/lib/new_relic/agent/agent_logger.rb +9 -9
- data/lib/new_relic/agent/attribute_filter.rb +2 -4
- data/lib/new_relic/agent/attribute_processing.rb +2 -2
- data/lib/new_relic/agent/audit_logger.rb +5 -5
- data/lib/new_relic/agent/autostart.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command.rb +2 -2
- data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +8 -8
- data/lib/new_relic/agent/configuration/default_source.rb +155 -530
- data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
- data/lib/new_relic/agent/configuration/high_security_source.rb +3 -5
- data/lib/new_relic/agent/configuration/manager.rb +2 -2
- data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -26
- data/lib/new_relic/agent/configuration/server_source.rb +24 -24
- data/lib/new_relic/agent/configuration/yaml_source.rb +4 -4
- data/lib/new_relic/agent/connect/request_builder.rb +1 -1
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
- data/lib/new_relic/agent/database/obfuscator.rb +2 -2
- data/lib/new_relic/agent/database.rb +4 -18
- data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
- data/lib/new_relic/agent/datastores/redis.rb +6 -6
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +8 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
- data/lib/new_relic/agent/distributed_tracing.rb +5 -5
- data/lib/new_relic/agent/error_collector.rb +36 -8
- data/lib/new_relic/agent/error_filter.rb +5 -5
- data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
- data/lib/new_relic/agent/event_loop.rb +3 -3
- data/lib/new_relic/agent/external.rb +1 -1
- data/lib/new_relic/agent/harvester.rb +1 -3
- data/lib/new_relic/agent/heap.rb +2 -1
- data/lib/new_relic/agent/hostname.rb +1 -1
- data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
- data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +5 -2
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_job.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +3 -2
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -35
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +6 -4
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +1 -1
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +20 -0
- data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +24 -0
- data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +18 -0
- data/lib/new_relic/agent/instrumentation/fiber.rb +25 -0
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +8 -8
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +5 -5
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +8 -15
- data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sequel.rb +8 -9
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +6 -5
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +3 -7
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +5 -5
- data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
- data/lib/new_relic/agent/linking_metadata.rb +2 -2
- data/lib/new_relic/agent/log_event_aggregator.rb +15 -15
- data/lib/new_relic/agent/logging.rb +73 -33
- data/lib/new_relic/agent/messaging.rb +7 -5
- data/lib/new_relic/agent/method_tracer.rb +6 -6
- data/lib/new_relic/agent/method_tracer_helpers.rb +1 -1
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -5
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +0 -1
- data/lib/new_relic/agent/new_relic_service.rb +15 -15
- data/lib/new_relic/agent/obfuscator.rb +1 -1
- data/lib/new_relic/agent/parameter_filtering.rb +6 -6
- data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
- data/lib/new_relic/agent/pipe_service.rb +5 -3
- data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +0 -1
- data/lib/new_relic/agent/sampler.rb +1 -1
- data/lib/new_relic/agent/sampler_collection.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
- data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/span_event_primitive.rb +2 -2
- data/lib/new_relic/agent/sql_sampler.rb +2 -2
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/system_info.rb +10 -10
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
- data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
- data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +18 -8
- data/lib/new_relic/agent/transaction/abstract_segment.rb +9 -9
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +6 -6
- data/lib/new_relic/agent/transaction/external_request_segment.rb +11 -11
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/request_attributes.rb +2 -2
- data/lib/new_relic/agent/transaction/segment.rb +1 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/trace.rb +1 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
- data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
- data/lib/new_relic/agent/transaction/tracing.rb +4 -4
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +56 -52
- data/lib/new_relic/agent/transaction_error_primitive.rb +5 -5
- data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
- data/lib/new_relic/agent/transaction_sampler.rb +3 -3
- data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
- data/lib/new_relic/agent/utilization/aws.rb +1 -1
- data/lib/new_relic/agent/utilization/azure.rb +3 -3
- data/lib/new_relic/agent/utilization/gcp.rb +3 -3
- data/lib/new_relic/agent/utilization/pcf.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +1 -1
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +79 -35
- data/lib/new_relic/cli/command.rb +3 -3
- data/lib/new_relic/cli/commands/deployments.rb +26 -25
- data/lib/new_relic/cli/commands/install.rb +23 -23
- data/lib/new_relic/collection_helper.rb +2 -2
- data/lib/new_relic/constants.rb +7 -8
- data/lib/new_relic/control/class_methods.rb +3 -3
- data/lib/new_relic/control/frameworks/rails.rb +30 -18
- data/lib/new_relic/control/instance_methods.rb +6 -6
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/private_instance_methods.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +4 -17
- data/lib/new_relic/environment_report.rb +4 -4
- data/lib/new_relic/helper.rb +2 -1
- data/lib/new_relic/language_support.rb +1 -1
- data/lib/new_relic/latest_changes.rb +5 -5
- data/lib/new_relic/local_environment.rb +0 -10
- data/lib/new_relic/noticed_error.rb +20 -18
- data/lib/new_relic/rack/browser_monitoring.rb +20 -16
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
- data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
- data/lib/new_relic/supportability_helper.rb +2 -1
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +4 -4
- data/lib/sequel/extensions/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +5 -5
- data/lib/sequel/plugins/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +4 -4
- data/lib/tasks/config.rake +12 -12
- data/lib/tasks/coverage_report.rake +3 -3
- data/lib/tasks/helpers/format.rb +10 -10
- data/lib/tasks/helpers/removers.rb +5 -5
- data/lib/tasks/install.rake +4 -4
- data/lib/tasks/instrumentation_generator/instrumentation.thor +7 -10
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +1 -1
- data/lib/tasks/multiverse.rb +12 -6
- data/lib/tasks/tests.rake +6 -6
- data/newrelic.yml +5 -8
- data/newrelic_rpm.gemspec +29 -26
- data/test/agent_helper.rb +25 -24
- metadata +13 -14
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -83
- data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -33
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +0 -215
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -36
- data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -41
@@ -94,14 +94,14 @@ module NewRelic
|
|
94
94
|
elsif type == Array
|
95
95
|
self[config_key] = value.split(/\s*,\s*/)
|
96
96
|
elsif type == NewRelic::Agent::Configuration::Boolean
|
97
|
-
if
|
97
|
+
if /false|off|no/i.match?(value)
|
98
98
|
self[config_key] = false
|
99
99
|
elsif !value.nil?
|
100
100
|
self[config_key] = true
|
101
101
|
end
|
102
102
|
else
|
103
103
|
::NewRelic::Agent.logger.info("#{environment_key} does not have a corresponding configuration setting (#{config_key} does not exist).")
|
104
|
-
::NewRelic::Agent.logger.info(
|
104
|
+
::NewRelic::Agent.logger.info('Run `rake newrelic:config:docs` or visit https://newrelic.com/docs/ruby/ruby-agent-configuration to see a list of available configuration settings.')
|
105
105
|
self[config_key] = value
|
106
106
|
end
|
107
107
|
end
|
@@ -11,8 +11,6 @@ module NewRelic
|
|
11
11
|
def initialize(local_settings)
|
12
12
|
super({
|
13
13
|
:capture_params => false,
|
14
|
-
:'resque.capture_params' => false,
|
15
|
-
:'sidekiq.capture_params' => false,
|
16
14
|
:'attributes.include' => [],
|
17
15
|
|
18
16
|
:'transaction_tracer.record_sql' => record_sql_setting(local_settings, :'transaction_tracer.record_sql'),
|
@@ -26,9 +24,9 @@ module NewRelic
|
|
26
24
|
})
|
27
25
|
end
|
28
26
|
|
29
|
-
OFF =
|
30
|
-
RAW =
|
31
|
-
OBFUSCATED =
|
27
|
+
OFF = 'off'.freeze
|
28
|
+
RAW = 'raw'.freeze
|
29
|
+
OBFUSCATED = 'obfuscated'.freeze
|
32
30
|
|
33
31
|
SET_TO_OBFUSCATED = [RAW, OBFUSCATED]
|
34
32
|
|
@@ -241,8 +241,8 @@ module NewRelic
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
-
MALFORMED_LABELS_WARNING =
|
245
|
-
PARSING_LABELS_FAILURE =
|
244
|
+
MALFORMED_LABELS_WARNING = 'Skipping malformed labels configuration'
|
245
|
+
PARSING_LABELS_FAILURE = 'Failure during parsing labels. Ignoring and carrying on with connect.'
|
246
246
|
|
247
247
|
MAX_LABEL_COUNT = 64
|
248
248
|
MAX_LABEL_LENGTH = 255
|
@@ -51,7 +51,7 @@ module NewRelic
|
|
51
51
|
# permitted by the security policy and is also enabled by the config
|
52
52
|
|
53
53
|
SECURITY_SETTINGS_MAP = {
|
54
|
-
|
54
|
+
'record_sql' => [
|
55
55
|
{
|
56
56
|
option: :'transaction_tracer.record_sql',
|
57
57
|
supported: true,
|
@@ -96,7 +96,7 @@ module NewRelic
|
|
96
96
|
permitted_fn: nil
|
97
97
|
}
|
98
98
|
],
|
99
|
-
|
99
|
+
'attributes_include' => [
|
100
100
|
{
|
101
101
|
option: :'attributes.include',
|
102
102
|
supported: true,
|
@@ -147,7 +147,7 @@ module NewRelic
|
|
147
147
|
permitted_fn: nil
|
148
148
|
}
|
149
149
|
],
|
150
|
-
|
150
|
+
'allow_raw_exception_messages' => [
|
151
151
|
{
|
152
152
|
option: :'strip_exception_messages.enabled',
|
153
153
|
supported: true,
|
@@ -156,7 +156,7 @@ module NewRelic
|
|
156
156
|
permitted_fn: nil
|
157
157
|
}
|
158
158
|
],
|
159
|
-
|
159
|
+
'custom_events' => [
|
160
160
|
{
|
161
161
|
option: :'custom_insights_events.enabled',
|
162
162
|
supported: true,
|
@@ -165,7 +165,7 @@ module NewRelic
|
|
165
165
|
permitted_fn: nil
|
166
166
|
}
|
167
167
|
],
|
168
|
-
|
168
|
+
'custom_parameters' => [
|
169
169
|
{
|
170
170
|
option: :'custom_attributes.enabled',
|
171
171
|
supported: true,
|
@@ -174,7 +174,7 @@ module NewRelic
|
|
174
174
|
permitted_fn: nil
|
175
175
|
}
|
176
176
|
],
|
177
|
-
|
177
|
+
'custom_instrumentation_editor' => [
|
178
178
|
{
|
179
179
|
option: nil,
|
180
180
|
supported: false,
|
@@ -183,7 +183,7 @@ module NewRelic
|
|
183
183
|
permitted_fn: nil
|
184
184
|
}
|
185
185
|
],
|
186
|
-
|
186
|
+
'message_parameters' => [
|
187
187
|
{
|
188
188
|
option: :'message_tracer.segment_parameters.enabled',
|
189
189
|
supported: true,
|
@@ -191,22 +191,6 @@ module NewRelic
|
|
191
191
|
disabled_value: false,
|
192
192
|
permitted_fn: nil
|
193
193
|
}
|
194
|
-
],
|
195
|
-
"job_arguments" => [
|
196
|
-
{
|
197
|
-
option: :'resque.capture_params',
|
198
|
-
supported: true,
|
199
|
-
enabled_fn: method(:enabled?),
|
200
|
-
disabled_value: false,
|
201
|
-
permitted_fn: nil
|
202
|
-
},
|
203
|
-
{
|
204
|
-
option: :'sidekiq.capture_params',
|
205
|
-
supported: true,
|
206
|
-
enabled_fn: method(:enabled?),
|
207
|
-
disabled_value: false,
|
208
|
-
permitted_fn: nil
|
209
|
-
}
|
210
194
|
]
|
211
195
|
}
|
212
196
|
|
@@ -214,8 +198,8 @@ module NewRelic
|
|
214
198
|
super(build_overrides(security_policies))
|
215
199
|
end
|
216
200
|
|
217
|
-
ENABLED =
|
218
|
-
COLON_COLON =
|
201
|
+
ENABLED = 'enabled'.freeze
|
202
|
+
COLON_COLON = '::'.freeze
|
219
203
|
|
220
204
|
def build_overrides(security_policies)
|
221
205
|
security_policies.inject({}) do |settings, (policy_name, policy_settings)|
|
@@ -238,7 +222,7 @@ module NewRelic
|
|
238
222
|
settings[policy[:option]] = policy[:disabled_value]
|
239
223
|
NewRelic::Agent.logger.info( \
|
240
224
|
"Setting applied: {#{policy[:option]}: #{policy[:disabled_value]}}. " \
|
241
|
-
|
225
|
+
'Source: SecurityPolicySource'
|
242
226
|
)
|
243
227
|
end
|
244
228
|
end
|
@@ -10,27 +10,27 @@ module NewRelic
|
|
10
10
|
# response, but should still be merged in as config settings to the
|
11
11
|
# main agent configuration.
|
12
12
|
TOP_LEVEL_KEYS = [
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
13
|
+
'account_id',
|
14
|
+
'apdex_t',
|
15
|
+
'application_id',
|
16
|
+
'beacon',
|
17
|
+
'browser_key',
|
18
|
+
'browser_monitoring.debug',
|
19
|
+
'browser_monitoring.loader',
|
20
|
+
'browser_monitoring.loader_version',
|
21
|
+
'cross_process_id',
|
22
|
+
'data_report_period',
|
23
|
+
'encoding_key',
|
24
|
+
'entity_guid',
|
25
|
+
'error_beacon',
|
26
|
+
'js_agent_file',
|
27
|
+
'js_agent_loader',
|
28
|
+
'max_payload_size_in_bytes',
|
29
|
+
'primary_application_id',
|
30
|
+
'sampling_target',
|
31
|
+
'sampling_target_period_in_seconds',
|
32
|
+
'trusted_account_ids',
|
33
|
+
'trusted_account_key'
|
34
34
|
]
|
35
35
|
|
36
36
|
def initialize(connect_reply, existing_config = {})
|
@@ -70,7 +70,7 @@ module NewRelic
|
|
70
70
|
|
71
71
|
def fix_transaction_threshold(merged_settings)
|
72
72
|
# when value is "apdex_f" remove the config and defer to default
|
73
|
-
if merged_settings['transaction_tracer.transaction_threshold'].to_s
|
73
|
+
if /apdex_f/i.match?(merged_settings['transaction_tracer.transaction_threshold'].to_s)
|
74
74
|
merged_settings.delete('transaction_tracer.transaction_threshold')
|
75
75
|
end
|
76
76
|
end
|
@@ -102,8 +102,8 @@ module NewRelic
|
|
102
102
|
if event_harvest_config.nil? \
|
103
103
|
|| event_harvest_config['harvest_limits'].values.min < 0 \
|
104
104
|
|| (event_harvest_config['report_period_ms'] / 1000) <= 0
|
105
|
-
NewRelic::Agent.logger.warn(
|
106
|
-
|
105
|
+
NewRelic::Agent.logger.warn('Invalid event harvest config found ' \
|
106
|
+
'in connect response; using default event report period.')
|
107
107
|
false
|
108
108
|
else
|
109
109
|
true
|
@@ -84,7 +84,7 @@ module NewRelic
|
|
84
84
|
# so warn about it since it's very likely to be unintended.
|
85
85
|
NewRelic::Agent.logger.warn(
|
86
86
|
"No configuration file found. Working directory = #{Dir.pwd}",
|
87
|
-
"Looked in these locations (based on #{based_on}): #{candidate_paths.join(
|
87
|
+
"Looked in these locations (based on #{based_on}): #{candidate_paths.join(', ')}"
|
88
88
|
)
|
89
89
|
end
|
90
90
|
|
@@ -96,7 +96,7 @@ module NewRelic
|
|
96
96
|
file.gsub!(/^\s*#.*$/, '#')
|
97
97
|
ERB.new(file).result(binding)
|
98
98
|
rescue ScriptError, StandardError => e
|
99
|
-
log_failure(
|
99
|
+
log_failure('Failed ERB processing configuration file. This is typically caused by a Ruby error in <% %> templating blocks in your newrelic.yml file.', e)
|
100
100
|
nil
|
101
101
|
end
|
102
102
|
end
|
@@ -124,7 +124,7 @@ module NewRelic
|
|
124
124
|
config['transaction_tracer']['transaction_threshold'].to_s =~ /apdex_f/i
|
125
125
|
# when value is "apdex_f" remove the config and defer to default
|
126
126
|
config['transaction_tracer'].delete('transaction_threshold')
|
127
|
-
elsif config['transaction_tracer.transaction_threshold'].to_s
|
127
|
+
elsif /apdex_f/i.match?(config['transaction_tracer.transaction_threshold'].to_s)
|
128
128
|
config.delete('transaction_tracer.transaction_threshold')
|
129
129
|
end
|
130
130
|
end
|
@@ -135,7 +135,7 @@ module NewRelic
|
|
135
135
|
if 'auto' == config[option]
|
136
136
|
config.delete(option)
|
137
137
|
elsif !config[option].nil? && !is_boolean?(config[option])
|
138
|
-
coerced_value =
|
138
|
+
coerced_value = config[option].to_s.match?(/yes|on|true/i)
|
139
139
|
if !coerced_value
|
140
140
|
log_failure("Unexpected value (#{config[option]}) for '#{option}' in #{@path}")
|
141
141
|
end
|
@@ -37,7 +37,7 @@ module NewRelic
|
|
37
37
|
|
38
38
|
def add_server_side_config(config_data)
|
39
39
|
if config_data['agent_config']
|
40
|
-
::NewRelic::Agent.logger.debug(
|
40
|
+
::NewRelic::Agent.logger.debug('Using config from server')
|
41
41
|
end
|
42
42
|
|
43
43
|
::NewRelic::Agent.logger.debug("Server provided config: #{config_data.inspect}")
|
@@ -27,7 +27,7 @@ module NewRelic
|
|
27
27
|
return unless enabled?
|
28
28
|
|
29
29
|
type = @type_strings[type]
|
30
|
-
unless type
|
30
|
+
unless EVENT_TYPE_REGEX.match?(type)
|
31
31
|
note_dropped_event(type)
|
32
32
|
return false
|
33
33
|
end
|
@@ -71,9 +71,9 @@ module NewRelic
|
|
71
71
|
|
72
72
|
def record_supportability_metrics(total_count, captured_count, dropped_count)
|
73
73
|
engine = NewRelic::Agent.instance.stats_engine
|
74
|
-
engine.tl_record_supportability_metric_count(
|
75
|
-
engine.tl_record_supportability_metric_count(
|
76
|
-
engine.tl_record_supportability_metric_count(
|
74
|
+
engine.tl_record_supportability_metric_count('Events/Customer/Seen', total_count)
|
75
|
+
engine.tl_record_supportability_metric_count('Events/Customer/Sent', captured_count)
|
76
|
+
engine.tl_record_supportability_metric_count('Events/Customer/Dropped', dropped_count)
|
77
77
|
end
|
78
78
|
|
79
79
|
def note_dropped_event(type)
|
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
rescue => e
|
37
37
|
begin
|
38
38
|
# guarantees no throw from explain_sql
|
39
|
-
::NewRelic::Agent.logger.error(
|
39
|
+
::NewRelic::Agent.logger.error('Error getting query plan:', e)
|
40
40
|
nil
|
41
41
|
rescue
|
42
42
|
# double exception. throw up your hands
|
@@ -49,10 +49,10 @@ module NewRelic
|
|
49
49
|
}
|
50
50
|
|
51
51
|
PLACEHOLDER = '?'.freeze
|
52
|
-
FAILED_TO_OBFUSCATE_MESSAGE =
|
52
|
+
FAILED_TO_OBFUSCATE_MESSAGE = 'Failed to obfuscate SQL query - quote characters remained after obfuscation'.freeze
|
53
53
|
|
54
54
|
def obfuscate_single_quote_literals(sql)
|
55
|
-
return sql unless sql
|
55
|
+
return sql unless sql&.match?(COMPONENTS_REGEX_MAP[:single_quotes])
|
56
56
|
|
57
57
|
sql.gsub(COMPONENTS_REGEX_MAP[:single_quotes], PLACEHOLDER)
|
58
58
|
end
|
@@ -13,8 +13,8 @@ module NewRelic
|
|
13
13
|
|
14
14
|
attr_reader :obfuscator
|
15
15
|
|
16
|
-
QUERY_TOO_LARGE_MESSAGE =
|
17
|
-
ELLIPSIS =
|
16
|
+
QUERY_TOO_LARGE_MESSAGE = 'Query too large (over 16k characters) to safely obfuscate'.freeze
|
17
|
+
ELLIPSIS = '...'.freeze
|
18
18
|
|
19
19
|
def initialize
|
20
20
|
reset
|
@@ -7,24 +7,10 @@ require 'new_relic/agent/database/explain_plan_helpers'
|
|
7
7
|
require 'new_relic/agent/database/obfuscator'
|
8
8
|
|
9
9
|
module NewRelic
|
10
|
-
# columns for a mysql explain plan
|
11
|
-
MYSQL_EXPLAIN_COLUMNS = [
|
12
|
-
"Id",
|
13
|
-
"Select Type",
|
14
|
-
"Table",
|
15
|
-
"Type",
|
16
|
-
"Possible Keys",
|
17
|
-
"Key",
|
18
|
-
"Key Length",
|
19
|
-
"Ref",
|
20
|
-
"Rows",
|
21
|
-
"Extra"
|
22
|
-
].freeze
|
23
|
-
|
24
10
|
module Agent
|
25
11
|
module Database
|
26
12
|
MAX_QUERY_LENGTH = 16384
|
27
|
-
ELLIPSIS =
|
13
|
+
ELLIPSIS = '...'.freeze
|
28
14
|
|
29
15
|
extend self
|
30
16
|
|
@@ -164,7 +150,7 @@ module NewRelic
|
|
164
150
|
begin
|
165
151
|
@connections[config] = yield(config)
|
166
152
|
rescue => e
|
167
|
-
::NewRelic::Agent.logger.error(
|
153
|
+
::NewRelic::Agent.logger.error('Caught exception trying to get connection to DB for explain.', e)
|
168
154
|
nil
|
169
155
|
end
|
170
156
|
end
|
@@ -188,7 +174,7 @@ module NewRelic
|
|
188
174
|
|
189
175
|
attr_accessor :sql, :config, :explainer, :binds, :name, :host, :port_path_or_id, :database_name
|
190
176
|
|
191
|
-
DEFAULT_QUERY_NAME =
|
177
|
+
DEFAULT_QUERY_NAME = 'SQL'.freeze
|
192
178
|
|
193
179
|
def initialize(sql, config = {}, explainer = nil, binds = nil, name = DEFAULT_QUERY_NAME, host = nil, port_path_or_id = nil, database_name = nil)
|
194
180
|
@sql = Database.capture_query(sql)
|
@@ -233,7 +219,7 @@ module NewRelic
|
|
233
219
|
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
234
220
|
plan = @explainer.call(self)
|
235
221
|
::NewRelic::Agent.record_metric(
|
236
|
-
|
222
|
+
'Supportability/Database/execute_explain_plan',
|
237
223
|
Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
238
224
|
)
|
239
225
|
return process_resultset(plan, adapter) if plan
|
@@ -6,12 +6,12 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
module Datastores
|
8
8
|
module MetricHelper
|
9
|
-
ROLLUP_METRIC =
|
10
|
-
OTHER =
|
9
|
+
ROLLUP_METRIC = 'Datastore/all'.freeze
|
10
|
+
OTHER = 'Other'.freeze
|
11
11
|
|
12
|
-
ALL =
|
13
|
-
ALL_WEB =
|
14
|
-
ALL_OTHER =
|
12
|
+
ALL = 'all'.freeze
|
13
|
+
ALL_WEB = 'allWeb'.freeze
|
14
|
+
ALL_OTHER = 'allOther'.freeze
|
15
15
|
|
16
16
|
def self.statement_metric_for(product, collection, operation)
|
17
17
|
"Datastore/statement/#{product}/#{collection}/#{operation}"
|
@@ -53,7 +53,7 @@ module NewRelic
|
|
53
53
|
|
54
54
|
[name.to_s, collection]
|
55
55
|
rescue => e
|
56
|
-
NewRelic::Agent.logger.debug(
|
56
|
+
NewRelic::Agent.logger.debug('Failure during Mongo metric generation', e)
|
57
57
|
nil
|
58
58
|
end
|
59
59
|
|
@@ -64,10 +64,10 @@ module NewRelic
|
|
64
64
|
NAMES_IN_SELECTOR = [
|
65
65
|
:findandmodify,
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
'aggregate',
|
68
|
+
'count',
|
69
|
+
'group',
|
70
|
+
'mapreduce',
|
71
71
|
|
72
72
|
:distinct,
|
73
73
|
|
@@ -91,18 +91,18 @@ module NewRelic
|
|
91
91
|
if command_key
|
92
92
|
command_key.to_sym
|
93
93
|
else
|
94
|
-
NewRelic::Agent.increment_metric(
|
94
|
+
NewRelic::Agent.increment_metric('Supportability/Mongo/UnknownCollection')
|
95
95
|
payload[:selector].first.first unless command_key
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
CMD_COLLECTION =
|
99
|
+
CMD_COLLECTION = '$cmd'.freeze
|
100
100
|
|
101
101
|
def self.get_collection_from_selector(command_key, payload)
|
102
102
|
if command_key
|
103
103
|
payload[:selector][command_key]
|
104
104
|
else
|
105
|
-
NewRelic::Agent.increment_metric(
|
105
|
+
NewRelic::Agent.increment_metric('Supportability/Mongo/UnknownCollection')
|
106
106
|
CMD_COLLECTION
|
107
107
|
end
|
108
108
|
end
|
@@ -124,11 +124,11 @@ module NewRelic
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def self.create_index?(name, payload)
|
127
|
-
name == :insert && payload[:collection] ==
|
127
|
+
name == :insert && payload[:collection] == 'system.indexes'
|
128
128
|
end
|
129
129
|
|
130
130
|
def self.drop_indexes?(name, payload)
|
131
|
-
name == :deleteIndexes && payload[:selector] && payload[:selector][:index] ==
|
131
|
+
name == :deleteIndexes && payload[:selector] && payload[:selector][:index] == '*'
|
132
132
|
end
|
133
133
|
|
134
134
|
def self.drop_index?(name, payload)
|
@@ -166,7 +166,7 @@ module NewRelic
|
|
166
166
|
end
|
167
167
|
|
168
168
|
def self.collection_name_from_group_selector(payload)
|
169
|
-
payload[:selector][
|
169
|
+
payload[:selector]['group']['ns']
|
170
170
|
end
|
171
171
|
|
172
172
|
def self.collection_name_from_rename_selector(payload)
|
@@ -6,7 +6,7 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
module Datastores
|
8
8
|
module Redis
|
9
|
-
BINARY_DATA_PLACEHOLDER =
|
9
|
+
BINARY_DATA_PLACEHOLDER = '<binary data>'
|
10
10
|
|
11
11
|
MAXIMUM_COMMAND_LENGTH = 1000
|
12
12
|
MAXIMUM_ARGUMENT_LENGTH = 64
|
@@ -25,7 +25,7 @@ module NewRelic
|
|
25
25
|
|
26
26
|
def self.format_command(command_with_args)
|
27
27
|
if Agent.config[:'transaction_tracer.record_redis_arguments']
|
28
|
-
result =
|
28
|
+
result = +''
|
29
29
|
|
30
30
|
append_command_with_args(result, command_with_args)
|
31
31
|
|
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.format_pipeline_commands(commands_with_args)
|
39
|
-
result =
|
39
|
+
result = +''
|
40
40
|
|
41
41
|
commands_with_args.each do |command|
|
42
42
|
if result.length >= MAXIMUM_COMMAND_LENGTH
|
@@ -83,7 +83,7 @@ module NewRelic
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def self.is_supported_version?
|
86
|
-
Gem::Version.new(::Redis::VERSION) >= Gem::Version.new(
|
86
|
+
Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('3.0.0')
|
87
87
|
end
|
88
88
|
|
89
89
|
def self.ellipsize(result, string)
|
@@ -106,8 +106,8 @@ module NewRelic
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def self.safe_from_third_party_gem?
|
109
|
-
if NewRelic::LanguageSupport.bundled_gem?(
|
110
|
-
::NewRelic::Agent.logger.info(
|
109
|
+
if NewRelic::LanguageSupport.bundled_gem?('newrelic-redis')
|
110
|
+
::NewRelic::Agent.logger.info('Not installing New Relic supported Redis instrumentation because the third party newrelic-redis gem is present')
|
111
111
|
false
|
112
112
|
else
|
113
113
|
true
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- ruby -*-
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -28,7 +27,7 @@ module NewRelic
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def is_cross_app_callee?
|
31
|
-
cross_app_payload
|
30
|
+
!cross_app_payload.nil?
|
32
31
|
end
|
33
32
|
|
34
33
|
def is_cross_app?
|
@@ -36,7 +35,7 @@ module NewRelic
|
|
36
35
|
end
|
37
36
|
|
38
37
|
def cat_trip_id
|
39
|
-
cross_app_payload
|
38
|
+
cross_app_payload&.referring_trip_id || transaction.guid
|
40
39
|
end
|
41
40
|
|
42
41
|
def cross_app_monitor
|
@@ -74,7 +73,7 @@ module NewRelic
|
|
74
73
|
end
|
75
74
|
|
76
75
|
def record_cross_app_metrics
|
77
|
-
if (id = cross_app_payload
|
76
|
+
if (id = cross_app_payload&.id)
|
78
77
|
app_time_in_seconds = [
|
79
78
|
Process.clock_gettime(Process::CLOCK_REALTIME) - transaction.start_time,
|
80
79
|
0.0
|
@@ -104,11 +103,11 @@ module NewRelic
|
|
104
103
|
end
|
105
104
|
|
106
105
|
def cat_referring_path_hash
|
107
|
-
cross_app_payload
|
106
|
+
cross_app_payload&.referring_path_hash
|
108
107
|
end
|
109
108
|
|
110
109
|
def append_cat_info(payload)
|
111
|
-
if (referring_guid = cross_app_payload
|
110
|
+
if (referring_guid = cross_app_payload&.referring_guid)
|
112
111
|
payload[:referring_transaction_guid] = referring_guid
|
113
112
|
end
|
114
113
|
|
@@ -150,7 +149,7 @@ module NewRelic
|
|
150
149
|
if Agent.config[:cross_process_id] && Agent.config[:cross_process_id].length > 0
|
151
150
|
true
|
152
151
|
else
|
153
|
-
NewRelic::Agent.logger.debug(
|
152
|
+
NewRelic::Agent.logger.debug('No cross_process_id configured')
|
154
153
|
false
|
155
154
|
end
|
156
155
|
end
|
@@ -159,15 +158,14 @@ module NewRelic
|
|
159
158
|
if Agent.config[:encoding_key] && Agent.config[:encoding_key].length > 0
|
160
159
|
true
|
161
160
|
else
|
162
|
-
NewRelic::Agent.logger.debug(
|
161
|
+
NewRelic::Agent.logger.debug('No encoding_key set')
|
163
162
|
false
|
164
163
|
end
|
165
164
|
end
|
166
165
|
|
167
166
|
def cross_application_tracer_enabled?
|
168
167
|
!NewRelic::Agent.config[:"distributed_tracing.enabled"] &&
|
169
|
-
|
170
|
-
NewRelic::Agent.config[:cross_application_tracing])
|
168
|
+
NewRelic::Agent.config[:"cross_application_tracer.enabled"]
|
171
169
|
end
|
172
170
|
|
173
171
|
def obfuscator
|
@@ -9,16 +9,16 @@ module NewRelic
|
|
9
9
|
|
10
10
|
# Intrinsic Keys
|
11
11
|
INTRINSIC_KEYS = [
|
12
|
-
PARENT_TYPE_KEY =
|
13
|
-
PARENT_APP_KEY =
|
14
|
-
PARENT_ACCOUNT_ID_KEY =
|
15
|
-
PARENT_TRANSPORT_TYPE_KEY =
|
16
|
-
PARENT_TRANSPORT_DURATION_KEY =
|
17
|
-
GUID_KEY =
|
18
|
-
TRACE_ID_KEY =
|
19
|
-
PARENT_TRANSACTION_ID_KEY =
|
20
|
-
PARENT_SPAN_ID_KEY =
|
21
|
-
SAMPLED_KEY =
|
12
|
+
PARENT_TYPE_KEY = 'parent.type',
|
13
|
+
PARENT_APP_KEY = 'parent.app',
|
14
|
+
PARENT_ACCOUNT_ID_KEY = 'parent.account',
|
15
|
+
PARENT_TRANSPORT_TYPE_KEY = 'parent.transportType',
|
16
|
+
PARENT_TRANSPORT_DURATION_KEY = 'parent.transportDuration',
|
17
|
+
GUID_KEY = 'guid',
|
18
|
+
TRACE_ID_KEY = 'traceId',
|
19
|
+
PARENT_TRANSACTION_ID_KEY = 'parentId',
|
20
|
+
PARENT_SPAN_ID_KEY = 'parentSpanId',
|
21
|
+
SAMPLED_KEY = 'sampled'
|
22
22
|
].freeze
|
23
23
|
|
24
24
|
# This method extracts intrinsics from the transaction_payload and
|