newrelic_rpm 8.2.0 → 8.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1936 -0
- data/CHANGELOG.md +17 -2
- data/CONTRIBUTING.md +14 -2
- data/Guardfile +8 -8
- data/Rakefile +5 -7
- 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 +318 -324
- 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 +23 -23
- 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 +6 -8
- 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 +1 -3
- 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 +2 -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/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 +2 -6
- 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/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -1
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -0
- 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/instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino.rb +0 -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/instrumentation.rb +0 -1
- 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 +8 -4
- 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 +9 -12
- data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +13 -12
- 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 +20 -20
- 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 +3 -5
- 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 +3 -3
- 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 +5 -7
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -9
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
- data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -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 +3 -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/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_rpm.gemspec +13 -12
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +55 -55
- metadata +33 -4
@@ -15,9 +15,9 @@ module NewRelic
|
|
15
15
|
|
16
16
|
should_filter = case ignore_actions
|
17
17
|
when Hash
|
18
|
-
only_actions
|
18
|
+
only_actions = Array(ignore_actions[:only])
|
19
19
|
except_actions = Array(ignore_actions[:except])
|
20
|
-
action_name
|
20
|
+
action_name = action_name.to_sym
|
21
21
|
|
22
22
|
only_actions.include?(action_name) || (!except_actions.empty? && !except_actions.include?(action_name))
|
23
23
|
else
|
@@ -38,4 +38,3 @@ module NewRelic
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
@@ -9,6 +9,7 @@ module NewRelic
|
|
9
9
|
module Memcache
|
10
10
|
module Dalli
|
11
11
|
extend Helper
|
12
|
+
|
12
13
|
module_function
|
13
14
|
|
14
15
|
def instrument!
|
@@ -69,6 +70,7 @@ module NewRelic
|
|
69
70
|
module DalliCAS
|
70
71
|
extend Dalli
|
71
72
|
extend Helper
|
73
|
+
|
72
74
|
module_function
|
73
75
|
|
74
76
|
def should_instrument?
|
@@ -84,4 +86,3 @@ module NewRelic
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|
87
|
-
|
@@ -15,7 +15,7 @@ module NewRelic
|
|
15
15
|
class MiddlewareProxy
|
16
16
|
include MiddlewareTracing
|
17
17
|
|
18
|
-
ANONYMOUS_CLASS
|
18
|
+
ANONYMOUS_CLASS = "AnonymousClass".freeze
|
19
19
|
OBJECT_CLASS_NAME = "Object".freeze
|
20
20
|
|
21
21
|
# This class is used to wrap classes that are passed to
|
@@ -50,7 +50,7 @@ module NewRelic
|
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
53
|
-
def self.wrap(target, is_app=false)
|
53
|
+
def self.wrap(target, is_app = false)
|
54
54
|
if needs_wrapping?(target)
|
55
55
|
self.new(target, is_app)
|
56
56
|
else
|
@@ -60,13 +60,13 @@ module NewRelic
|
|
60
60
|
|
61
61
|
attr_reader :target, :category, :transaction_options
|
62
62
|
|
63
|
-
def initialize(target, is_app=false)
|
64
|
-
@target
|
65
|
-
@is_app
|
66
|
-
@category
|
63
|
+
def initialize(target, is_app = false)
|
64
|
+
@target = target
|
65
|
+
@is_app = is_app
|
66
|
+
@category = determine_category
|
67
67
|
@target_class_name = determine_class_name
|
68
|
-
@transaction_name
|
69
|
-
@transaction_options
|
68
|
+
@transaction_name = "#{determine_prefix}#{@target_class_name}/call"
|
69
|
+
@transaction_options = {
|
70
70
|
:transaction_name => @transaction_name
|
71
71
|
}
|
72
72
|
end
|
@@ -93,7 +93,7 @@ module NewRelic
|
|
93
93
|
|
94
94
|
name = clazz.name
|
95
95
|
name = clazz.superclass.name if name.nil? || name == ""
|
96
|
-
name = ANONYMOUS_CLASS
|
96
|
+
name = ANONYMOUS_CLASS if name.nil? || name == OBJECT_CLASS_NAME
|
97
97
|
name
|
98
98
|
end
|
99
99
|
|
@@ -104,7 +104,6 @@ module NewRelic
|
|
104
104
|
@target.class
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|
108
107
|
end
|
109
108
|
end
|
110
109
|
end
|
@@ -27,10 +27,9 @@ module NewRelic
|
|
27
27
|
module Agent
|
28
28
|
module Instrumentation
|
29
29
|
module MiddlewareTracing
|
30
|
-
|
31
30
|
TXN_STARTED_KEY = 'newrelic.transaction_started'
|
32
|
-
CONTENT_TYPE
|
33
|
-
CONTENT_LENGTH
|
31
|
+
CONTENT_TYPE = 'Content-Type'
|
32
|
+
CONTENT_LENGTH = 'Content-Length'
|
34
33
|
|
35
34
|
def _nr_has_middleware_tracing
|
36
35
|
true
|
@@ -71,7 +70,7 @@ module NewRelic
|
|
71
70
|
if result.is_a?(Array) && state.current_transaction
|
72
71
|
_, headers, _ = result
|
73
72
|
length = headers[CONTENT_LENGTH]
|
74
|
-
length = length.reduce(0){|sum, h| sum + h.to_i} if length.is_a?(Array)
|
73
|
+
length = length.reduce(0) { |sum, h| sum + h.to_i } if length.is_a?(Array)
|
75
74
|
state.current_transaction.response_content_length = length
|
76
75
|
end
|
77
76
|
end
|
@@ -98,7 +97,7 @@ module NewRelic
|
|
98
97
|
|
99
98
|
events.notify(:before_call, env) if first_middleware
|
100
99
|
|
101
|
-
result =
|
100
|
+
result = target == self ? traced_call(env) : target.call(env)
|
102
101
|
|
103
102
|
if first_middleware
|
104
103
|
capture_response_attributes(state, result)
|
@@ -19,11 +19,11 @@ module NewRelic
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
ERROR_KEYS = %w
|
22
|
+
ERROR_KEYS = %w[ writeErrors writeConcernError writeConcernErrors ].freeze
|
23
23
|
|
24
24
|
def error_key_present?(event)
|
25
25
|
if reply = event.reply
|
26
|
-
ERROR_KEYS.detect{ |key| reply[key] }
|
26
|
+
ERROR_KEYS.detect { |key| reply[key] }
|
27
27
|
end
|
28
28
|
rescue
|
29
29
|
false
|
@@ -35,7 +35,7 @@ module NewRelic
|
|
35
35
|
segment = segments.delete(event.operation_id)
|
36
36
|
return unless segment
|
37
37
|
|
38
|
-
# operations that succeed but have errors return CommandSucceeded
|
38
|
+
# operations that succeed but have errors return CommandSucceeded
|
39
39
|
# with an error_key that is populated with error specfics
|
40
40
|
if error_key = error_key_present?(event)
|
41
41
|
# taking the last error as there can potentially be many
|
@@ -76,7 +76,7 @@ module NewRelic
|
|
76
76
|
def operation(command_name)
|
77
77
|
# from 2.0 to 2.5, :findandmodify was the command_name
|
78
78
|
if command_name == :findandmodify
|
79
|
-
:findAndModify
|
79
|
+
:findAndModify
|
80
80
|
else
|
81
81
|
command_name
|
82
82
|
end
|
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
require_relative 'instrumentation'
|
6
6
|
|
7
|
-
|
8
7
|
module NewRelic::Agent::Instrumentation
|
9
8
|
module NetHTTP
|
10
9
|
module Chain
|
@@ -14,12 +13,12 @@ module NewRelic::Agent::Instrumentation
|
|
14
13
|
|
15
14
|
def request_with_newrelic_trace(request, *args, &block)
|
16
15
|
request_with_tracing(request) { request_without_newrelic_trace(request, *args, &block) }
|
17
|
-
end
|
18
|
-
|
16
|
+
end
|
17
|
+
|
19
18
|
alias request_without_newrelic_trace request
|
20
19
|
alias request request_with_newrelic_trace
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
25
|
-
end
|
24
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
|
-
module NewRelic
|
6
|
-
module Agent
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
7
|
module Instrumentation
|
8
8
|
module NetHTTP
|
9
9
|
def request_with_tracing(request)
|
@@ -14,11 +14,11 @@ module NewRelic
|
|
14
14
|
uri: wrapped_request.uri,
|
15
15
|
procedure: wrapped_request.method
|
16
16
|
)
|
17
|
-
|
17
|
+
|
18
18
|
begin
|
19
19
|
response = nil
|
20
20
|
segment.add_request_headers wrapped_request
|
21
|
-
|
21
|
+
|
22
22
|
# RUBY-1244 Disable further tracing in request to avoid double
|
23
23
|
# counting if connection wasn't started (which calls request again).
|
24
24
|
NewRelic::Agent.disable_all_tracing do
|
@@ -26,7 +26,7 @@ module NewRelic
|
|
26
26
|
yield
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
wrapped_response = NewRelic::Agent::HTTPClients::NetHTTPResponse.new response
|
31
31
|
segment.process_response_headers wrapped_response
|
32
32
|
response
|
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
require_relative 'instrumentation'
|
6
6
|
|
7
|
-
module NewRelic
|
8
|
-
module Agent
|
7
|
+
module NewRelic
|
8
|
+
module Agent
|
9
9
|
module Instrumentation
|
10
10
|
module NetHTTP
|
11
11
|
module Prepend
|
12
12
|
include NewRelic::Agent::Instrumentation::NetHTTP
|
13
|
-
|
13
|
+
|
14
14
|
def request(request, *args, &block)
|
15
15
|
request_with_tracing(request) { super }
|
16
16
|
end
|
@@ -18,4 +18,4 @@ module NewRelic
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
@@ -12,7 +12,7 @@ module NewRelic
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.subscribed?
|
15
|
-
find_all_subscribers.find{|s| s.instance_variable_get(:@delegate).class == self }
|
15
|
+
find_all_subscribers.find { |s| s.instance_variable_get(:@delegate).class == self }
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.find_all_subscribers
|
@@ -64,7 +64,7 @@ module NewRelic
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def segment_stack
|
67
|
-
Thread.current[@queue_key] ||= Hash.new {|h,id| h[id] = [] }
|
67
|
+
Thread.current[@queue_key] ||= Hash.new { |h, id| h[id] = [] }
|
68
68
|
end
|
69
69
|
|
70
70
|
def state
|
@@ -94,7 +94,6 @@ module NewRelic
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
|
-
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
@@ -15,7 +15,8 @@ module NewRelic::Agent::Instrumentation
|
|
15
15
|
txn_name = ::NewRelic::Agent::Instrumentation::Sinatra::TransactionNamer.transaction_name_for_route(env, request)
|
16
16
|
unless txn_name.nil?
|
17
17
|
::NewRelic::Agent::Transaction.set_default_transaction_name(
|
18
|
-
"#{self.class.name}/#{txn_name}", :sinatra
|
18
|
+
"#{self.class.name}/#{txn_name}", :sinatra
|
19
|
+
)
|
19
20
|
end
|
20
21
|
rescue => e
|
21
22
|
::NewRelic::Agent.logger.debug("Failed during invoke_route to set transaction name", e)
|
@@ -24,4 +25,4 @@ module NewRelic::Agent::Instrumentation
|
|
24
25
|
yield
|
25
26
|
end
|
26
27
|
end
|
27
|
-
end
|
28
|
+
end
|
@@ -9,10 +9,10 @@ module NewRelic
|
|
9
9
|
# Record queue time metrics based on any of three headers
|
10
10
|
# which can be set on the request.
|
11
11
|
module QueueTime
|
12
|
-
REQUEST_START_HEADER
|
13
|
-
QUEUE_START_HEADER
|
12
|
+
REQUEST_START_HEADER = 'HTTP_X_REQUEST_START'.freeze
|
13
|
+
QUEUE_START_HEADER = 'HTTP_X_QUEUE_START'.freeze
|
14
14
|
MIDDLEWARE_START_HEADER = 'HTTP_X_MIDDLEWARE_START'.freeze
|
15
|
-
ALL_QUEUE_METRIC
|
15
|
+
ALL_QUEUE_METRIC = 'WebFrontend/QueueTime'.freeze
|
16
16
|
# any timestamps before this are thrown out and the parser
|
17
17
|
# will try again with a larger unit (2000/1/1 UTC)
|
18
18
|
EARLIEST_ACCEPTABLE_TIME = Time.at(946684800).to_f
|
@@ -27,7 +27,7 @@ module NewRelic
|
|
27
27
|
|
28
28
|
module_function
|
29
29
|
|
30
|
-
def parse_frontend_timestamp(headers, now=Process.clock_gettime(Process::CLOCK_REALTIME))
|
30
|
+
def parse_frontend_timestamp(headers, now = Process.clock_gettime(Process::CLOCK_REALTIME))
|
31
31
|
earliest = nil
|
32
32
|
|
33
33
|
CANDIDATE_HEADERS.each do |header|
|
@@ -52,7 +52,7 @@ module NewRelic
|
|
52
52
|
when /^\s*([\d+\.]+)\s*$/ then $1
|
53
53
|
# following regexp intentionally unanchored to handle
|
54
54
|
# (ie ignore) leading server names
|
55
|
-
when /t=([\d+\.]+)/
|
55
|
+
when /t=([\d+\.]+)/ then $1
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -10,24 +10,24 @@ module NewRelic::Agent::Instrumentation
|
|
10
10
|
|
11
11
|
builder_class.class_eval do
|
12
12
|
include ::NewRelic::Agent::Instrumentation::RackBuilder
|
13
|
-
|
13
|
+
|
14
14
|
def to_app_with_newrelic_deferred_dependency_detection
|
15
15
|
with_deferred_dependency_detection { to_app_without_newrelic }
|
16
16
|
end
|
17
17
|
|
18
18
|
alias_method :to_app_without_newrelic, :to_app
|
19
19
|
alias_method :to_app, :to_app_with_newrelic_deferred_dependency_detection
|
20
|
-
|
20
|
+
|
21
21
|
if ::NewRelic::Agent::Instrumentation::RackHelpers.middleware_instrumentation_enabled?
|
22
22
|
::NewRelic::Agent.logger.info "Installing #{builder_class} middleware instrumentation"
|
23
23
|
|
24
24
|
def run_with_newrelic(app, *args)
|
25
25
|
run_with_tracing(app) { |wrapped_app| run_without_newrelic(wrapped_app, *args) }
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
alias_method :run_without_newrelic, :run
|
29
29
|
alias_method :run, :run_with_newrelic
|
30
|
-
|
30
|
+
|
31
31
|
def use_with_newrelic(middleware_class, *args, &block)
|
32
32
|
use_with_tracing(middleware_class) { |wrapped_class| use_without_newrelic(wrapped_class, *args, &block) }
|
33
33
|
end
|
@@ -45,7 +45,7 @@ module NewRelic::Agent::Instrumentation
|
|
45
45
|
def self.instrument! url_map_class
|
46
46
|
url_map_class.class_eval do
|
47
47
|
alias_method :initialize_without_newrelic, :initialize
|
48
|
-
|
48
|
+
|
49
49
|
def initialize(map = {})
|
50
50
|
traced_map = ::NewRelic::Agent::Instrumentation::RackURLMap.generate_traced_map(map)
|
51
51
|
initialize_without_newrelic(traced_map)
|
@@ -6,7 +6,6 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
module Instrumentation
|
8
8
|
module RackBuilder
|
9
|
-
|
10
9
|
def self.track_deferred_detection builder_class
|
11
10
|
class << builder_class
|
12
11
|
attr_accessor :_nr_deferred_detection_ran
|
@@ -16,7 +15,7 @@ module NewRelic
|
|
16
15
|
|
17
16
|
def deferred_dependency_check
|
18
17
|
return if self.class._nr_deferred_detection_ran
|
19
|
-
|
18
|
+
|
20
19
|
NewRelic::Agent.logger.info "Doing deferred dependency-detection before Rack startup"
|
21
20
|
DependencyDetection.detect!
|
22
21
|
self.class._nr_deferred_detection_ran = true
|
@@ -28,7 +27,7 @@ module NewRelic
|
|
28
27
|
if middleware_instrumentation_enabled?
|
29
28
|
if ::NewRelic::Agent::Instrumentation::MiddlewareProxy.needs_wrapping?(app)
|
30
29
|
::NewRelic::Agent.logger.info("We weren't able to instrument all of your Rack middlewares.",
|
31
|
-
|
30
|
+
"To correct this, ensure you 'require \"newrelic_rpm\"' before setting up your middleware stack.")
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|
@@ -41,7 +40,7 @@ module NewRelic
|
|
41
40
|
# this point.
|
42
41
|
def with_deferred_dependency_detection
|
43
42
|
deferred_dependency_check
|
44
|
-
yield.tap{ |result| check_for_late_instrumentation(result) }
|
43
|
+
yield.tap { |result| check_for_late_instrumentation(result) }
|
45
44
|
end
|
46
45
|
|
47
46
|
def middleware_instrumentation_enabled?
|
@@ -70,4 +69,4 @@ module NewRelic
|
|
70
69
|
end
|
71
70
|
end
|
72
71
|
end
|
73
|
-
end
|
72
|
+
end
|
@@ -57,7 +57,7 @@ DependencyDetection.defer do
|
|
57
57
|
prepend_instrument ::Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Prepend
|
58
58
|
else
|
59
59
|
chain_instrument_target ::Rack::URLMap, NewRelic::Agent::Instrumentation::Rack::URLMap::Chain
|
60
|
-
::NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map
|
60
|
+
::NewRelic::Agent::Instrumentation::RackHelpers.instrument_url_map
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -20,17 +20,16 @@ module NewRelic
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def process_action(*args) #THREAD_LOCAL_ACCESS
|
23
|
+
def process_action(*args) # THREAD_LOCAL_ACCESS
|
24
24
|
munged_params = NewRelic::Agent::ParameterFiltering.filter_rails_request_parameters(request.filtered_parameters)
|
25
25
|
perform_action_with_newrelic_trace(:category => :controller,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
:name => self.action_name,
|
27
|
+
:path => newrelic_metric_path,
|
28
|
+
:params => munged_params,
|
29
|
+
:class_name => self.class.name) do
|
30
30
|
super
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
33
|
end
|
35
34
|
|
36
35
|
module ActionView
|
@@ -47,6 +46,7 @@ module NewRelic
|
|
47
46
|
identifier
|
48
47
|
end
|
49
48
|
end
|
49
|
+
|
50
50
|
def render_type(file_path)
|
51
51
|
file = File.basename(file_path)
|
52
52
|
if file.starts_with?('_')
|
@@ -99,14 +99,14 @@ module NewRelic
|
|
99
99
|
|
100
100
|
def record_attributes(args, task)
|
101
101
|
command_line = task.application.top_level_tasks.join(" ")
|
102
|
-
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes({
|
103
|
-
|
104
|
-
|
102
|
+
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes({:command => command_line},
|
103
|
+
:'job.rake',
|
104
|
+
NewRelic::Agent::AttributeFilter::DST_NONE)
|
105
105
|
named_args = name_the_args(args, task.arg_names)
|
106
106
|
unless named_args.empty?
|
107
107
|
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(named_args,
|
108
|
-
|
109
|
-
|
108
|
+
:'job.rake.args',
|
109
|
+
NewRelic::Agent::AttributeFilter::DST_NONE)
|
110
110
|
end
|
111
111
|
rescue => e
|
112
112
|
NewRelic::Agent.logger.error("Error during Rake task attribute recording.", e)
|
@@ -141,4 +141,4 @@ module NewRelic
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
144
|
-
end
|
144
|
+
end
|
@@ -17,7 +17,7 @@ DependencyDetection.defer do
|
|
17
17
|
depends_on { ::NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }
|
18
18
|
|
19
19
|
executes do
|
20
|
-
::NewRelic::Agent.logger.info
|
20
|
+
::NewRelic::Agent.logger.info "Installing Rake instrumentation"
|
21
21
|
::NewRelic::Agent.logger.debug "Instrumenting Rake tasks: #{::NewRelic::Agent.config[:'rake.tasks']}"
|
22
22
|
end
|
23
23
|
|
@@ -5,25 +5,25 @@
|
|
5
5
|
|
6
6
|
module NewRelic::Agent::Instrumentation
|
7
7
|
module Redis
|
8
|
-
module Chain
|
8
|
+
module Chain
|
9
9
|
def self.instrument!
|
10
10
|
::Redis::Client.class_eval do
|
11
11
|
include NewRelic::Agent::Instrumentation::Redis
|
12
12
|
|
13
13
|
alias_method :call_without_new_relic, :call
|
14
|
-
|
14
|
+
|
15
15
|
def call(*args, &block)
|
16
16
|
call_with_tracing(args[0]) { call_without_new_relic(*args, &block) }
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
alias_method :call_pipeline_without_new_relic, :call_pipeline
|
20
|
-
|
20
|
+
|
21
21
|
def call_pipeline(*args, &block)
|
22
22
|
call_pipeline_with_tracing(args[0]) { call_pipeline_without_new_relic(*args, &block) }
|
23
23
|
end
|
24
24
|
|
25
25
|
alias_method :connect_without_new_relic, :connect
|
26
|
-
|
26
|
+
|
27
27
|
def connect(*args, &block)
|
28
28
|
connect_with_tracing { connect_without_new_relic(*args, &block) }
|
29
29
|
end
|
@@ -31,4 +31,4 @@ module NewRelic::Agent::Instrumentation
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -32,7 +32,7 @@ module NewRelic::Agent::Instrumentation
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
def with_tracing operation, statement=nil
|
35
|
+
def with_tracing operation, statement = nil
|
36
36
|
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
37
37
|
product: PRODUCT_NAME,
|
38
38
|
operation: operation,
|
@@ -62,4 +62,4 @@ module NewRelic::Agent::Instrumentation
|
|
62
62
|
UNKNOWN
|
63
63
|
end
|
64
64
|
end
|
65
|
-
end
|
65
|
+
end
|