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
@@ -70,7 +70,8 @@ module NewRelic::Agent::Instrumentation
|
|
70
70
|
begin
|
71
71
|
if txn_name = TransactionNamer.transaction_name_for_route(env, request)
|
72
72
|
::NewRelic::Agent::Transaction.set_default_transaction_name(
|
73
|
-
"#{self.class.name}/#{txn_name}", :sinatra
|
73
|
+
"#{self.class.name}/#{txn_name}", :sinatra
|
74
|
+
)
|
74
75
|
end
|
75
76
|
rescue => e
|
76
77
|
::NewRelic::Agent.logger.debug("Failed during route_eval to set transaction name", e)
|
@@ -93,8 +94,8 @@ module NewRelic::Agent::Instrumentation
|
|
93
94
|
|
94
95
|
name = TransactionNamer.initial_transaction_name(request)
|
95
96
|
perform_action_with_newrelic_trace(:category => :sinatra,
|
96
|
-
|
97
|
-
|
97
|
+
:name => name,
|
98
|
+
:params => filtered_params) do
|
98
99
|
begin
|
99
100
|
yield
|
100
101
|
ensure
|
@@ -16,7 +16,7 @@ DependencyDetection.defer do
|
|
16
16
|
executes do
|
17
17
|
::Sunspot.module_eval do
|
18
18
|
class << self
|
19
|
-
%w
|
19
|
+
%w[index index!].each do |method|
|
20
20
|
add_method_tracer method, 'SolrClient/Sunspot/index'
|
21
21
|
end
|
22
22
|
add_method_tracer :commit, 'SolrClient/Sunspot/commit'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module Tilt
|
7
|
+
module Chain
|
8
|
+
def self.instrument!
|
9
|
+
::Tilt::Template.module_eval do
|
10
|
+
include NewRelic::Agent::Instrumentation::Tilt
|
11
|
+
|
12
|
+
def render_with_new_relic(*args, &block)
|
13
|
+
render_with_tracing(*args) {
|
14
|
+
render_without_newrelic(*args, &block)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
alias render_without_newrelic render
|
19
|
+
alias render render_with_new_relic
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module Instrumentation
|
8
|
+
module Tilt
|
9
|
+
def metric_name(klass, file)
|
10
|
+
"View/#{klass}/#{file}/Rendering"
|
11
|
+
end
|
12
|
+
|
13
|
+
# Sinatra uses #caller_locations for the file name in Tilt (unlike Rails/Rack)
|
14
|
+
# So here we are only grabbing the file name and name of directory it is in
|
15
|
+
def create_filename_for_metric(file)
|
16
|
+
return file unless defined?(::Sinatra) && defined?(::Sinatra::Base)
|
17
|
+
file.split('/')[-2..-1].join('/')
|
18
|
+
rescue NoMethodError
|
19
|
+
file
|
20
|
+
end
|
21
|
+
|
22
|
+
def render_with_tracing(*args, &block)
|
23
|
+
begin
|
24
|
+
finishable = Tracer.start_segment(
|
25
|
+
name: metric_name(self.class, create_filename_for_metric(self.file))
|
26
|
+
)
|
27
|
+
begin
|
28
|
+
yield
|
29
|
+
rescue => error
|
30
|
+
NewRelic::Agent.notice_error(error)
|
31
|
+
raise
|
32
|
+
end
|
33
|
+
ensure
|
34
|
+
finishable.finish if finishable
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module Tilt::Prepend
|
7
|
+
include NewRelic::Agent::Instrumentation::Tilt
|
8
|
+
|
9
|
+
def render(*args, &block)
|
10
|
+
render_with_tracing { super }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
require_relative 'tilt/instrumentation'
|
6
|
+
require_relative 'tilt/chain'
|
7
|
+
require_relative 'tilt/prepend'
|
8
|
+
|
9
|
+
DependencyDetection.defer do
|
10
|
+
named :tilt
|
11
|
+
|
12
|
+
depends_on { defined?(::Tilt) }
|
13
|
+
|
14
|
+
executes do
|
15
|
+
::NewRelic::Agent.logger.info('Installing Tilt instrumentation')
|
16
|
+
end
|
17
|
+
|
18
|
+
executes do
|
19
|
+
if use_prepend?
|
20
|
+
prepend_instrument ::Tilt::Template, NewRelic::Agent::Instrumentation::Tilt::Prepend
|
21
|
+
else
|
22
|
+
chain_instrument NewRelic::Agent::Instrumentation::Tilt::Chain
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -4,19 +4,19 @@
|
|
4
4
|
|
5
5
|
module NewRelic::Agent::Instrumentation
|
6
6
|
module Typhoeus
|
7
|
-
module Chain
|
7
|
+
module Chain
|
8
8
|
def self.instrument!
|
9
|
-
::Typhoeus::Hydra.class_eval do
|
9
|
+
::Typhoeus::Hydra.class_eval do
|
10
10
|
include NewRelic::Agent::Instrumentation::Typhoeus
|
11
11
|
|
12
12
|
def run_with_newrelic(*args)
|
13
13
|
with_tracing { run_without_newrelic(*args) }
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
alias run_without_newrelic run
|
17
17
|
alias run run_with_newrelic
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
@@ -6,8 +6,7 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
module Instrumentation
|
8
8
|
module Typhoeus
|
9
|
-
|
10
|
-
HYDRA_SEGMENT_NAME = "External/Multiple/Typhoeus::Hydra/run"
|
9
|
+
HYDRA_SEGMENT_NAME = "External/Multiple/Typhoeus::Hydra/run"
|
11
10
|
NOTICIBLE_ERROR_CLASS = "Typhoeus::Errors::TyphoeusError"
|
12
11
|
|
13
12
|
EARLIEST_VERSION = Gem::Version.new("0.5.3")
|
@@ -27,7 +26,7 @@ module NewRelic
|
|
27
26
|
response.return_message
|
28
27
|
else
|
29
28
|
# 0.5.4 seems to have lost xxxx_message methods altogether.
|
30
|
-
"timeout"
|
29
|
+
"timeout"
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
@@ -68,11 +67,10 @@ module NewRelic
|
|
68
67
|
if request.response.code == 0
|
69
68
|
segment.notice_error NoticibleError.new NOTICIBLE_ERROR_CLASS, response_message(request.response)
|
70
69
|
end
|
71
|
-
|
70
|
+
|
72
71
|
segment.finish if segment
|
73
72
|
end
|
74
73
|
request.on_complete.unshift(callback)
|
75
|
-
|
76
74
|
rescue => e
|
77
75
|
NewRelic::Agent.logger.error("Exception during trace setup for Typhoeus request", e)
|
78
76
|
end
|
@@ -19,8 +19,8 @@ module NewRelic
|
|
19
19
|
|
20
20
|
def log_configuration
|
21
21
|
NewRelic::Agent.logger.debug("JS agent loader requested: #{NewRelic::Agent.config[:'browser_monitoring.loader']}",
|
22
|
-
|
23
|
-
|
22
|
+
"JS agent loader debug: #{NewRelic::Agent.config[:'browser_monitoring.debug']}",
|
23
|
+
"JS agent loader version: #{NewRelic::Agent.config[:'browser_monitoring.loader_version']}")
|
24
24
|
|
25
25
|
if !NewRelic::Agent.config[:'rum.enabled']
|
26
26
|
NewRelic::Agent.logger.debug("Real User Monitoring is disabled for this agent. Edit your configuration to change this.")
|
@@ -38,19 +38,19 @@ module NewRelic
|
|
38
38
|
def js_enabled_and_ready?
|
39
39
|
if !enabled?
|
40
40
|
::NewRelic::Agent.logger.log_once(:debug, :js_agent_disabled,
|
41
|
-
|
41
|
+
"JS agent instrumentation is disabled.")
|
42
42
|
false
|
43
43
|
elsif missing_config?(:js_agent_loader)
|
44
44
|
::NewRelic::Agent.logger.log_once(:debug, :missing_js_agent_loader,
|
45
|
-
|
45
|
+
"Missing :js_agent_loader. Skipping browser instrumentation.")
|
46
46
|
false
|
47
47
|
elsif missing_config?(:beacon)
|
48
48
|
::NewRelic::Agent.logger.log_once(:debug, :missing_beacon,
|
49
|
-
|
49
|
+
"Beacon configuration not received (yet?). Skipping browser instrumentation.")
|
50
50
|
false
|
51
51
|
elsif missing_config?(:browser_key)
|
52
52
|
::NewRelic::Agent.logger.log_once(:debug, :missing_browser_key,
|
53
|
-
|
53
|
+
"Browser key is not set. Skipping browser instrumentation.")
|
54
54
|
false
|
55
55
|
else
|
56
56
|
true
|
@@ -83,7 +83,7 @@ module NewRelic
|
|
83
83
|
value.nil? || value.empty?
|
84
84
|
end
|
85
85
|
|
86
|
-
def browser_timing_header(nonce=nil) #THREAD_LOCAL_ACCESS
|
86
|
+
def browser_timing_header(nonce = nil) # THREAD_LOCAL_ACCESS
|
87
87
|
return '' unless js_enabled_and_ready? # fast exit
|
88
88
|
|
89
89
|
state = NewRelic::Agent::Tracer.state
|
@@ -99,11 +99,11 @@ module NewRelic
|
|
99
99
|
''
|
100
100
|
end
|
101
101
|
|
102
|
-
def browser_timing_loader(nonce=nil)
|
102
|
+
def browser_timing_loader(nonce = nil)
|
103
103
|
html_safe_if_needed("\n<script type=\"text/javascript\"#{create_nonce(nonce)}>#{Agent.config[:js_agent_loader]}</script>")
|
104
104
|
end
|
105
105
|
|
106
|
-
def browser_timing_config(state, nonce=nil)
|
106
|
+
def browser_timing_config(state, nonce = nil)
|
107
107
|
txn = state.current_transaction
|
108
108
|
return '' if txn.nil?
|
109
109
|
|
@@ -116,44 +116,44 @@ module NewRelic
|
|
116
116
|
''
|
117
117
|
end
|
118
118
|
|
119
|
-
def create_nonce(nonce=nil)
|
119
|
+
def create_nonce(nonce = nil)
|
120
120
|
return '' unless nonce
|
121
121
|
" nonce=\"#{nonce.to_s}\""
|
122
122
|
end
|
123
123
|
|
124
|
-
BEACON_KEY
|
125
|
-
ERROR_BEACON_KEY
|
126
|
-
LICENSE_KEY_KEY
|
127
|
-
APPLICATIONID_KEY
|
124
|
+
BEACON_KEY = "beacon".freeze
|
125
|
+
ERROR_BEACON_KEY = "errorBeacon".freeze
|
126
|
+
LICENSE_KEY_KEY = "licenseKey".freeze
|
127
|
+
APPLICATIONID_KEY = "applicationID".freeze
|
128
128
|
TRANSACTION_NAME_KEY = "transactionName".freeze
|
129
|
-
QUEUE_TIME_KEY
|
129
|
+
QUEUE_TIME_KEY = "queueTime".freeze
|
130
130
|
APPLICATION_TIME_KEY = "applicationTime".freeze
|
131
|
-
AGENT_KEY
|
132
|
-
SSL_FOR_HTTP_KEY
|
133
|
-
ATTS_KEY
|
134
|
-
ATTS_USER_SUBKEY
|
135
|
-
ATTS_AGENT_SUBKEY
|
131
|
+
AGENT_KEY = "agent".freeze
|
132
|
+
SSL_FOR_HTTP_KEY = "sslForHttp".freeze
|
133
|
+
ATTS_KEY = "atts".freeze
|
134
|
+
ATTS_USER_SUBKEY = "u".freeze
|
135
|
+
ATTS_AGENT_SUBKEY = "a".freeze
|
136
136
|
|
137
137
|
# NOTE: Internal prototyping may override this, so leave name stable!
|
138
138
|
def data_for_js_agent(transaction)
|
139
139
|
queue_time_in_seconds = [transaction.queue_time, 0.0].max
|
140
140
|
start_time_in_seconds = [transaction.start_time, 0.0].max
|
141
|
-
app_time_in_seconds
|
141
|
+
app_time_in_seconds = Process.clock_gettime(Process::CLOCK_REALTIME) - start_time_in_seconds
|
142
142
|
|
143
143
|
queue_time_in_millis = (1000.0 * queue_time_in_seconds).round
|
144
|
-
app_time_in_millis
|
144
|
+
app_time_in_millis = (1000.0 * app_time_in_seconds).round
|
145
145
|
|
146
146
|
transaction_name = transaction.best_name || ::NewRelic::Agent::UNKNOWN_METRIC
|
147
147
|
|
148
148
|
data = {
|
149
|
-
BEACON_KEY
|
150
|
-
ERROR_BEACON_KEY
|
151
|
-
LICENSE_KEY_KEY
|
152
|
-
APPLICATIONID_KEY
|
149
|
+
BEACON_KEY => NewRelic::Agent.config[:beacon],
|
150
|
+
ERROR_BEACON_KEY => NewRelic::Agent.config[:error_beacon],
|
151
|
+
LICENSE_KEY_KEY => NewRelic::Agent.config[:browser_key],
|
152
|
+
APPLICATIONID_KEY => NewRelic::Agent.config[:application_id],
|
153
153
|
TRANSACTION_NAME_KEY => obfuscator.obfuscate(transaction_name),
|
154
|
-
QUEUE_TIME_KEY
|
154
|
+
QUEUE_TIME_KEY => queue_time_in_millis,
|
155
155
|
APPLICATION_TIME_KEY => app_time_in_millis,
|
156
|
-
AGENT_KEY
|
156
|
+
AGENT_KEY => NewRelic::Agent.config[:js_agent_file]
|
157
157
|
}
|
158
158
|
|
159
159
|
add_ssl_for_http(data)
|
@@ -8,7 +8,6 @@ require 'new_relic/agent/hostname'
|
|
8
8
|
module NewRelic
|
9
9
|
module Agent
|
10
10
|
module Logging
|
11
|
-
|
12
11
|
# This class can be used as the formatter for an existing logger. It
|
13
12
|
# decorates log messages with trace and entity metadata, and formats each
|
14
13
|
# log messages as a JSON object.
|
@@ -33,6 +32,7 @@ module NewRelic
|
|
33
32
|
COLON = ':'.freeze
|
34
33
|
COMMA = ','.freeze
|
35
34
|
CLOSING_BRACE = '}'.freeze
|
35
|
+
REPLACEMENT_CHAR = '�'
|
36
36
|
|
37
37
|
def initialize
|
38
38
|
Agent.config.register_callback :app_name do
|
@@ -86,12 +86,17 @@ module NewRelic
|
|
86
86
|
message << QUOTE << key << QUOTE << COLON << QUOTE << value << QUOTE
|
87
87
|
end
|
88
88
|
|
89
|
-
def escape
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
def escape(message)
|
90
|
+
message = message.to_s unless message.is_a?(String)
|
91
|
+
unless message.encoding == Encoding::UTF_8 && message.valid_encoding?
|
92
|
+
message = message.encode(
|
93
|
+
Encoding::UTF_8,
|
94
|
+
invalid: :replace,
|
95
|
+
undef: :replace,
|
96
|
+
replace: REPLACEMENT_CHAR
|
97
|
+
)
|
94
98
|
end
|
99
|
+
message.to_json
|
95
100
|
end
|
96
101
|
|
97
102
|
def clear_tags!
|
@@ -99,7 +104,6 @@ module NewRelic
|
|
99
104
|
end
|
100
105
|
end
|
101
106
|
|
102
|
-
|
103
107
|
# This logger decorates logs with trace and entity metadata, and emits log
|
104
108
|
# messages formatted as JSON objects. It extends the Logger class from
|
105
109
|
# the Ruby standard library, and accepts the same constructor parameters.
|
@@ -116,7 +120,6 @@ module NewRelic
|
|
116
120
|
#
|
117
121
|
# @api public
|
118
122
|
class DecoratingLogger < (defined?(::ActiveSupport) && defined?(::ActiveSupport::Logger) ? ::ActiveSupport::Logger : ::Logger)
|
119
|
-
|
120
123
|
alias :write :info
|
121
124
|
|
122
125
|
# Positional and Keyword arguments are separated beginning with Ruby 2.7
|
@@ -18,8 +18,8 @@ module NewRelic
|
|
18
18
|
RABBITMQ_TRANSPORT_TYPE = "RabbitMQ"
|
19
19
|
|
20
20
|
ATTR_DESTINATION = AttributeFilter::DST_TRANSACTION_EVENTS |
|
21
|
-
|
22
|
-
|
21
|
+
AttributeFilter::DST_TRANSACTION_TRACER |
|
22
|
+
AttributeFilter::DST_ERROR_COLLECTOR
|
23
23
|
|
24
24
|
# Start a MessageBroker segment configured to trace a messaging action.
|
25
25
|
# Finishing this segment will handle timing and recording of the proper
|
@@ -53,12 +53,12 @@ module NewRelic
|
|
53
53
|
# @api public
|
54
54
|
#
|
55
55
|
def start_message_broker_segment(action: nil,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
library: nil,
|
57
|
+
destination_type: nil,
|
58
|
+
destination_name: nil,
|
59
|
+
headers: nil,
|
60
|
+
parameters: nil,
|
61
|
+
start_time: nil)
|
62
62
|
|
63
63
|
Tracer.start_message_broker_segment(
|
64
64
|
action: action,
|
@@ -111,14 +111,14 @@ module NewRelic
|
|
111
111
|
# @api public
|
112
112
|
#
|
113
113
|
def wrap_message_broker_consume_transaction(library:,
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
114
|
+
destination_type:,
|
115
|
+
destination_name:,
|
116
|
+
headers: nil,
|
117
|
+
routing_key: nil,
|
118
|
+
queue_name: nil,
|
119
|
+
exchange_type: nil,
|
120
|
+
reply_to: nil,
|
121
|
+
correlation_id: nil)
|
122
122
|
|
123
123
|
state = Tracer.state
|
124
124
|
return yield if state.current_transaction
|
@@ -181,12 +181,12 @@ module NewRelic
|
|
181
181
|
# @api public
|
182
182
|
#
|
183
183
|
def start_amqp_publish_segment(library:,
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
184
|
+
destination_name:,
|
185
|
+
headers: nil,
|
186
|
+
routing_key: nil,
|
187
|
+
reply_to: nil,
|
188
|
+
correlation_id: nil,
|
189
|
+
exchange_type: nil)
|
190
190
|
|
191
191
|
raise ArgumentError, 'missing required argument: headers' if headers.nil? && CrossAppTracing.cross_app_enabled?
|
192
192
|
|
@@ -240,12 +240,12 @@ module NewRelic
|
|
240
240
|
# @api public
|
241
241
|
#
|
242
242
|
def start_amqp_consume_segment(library:,
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
243
|
+
destination_name:,
|
244
|
+
delivery_info:,
|
245
|
+
message_properties:,
|
246
|
+
exchange_type: nil,
|
247
|
+
queue_name: nil,
|
248
|
+
start_time: nil)
|
249
249
|
|
250
250
|
segment = Tracer.start_message_broker_segment(
|
251
251
|
action: :consume,
|
@@ -301,22 +301,22 @@ module NewRelic
|
|
301
301
|
# @api public
|
302
302
|
#
|
303
303
|
def wrap_amqp_consume_transaction library: nil,
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
304
|
+
destination_name: nil,
|
305
|
+
delivery_info: nil,
|
306
|
+
message_properties: nil,
|
307
|
+
exchange_type: nil,
|
308
|
+
queue_name: nil,
|
309
|
+
&block
|
310
310
|
|
311
311
|
wrap_message_broker_consume_transaction library: library,
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
312
|
+
destination_type: :exchange,
|
313
|
+
destination_name: Instrumentation::Bunny.exchange_name(destination_name),
|
314
|
+
routing_key: delivery_info[:routing_key],
|
315
|
+
reply_to: message_properties[:reply_to],
|
316
|
+
queue_name: queue_name,
|
317
|
+
exchange_type: exchange_type,
|
318
|
+
headers: message_properties[:headers],
|
319
|
+
correlation_id: message_properties[:correlation_id],
|
320
320
|
&block
|
321
321
|
end
|
322
322
|
|
@@ -352,7 +352,6 @@ module NewRelic
|
|
352
352
|
|
353
353
|
transaction_name
|
354
354
|
end
|
355
|
-
|
356
355
|
end
|
357
356
|
end
|
358
357
|
end
|
@@ -47,7 +47,6 @@ module NewRelic
|
|
47
47
|
#
|
48
48
|
|
49
49
|
module MethodTracer
|
50
|
-
|
51
50
|
def self.included(klass)
|
52
51
|
klass.extend(ClassMethods)
|
53
52
|
end
|
@@ -68,7 +67,7 @@ module NewRelic
|
|
68
67
|
#
|
69
68
|
# @api public
|
70
69
|
#
|
71
|
-
def trace_execution_scoped(metric_names, options=NewRelic::EMPTY_HASH) #THREAD_LOCAL_ACCESS
|
70
|
+
def trace_execution_scoped(metric_names, options = NewRelic::EMPTY_HASH) # THREAD_LOCAL_ACCESS
|
72
71
|
NewRelic::Agent.record_api_supportability_metric :trace_execution_scoped unless options[:internal]
|
73
72
|
NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(metric_names, options) do
|
74
73
|
# Using an implicit block avoids object allocation for a &block param
|
@@ -84,7 +83,7 @@ module NewRelic
|
|
84
83
|
#
|
85
84
|
# @api public
|
86
85
|
#
|
87
|
-
def trace_execution_unscoped(metric_names, options=NewRelic::EMPTY_HASH) #THREAD_LOCAL_ACCESS
|
86
|
+
def trace_execution_unscoped(metric_names, options = NewRelic::EMPTY_HASH) # THREAD_LOCAL_ACCESS
|
88
87
|
NewRelic::Agent.record_api_supportability_metric :trace_execution_unscoped unless options[:internal]
|
89
88
|
return yield unless NewRelic::Agent.tl_is_execution_traced?
|
90
89
|
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
@@ -103,7 +102,7 @@ module NewRelic
|
|
103
102
|
module AddMethodTracer
|
104
103
|
ALLOWED_KEYS = [:metric, :push_scope, :code_header, :code_footer].freeze
|
105
104
|
|
106
|
-
DEFAULT_SETTINGS = {:push_scope => true, :metric => true, :code_header => "", :code_footer => ""
|
105
|
+
DEFAULT_SETTINGS = {:push_scope => true, :metric => true, :code_header => "", :code_footer => ""}.freeze
|
107
106
|
|
108
107
|
# Checks the provided options to make sure that they make
|
109
108
|
# sense. Raises an error if the options are incorrect to
|
@@ -117,7 +116,7 @@ module NewRelic
|
|
117
116
|
unrecognized_keys = options.keys - ALLOWED_KEYS
|
118
117
|
if unrecognized_keys.any?
|
119
118
|
raise "Unrecognized options when adding method tracer to #{method_name}: " +
|
120
|
-
|
119
|
+
unrecognized_keys.join(', ')
|
121
120
|
end
|
122
121
|
|
123
122
|
options = DEFAULT_SETTINGS.merge(options)
|
@@ -279,8 +278,8 @@ module NewRelic
|
|
279
278
|
|
280
279
|
prepend(_nr_traced_method_module)
|
281
280
|
|
282
|
-
::NewRelic::Agent.logger.debug("Traced method: class = #{_nr_derived_class_name},"+
|
283
|
-
"method = #{method_name}, "+
|
281
|
+
::NewRelic::Agent.logger.debug("Traced method: class = #{_nr_derived_class_name}," +
|
282
|
+
"method = #{method_name}, " +
|
284
283
|
"metric = '#{metric_name}'")
|
285
284
|
end
|
286
285
|
|
@@ -298,8 +297,8 @@ module NewRelic
|
|
298
297
|
end
|
299
298
|
|
300
299
|
def _nr_define_traced_method(method_name, scoped_metric: nil, unscoped_metrics: [],
|
301
|
-
|
302
|
-
|
300
|
+
code_header: nil, code_footer: nil, record_metrics: true,
|
301
|
+
visibility: :public)
|
303
302
|
_nr_traced_method_module.module_eval do
|
304
303
|
define_method(method_name) do |*args, &block|
|
305
304
|
return super(*args, &block) unless NewRelic::Agent.tl_is_execution_traced?
|
@@ -310,9 +309,7 @@ module NewRelic
|
|
310
309
|
instance_exec(*args, &scoped_metric)
|
311
310
|
when String
|
312
311
|
scoped_metric
|
313
|
-
|
314
|
-
nil
|
315
|
-
end
|
312
|
+
end
|
316
313
|
|
317
314
|
unscoped_metrics_eval = unscoped_metrics.map do |metric|
|
318
315
|
metric.kind_of?(Proc) ? instance_exec(*args, &metric) : metric.to_s
|
@@ -320,20 +317,25 @@ module NewRelic
|
|
320
317
|
|
321
318
|
instance_exec(&code_header) if code_header.kind_of?(Proc)
|
322
319
|
|
320
|
+
# NOTE: Calling ::NewRelic::Agent::MethodTracer.trace_execution_scoped and
|
321
|
+
# .trace_execution_unscoped below relies on the fact that MethodTracer is included
|
322
|
+
# in Module on agent startup. If/when this changes, these methods should be
|
323
|
+
# explicitly namespaced and extended in MethodTracer.
|
324
|
+
|
323
325
|
# If tracing multiple metrics on this method, nest one unscoped trace inside the scoped trace.
|
324
326
|
begin
|
325
327
|
if scoped_metric_eval
|
326
|
-
|
328
|
+
::NewRelic::Agent::MethodTracer.trace_execution_scoped(scoped_metric_eval, metric: record_metrics, internal: true) do
|
327
329
|
if unscoped_metrics_eval.empty?
|
328
330
|
super(*args, &block)
|
329
331
|
else
|
330
|
-
|
332
|
+
::NewRelic::Agent::MethodTracer.trace_execution_unscoped(unscoped_metrics_eval, internal: true) do
|
331
333
|
super(*args, &block)
|
332
334
|
end
|
333
335
|
end
|
334
336
|
end
|
335
337
|
elsif !unscoped_metrics_eval.empty?
|
336
|
-
|
338
|
+
::NewRelic::Agent::MethodTracer.trace_execution_unscoped(unscoped_metrics_eval, internal: true) do
|
337
339
|
super(*args, &block)
|
338
340
|
end
|
339
341
|
end
|
@@ -9,12 +9,12 @@ module NewRelic
|
|
9
9
|
|
10
10
|
extend self
|
11
11
|
|
12
|
-
def trace_execution_scoped(metric_names, options=NewRelic::EMPTY_HASH) #THREAD_LOCAL_ACCESS
|
12
|
+
def trace_execution_scoped(metric_names, options = NewRelic::EMPTY_HASH) # THREAD_LOCAL_ACCESS
|
13
13
|
state = NewRelic::Agent::Tracer.state
|
14
14
|
return yield unless state.is_execution_traced?
|
15
15
|
|
16
16
|
metric_names = Array(metric_names)
|
17
|
-
first_name
|
17
|
+
first_name = metric_names.shift
|
18
18
|
return yield unless first_name
|
19
19
|
|
20
20
|
segment = NewRelic::Agent::Tracer.start_segment(
|