newrelic_rpm 8.0.0 → 8.4.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 -1
- data/.rubocop.yml +1936 -0
- data/Brewfile +10 -0
- data/CHANGELOG.md +96 -0
- data/CONTRIBUTING.md +15 -3
- data/Guardfile +8 -8
- data/README.md +3 -1
- data/Rakefile +7 -9
- data/bin/mongrel_rpm +8 -9
- data/bin/newrelic +1 -1
- data/bin/nrdebug +14 -14
- data/init.rb +0 -2
- data/lefthook.yml +9 -0
- data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
- data/lib/new_relic/agent/agent.rb +38 -40
- data/lib/new_relic/agent/agent_logger.rb +8 -9
- data/lib/new_relic/agent/attribute_filter.rb +31 -31
- data/lib/new_relic/agent/attributes.rb +2 -2
- data/lib/new_relic/agent/autostart.rb +6 -7
- data/lib/new_relic/agent/commands/agent_command.rb +2 -2
- data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
- data/lib/new_relic/agent/configuration/default_source.rb +343 -337
- data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
- data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +2 -4
- data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
- data/lib/new_relic/agent/configuration/manager.rb +57 -57
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
- data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
- data/lib/new_relic/agent/configuration/server_source.rb +10 -10
- data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
- data/lib/new_relic/agent/connect/request_builder.rb +13 -16
- data/lib/new_relic/agent/connect/response_handler.rb +0 -3
- data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
- data/lib/new_relic/agent/database.rb +20 -24
- data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
- data/lib/new_relic/agent/datastores/redis.rb +2 -4
- data/lib/new_relic/agent/datastores.rb +1 -3
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +24 -24
- data/lib/new_relic/agent/distributed_tracing.rb +17 -18
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +17 -17
- data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/error_filter.rb +16 -10
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
- data/lib/new_relic/agent/event_aggregator.rb +1 -1
- data/lib/new_relic/agent/event_buffer.rb +6 -7
- data/lib/new_relic/agent/event_listener.rb +0 -1
- data/lib/new_relic/agent/event_loop.rb +10 -10
- data/lib/new_relic/agent/external.rb +1 -2
- data/lib/new_relic/agent/guid_generator.rb +2 -9
- data/lib/new_relic/agent/harvester.rb +3 -4
- data/lib/new_relic/agent/heap.rb +1 -3
- data/lib/new_relic/agent/hostname.rb +3 -3
- data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +8 -3
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
- data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
- data/lib/new_relic/agent/instrumentation/active_job.rb +4 -3
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
- data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +5 -9
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
- data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +58 -0
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -2
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +9 -2
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/padrino.rb +2 -5
- data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
- data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
- data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +40 -0
- data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +4 -4
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
- data/lib/new_relic/agent/internal_agent_error.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
- data/lib/new_relic/agent/logging.rb +11 -8
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +42 -43
- data/lib/new_relic/agent/method_tracer.rb +17 -15
- data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +19 -16
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
- data/lib/new_relic/agent/monitors.rb +1 -2
- data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +4 -3
- data/lib/new_relic/agent/new_relic_service.rb +26 -33
- data/lib/new_relic/agent/noticible_error.rb +0 -2
- data/lib/new_relic/agent/null_logger.rb +6 -2
- data/lib/new_relic/agent/obfuscator.rb +6 -8
- data/lib/new_relic/agent/parameter_filtering.rb +15 -7
- data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
- data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
- data/lib/new_relic/agent/pipe_service.rb +1 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
- data/lib/new_relic/agent/rules_engine.rb +2 -2
- data/lib/new_relic/agent/sampler.rb +2 -3
- data/lib/new_relic/agent/sampler_collection.rb +2 -3
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +10 -7
- data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
- data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
- data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
- data/lib/new_relic/agent/span_event_primitive.rb +39 -39
- data/lib/new_relic/agent/sql_sampler.rb +9 -9
- data/lib/new_relic/agent/stats.rb +16 -16
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
- data/lib/new_relic/agent/stats_engine.rb +6 -6
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/system_info.rb +22 -20
- data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
- data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
- data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
- data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
- data/lib/new_relic/agent/tracer.rb +37 -43
- data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
- data/lib/new_relic/agent/transaction/datastore_segment.rb +7 -6
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +8 -9
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
- data/lib/new_relic/agent/transaction/external_request_segment.rb +6 -5
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
- data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
- data/lib/new_relic/agent/transaction/segment.rb +6 -3
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction/trace.rb +8 -8
- data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
- data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
- data/lib/new_relic/agent/transaction/tracing.rb +1 -3
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
- data/lib/new_relic/agent/transaction.rb +79 -81
- data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
- data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
- data/lib/new_relic/agent/transaction_metrics.rb +3 -3
- data/lib/new_relic/agent/transaction_sampler.rb +0 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization_data.rb +3 -4
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/snapshot.rb +3 -3
- data/lib/new_relic/agent/worker_loop.rb +3 -5
- data/lib/new_relic/agent.rb +22 -22
- data/lib/new_relic/cli/command.rb +15 -17
- data/lib/new_relic/cli/commands/deployments.rb +20 -22
- data/lib/new_relic/cli/commands/install.rb +6 -10
- data/lib/new_relic/coerce.rb +5 -8
- data/lib/new_relic/collection_helper.rb +48 -47
- data/lib/new_relic/control/class_methods.rb +2 -2
- data/lib/new_relic/control/frameworks/external.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +5 -6
- data/lib/new_relic/control/frameworks/rails3.rb +2 -3
- data/lib/new_relic/control/frameworks/ruby.rb +2 -2
- data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
- data/lib/new_relic/control/instance_methods.rb +4 -5
- data/lib/new_relic/control/instrumentation.rb +4 -5
- data/lib/new_relic/control/server_methods.rb +2 -3
- data/lib/new_relic/control.rb +0 -1
- data/lib/new_relic/dependency_detection.rb +6 -8
- data/lib/new_relic/environment_report.rb +16 -18
- data/lib/new_relic/helper.rb +5 -5
- data/lib/new_relic/language_support.rb +1 -1
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/local_environment.rb +7 -7
- data/lib/new_relic/metric_data.rb +6 -7
- data/lib/new_relic/metric_spec.rb +3 -3
- data/lib/new_relic/noticed_error.rb +14 -15
- data/lib/new_relic/rack/agent_middleware.rb +2 -2
- data/lib/new_relic/rack/browser_monitoring.rb +9 -9
- data/lib/new_relic/recipes/capistrano3.rb +11 -13
- data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
- data/lib/new_relic/supportability_helper.rb +1 -2
- data/lib/new_relic/version.rb +3 -4
- data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
- data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/config.rake +21 -21
- data/lib/tasks/multiverse.rb +4 -6
- data/lib/tasks/tests.rake +3 -7
- data/newrelic.yml +8 -21
- data/newrelic_rpm.gemspec +13 -12
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +55 -55
- metadata +43 -7
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
- data/lib/new_relic/agent/supported_versions.rb +0 -275
@@ -12,7 +12,7 @@ module NewRelic
|
|
12
12
|
class AgentLogger
|
13
13
|
include LogOnce
|
14
14
|
|
15
|
-
def initialize(root = "", override_logger=nil)
|
15
|
+
def initialize(root = "", override_logger = nil)
|
16
16
|
@already_logged_lock = Mutex.new
|
17
17
|
clear_already_logged
|
18
18
|
create_log(root, override_logger)
|
@@ -50,8 +50,8 @@ module NewRelic
|
|
50
50
|
# the log level that the backtrace is logged at. If you just want the
|
51
51
|
# default behavior of backtraces logged at debug, use one of the methods
|
52
52
|
# above and pass an Exception as one of the args.
|
53
|
-
def log_exception(level, e, backtrace_level=level)
|
54
|
-
@log.send(level, "%p: %s" % [
|
53
|
+
def log_exception(level, e, backtrace_level = level)
|
54
|
+
@log.send(level, "%p: %s" % [e.class, e.message])
|
55
55
|
@log.send(backtrace_level) do
|
56
56
|
backtrace = backtrace_from_exception(e)
|
57
57
|
if backtrace
|
@@ -136,8 +136,8 @@ module NewRelic
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def find_or_create_file_path(path_setting, root)
|
139
|
-
for abs_path in [
|
140
|
-
|
139
|
+
for abs_path in [File.expand_path(path_setting),
|
140
|
+
File.expand_path(File.join(root, path_setting))] do
|
141
141
|
if File.directory?(abs_path) || (Dir.mkdir(abs_path) rescue nil)
|
142
142
|
return abs_path[%r{^(.*?)/?$}]
|
143
143
|
end
|
@@ -151,10 +151,10 @@ module NewRelic
|
|
151
151
|
|
152
152
|
LOG_LEVELS = {
|
153
153
|
"debug" => ::Logger::DEBUG,
|
154
|
-
"info"
|
155
|
-
"warn"
|
154
|
+
"info" => ::Logger::INFO,
|
155
|
+
"warn" => ::Logger::WARN,
|
156
156
|
"error" => ::Logger::ERROR,
|
157
|
-
"fatal" => ::Logger::FATAL
|
157
|
+
"fatal" => ::Logger::FATAL
|
158
158
|
}
|
159
159
|
|
160
160
|
def self.log_level_for(level)
|
@@ -176,7 +176,6 @@ module NewRelic
|
|
176
176
|
def self.format_fatal_error message
|
177
177
|
"** [NewRelic] FATAL : #{message}\n"
|
178
178
|
end
|
179
|
-
|
180
179
|
end
|
181
180
|
|
182
181
|
# In an effort to not lose messages during startup, we trap them in memory
|
@@ -64,25 +64,25 @@ module NewRelic
|
|
64
64
|
class AttributeFilter
|
65
65
|
DST_NONE = 0x0
|
66
66
|
|
67
|
-
DST_TRANSACTION_EVENTS
|
68
|
-
DST_TRANSACTION_TRACER
|
69
|
-
DST_ERROR_COLLECTOR
|
70
|
-
DST_BROWSER_MONITORING
|
71
|
-
DST_SPAN_EVENTS
|
67
|
+
DST_TRANSACTION_EVENTS = 1 << 0
|
68
|
+
DST_TRANSACTION_TRACER = 1 << 1
|
69
|
+
DST_ERROR_COLLECTOR = 1 << 2
|
70
|
+
DST_BROWSER_MONITORING = 1 << 3
|
71
|
+
DST_SPAN_EVENTS = 1 << 4
|
72
72
|
DST_TRANSACTION_SEGMENTS = 1 << 5
|
73
73
|
|
74
|
-
DST_ALL
|
74
|
+
DST_ALL = 0x3f
|
75
75
|
|
76
76
|
attr_reader :rules
|
77
77
|
|
78
78
|
def initialize(config)
|
79
79
|
@enabled_destinations = DST_NONE
|
80
80
|
|
81
|
-
@enabled_destinations |= DST_TRANSACTION_TRACER
|
82
|
-
@enabled_destinations |= DST_TRANSACTION_EVENTS
|
83
|
-
@enabled_destinations |= DST_ERROR_COLLECTOR
|
84
|
-
@enabled_destinations |= DST_BROWSER_MONITORING
|
85
|
-
@enabled_destinations |= DST_SPAN_EVENTS
|
81
|
+
@enabled_destinations |= DST_TRANSACTION_TRACER if config[:'transaction_tracer.attributes.enabled']
|
82
|
+
@enabled_destinations |= DST_TRANSACTION_EVENTS if config[:'transaction_events.attributes.enabled']
|
83
|
+
@enabled_destinations |= DST_ERROR_COLLECTOR if config[:'error_collector.attributes.enabled']
|
84
|
+
@enabled_destinations |= DST_BROWSER_MONITORING if config[:'browser_monitoring.attributes.enabled']
|
85
|
+
@enabled_destinations |= DST_SPAN_EVENTS if config[:'span_events.attributes.enabled']
|
86
86
|
@enabled_destinations |= DST_TRANSACTION_SEGMENTS if config[:'transaction_segments.attributes.enabled']
|
87
87
|
|
88
88
|
@enabled_destinations = DST_NONE unless config[:'attributes.enabled']
|
@@ -90,26 +90,26 @@ module NewRelic
|
|
90
90
|
@rules = []
|
91
91
|
|
92
92
|
build_rule(config[:'attributes.exclude'], DST_ALL, false)
|
93
|
-
build_rule(config[:'transaction_tracer.attributes.exclude'],
|
94
|
-
build_rule(config[:'transaction_events.attributes.exclude'],
|
95
|
-
build_rule(config[:'error_collector.attributes.exclude'],
|
96
|
-
build_rule(config[:'browser_monitoring.attributes.exclude'],
|
97
|
-
build_rule(config[:'span_events.attributes.exclude'],
|
93
|
+
build_rule(config[:'transaction_tracer.attributes.exclude'], DST_TRANSACTION_TRACER, false)
|
94
|
+
build_rule(config[:'transaction_events.attributes.exclude'], DST_TRANSACTION_EVENTS, false)
|
95
|
+
build_rule(config[:'error_collector.attributes.exclude'], DST_ERROR_COLLECTOR, false)
|
96
|
+
build_rule(config[:'browser_monitoring.attributes.exclude'], DST_BROWSER_MONITORING, false)
|
97
|
+
build_rule(config[:'span_events.attributes.exclude'], DST_SPAN_EVENTS, false)
|
98
98
|
build_rule(config[:'transaction_segments.attributes.exclude'], DST_TRANSACTION_SEGMENTS, false)
|
99
99
|
|
100
100
|
build_rule(['request.parameters.*'], include_destinations_for_capture_params(config[:capture_params]), true)
|
101
|
-
build_rule(['job.resque.args.*'],
|
102
|
-
build_rule(['job.sidekiq.args.*'],
|
101
|
+
build_rule(['job.resque.args.*'], include_destinations_for_capture_params(config[:'resque.capture_params']), true)
|
102
|
+
build_rule(['job.sidekiq.args.*'], include_destinations_for_capture_params(config[:'sidekiq.capture_params']), true)
|
103
103
|
|
104
104
|
build_rule(['host', 'port_path_or_id'], DST_TRANSACTION_SEGMENTS, config[:'datastore_tracer.instance_reporting.enabled'])
|
105
|
-
build_rule(['database_name'],
|
105
|
+
build_rule(['database_name'], DST_TRANSACTION_SEGMENTS, config[:'datastore_tracer.database_name_reporting.enabled'])
|
106
106
|
|
107
107
|
build_rule(config[:'attributes.include'], DST_ALL, true)
|
108
|
-
build_rule(config[:'transaction_tracer.attributes.include'],
|
109
|
-
build_rule(config[:'transaction_events.attributes.include'],
|
110
|
-
build_rule(config[:'error_collector.attributes.include'],
|
111
|
-
build_rule(config[:'browser_monitoring.attributes.include'],
|
112
|
-
build_rule(config[:'span_events.attributes.include'],
|
108
|
+
build_rule(config[:'transaction_tracer.attributes.include'], DST_TRANSACTION_TRACER, true)
|
109
|
+
build_rule(config[:'transaction_events.attributes.include'], DST_TRANSACTION_EVENTS, true)
|
110
|
+
build_rule(config[:'error_collector.attributes.include'], DST_ERROR_COLLECTOR, true)
|
111
|
+
build_rule(config[:'browser_monitoring.attributes.include'], DST_BROWSER_MONITORING, true)
|
112
|
+
build_rule(config[:'span_events.attributes.include'], DST_SPAN_EVENTS, true)
|
113
113
|
build_rule(config[:'transaction_segments.attributes.include'], DST_TRANSACTION_SEGMENTS, true)
|
114
114
|
|
115
115
|
build_uri_rule(config[:'attributes.exclude'])
|
@@ -165,7 +165,7 @@ module NewRelic
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def build_uri_rule(excluded_attributes)
|
168
|
-
uri_aliases = %w
|
168
|
+
uri_aliases = %w[uri url request_uri request.uri http.url]
|
169
169
|
|
170
170
|
if (excluded_attributes & uri_aliases).size > 0
|
171
171
|
build_rule(uri_aliases - excluded_attributes, DST_ALL, false)
|
@@ -175,7 +175,7 @@ module NewRelic
|
|
175
175
|
def apply(attribute_name, default_destinations)
|
176
176
|
return DST_NONE if @enabled_destinations == DST_NONE
|
177
177
|
|
178
|
-
destinations
|
178
|
+
destinations = default_destinations
|
179
179
|
attribute_name = attribute_name.to_s
|
180
180
|
|
181
181
|
@rules.each do |rule|
|
@@ -225,8 +225,8 @@ module NewRelic
|
|
225
225
|
def cache_prefix_denylist
|
226
226
|
@prefix_denylist = {}
|
227
227
|
@prefix_denylist[:'request.parameters'] = true unless might_allow_prefix_uncached?(:'request.parameters')
|
228
|
-
@prefix_denylist[:'job.sidekiq.args']
|
229
|
-
@prefix_denylist[:'job.resque.args']
|
228
|
+
@prefix_denylist[:'job.sidekiq.args'] = true unless might_allow_prefix_uncached?(:'job.sidekiq.args')
|
229
|
+
@prefix_denylist[:'job.resque.args'] = true unless might_allow_prefix_uncached?(:'job.resque.args')
|
230
230
|
end
|
231
231
|
|
232
232
|
# Note that the given prefix *must* be a Symbol
|
@@ -257,9 +257,9 @@ module NewRelic
|
|
257
257
|
|
258
258
|
def initialize(attribute_name, destinations, is_include)
|
259
259
|
@attribute_name = attribute_name.sub(/\*$/, "")
|
260
|
-
@wildcard
|
261
|
-
@is_include
|
262
|
-
@destinations
|
260
|
+
@wildcard = attribute_name.end_with?("*")
|
261
|
+
@is_include = is_include
|
262
|
+
@destinations = is_include ? destinations : ~destinations
|
263
263
|
end
|
264
264
|
|
265
265
|
# Rules are sorted from least specific to most specific
|
@@ -7,7 +7,7 @@ require 'new_relic/agent/attribute_processing'
|
|
7
7
|
module NewRelic
|
8
8
|
module Agent
|
9
9
|
class Attributes
|
10
|
-
KEY_LIMIT
|
10
|
+
KEY_LIMIT = 255
|
11
11
|
VALUE_LIMIT = 255
|
12
12
|
COUNT_LIMIT = 64
|
13
13
|
|
@@ -73,7 +73,7 @@ module NewRelic
|
|
73
73
|
|
74
74
|
def intrinsic_attributes_for(destination)
|
75
75
|
if destination == NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER ||
|
76
|
-
|
76
|
+
destination == NewRelic::Agent::AttributeFilter::DST_ERROR_COLLECTOR
|
77
77
|
@intrinsic_attributes
|
78
78
|
else
|
79
79
|
NewRelic::EMPTY_HASH
|
@@ -18,13 +18,12 @@ module NewRelic
|
|
18
18
|
module Autostart
|
19
19
|
extend self
|
20
20
|
|
21
|
-
|
22
21
|
# The constants, executables (i.e. $0) and rake tasks used can be
|
23
22
|
# configured with the config keys 'autostart.denylisted_constants',
|
24
23
|
# 'autostart.denylisted_executables' and
|
25
24
|
# 'autostart.denylisted_rake_tasks'
|
26
25
|
def agent_should_start?
|
27
|
-
|
26
|
+
!denylisted_constants? &&
|
28
27
|
!denylisted_executables? &&
|
29
28
|
!in_denylisted_rake_task?
|
30
29
|
end
|
@@ -57,11 +56,11 @@ module NewRelic
|
|
57
56
|
|
58
57
|
def in_denylisted_rake_task?
|
59
58
|
tasks = begin
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
::Rake.application.top_level_tasks
|
60
|
+
rescue => e
|
61
|
+
::NewRelic::Agent.logger.debug("Not in Rake environment so skipping denylisted_rake_tasks check: #{e}")
|
62
|
+
[]
|
63
|
+
end
|
65
64
|
!(tasks & ::NewRelic::Agent.config[:'autostart.denylisted_rake_tasks'].split(/\s*,\s*/)).empty?
|
66
65
|
end
|
67
66
|
end
|
@@ -9,8 +9,8 @@ module NewRelic
|
|
9
9
|
attr_reader :id, :name, :arguments
|
10
10
|
|
11
11
|
def initialize(raw_collector_command)
|
12
|
-
@id
|
13
|
-
@name
|
12
|
+
@id = raw_collector_command[0]
|
13
|
+
@name = raw_collector_command[1]["name"]
|
14
14
|
@arguments = raw_collector_command[1]["arguments"]
|
15
15
|
end
|
16
16
|
end
|
@@ -19,15 +19,15 @@ module NewRelic
|
|
19
19
|
|
20
20
|
attr_accessor :thread_profiler_session, :backtrace_service
|
21
21
|
|
22
|
-
def initialize(event_listener=nil)
|
23
|
-
@handlers
|
22
|
+
def initialize(event_listener = nil)
|
23
|
+
@handlers = Hash.new { |*| Proc.new { |cmd| self.unrecognized_agent_command(cmd) } }
|
24
24
|
|
25
25
|
@backtrace_service = Threading::BacktraceService.new(event_listener)
|
26
26
|
|
27
27
|
@thread_profiler_session = ThreadProfilerSession.new(@backtrace_service)
|
28
28
|
|
29
29
|
@handlers['start_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_start_command(cmd) }
|
30
|
-
@handlers['stop_profiler']
|
30
|
+
@handlers['stop_profiler'] = Proc.new { |cmd| thread_profiler_session.handle_stop_command(cmd) }
|
31
31
|
|
32
32
|
if event_listener
|
33
33
|
event_listener.subscribe(:before_shutdown, &method(:on_before_shutdown))
|
@@ -63,6 +63,7 @@ module NewRelic
|
|
63
63
|
# Same with reset! - we don't support asynchronous cancellation of a
|
64
64
|
# running thread profile currently.
|
65
65
|
def merge!(*args); end
|
66
|
+
|
66
67
|
def reset!; end
|
67
68
|
|
68
69
|
def harvest_from_thread_profiler_session
|
@@ -86,7 +87,7 @@ module NewRelic
|
|
86
87
|
def get_agent_commands
|
87
88
|
commands = new_relic_service.get_agent_commands
|
88
89
|
NewRelic::Agent.logger.debug "Received get_agent_commands = #{commands.inspect}"
|
89
|
-
commands.map {|collector_command| AgentCommand.new(collector_command)}
|
90
|
+
commands.map { |collector_command| AgentCommand.new(collector_command) }
|
90
91
|
end
|
91
92
|
|
92
93
|
def invoke_commands(agent_commands)
|
@@ -120,7 +121,7 @@ module NewRelic
|
|
120
121
|
end
|
121
122
|
|
122
123
|
def error(err)
|
123
|
-
{
|
124
|
+
{ERROR_KEY => err.message}
|
124
125
|
end
|
125
126
|
|
126
127
|
def call_handler_for(agent_command)
|
@@ -9,9 +9,7 @@ require 'new_relic/agent/threading/thread_profile'
|
|
9
9
|
module NewRelic
|
10
10
|
module Agent
|
11
11
|
module Commands
|
12
|
-
|
13
12
|
class ThreadProfilerSession
|
14
|
-
|
15
13
|
def initialize(backtrace_service)
|
16
14
|
@backtrace_service = backtrace_service
|
17
15
|
@started_at = nil
|
@@ -106,7 +104,6 @@ profile a Resque process, profiling again might select an appropriate agent.
|
|
106
104
|
msg = "Profile already in progress. Ignoring agent command to start another."
|
107
105
|
raise_command_error(msg)
|
108
106
|
end
|
109
|
-
|
110
107
|
end
|
111
108
|
end
|
112
109
|
end
|