newrelic_rpm 7.0.0 → 8.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.rubocop.yml +1941 -0
- data/.yardopts +1 -0
- data/Brewfile +10 -0
- data/CHANGELOG.md +431 -1
- data/CONTRIBUTING.md +32 -5
- data/DOCKER.md +167 -0
- data/Dockerfile +10 -0
- data/Guardfile +8 -8
- data/LICENSE +0 -6
- data/README.md +20 -18
- data/Rakefile +39 -29
- data/THIRD_PARTY_NOTICES.md +14 -199
- data/bin/mongrel_rpm +8 -9
- data/bin/newrelic +1 -1
- data/bin/nrdebug +14 -14
- data/docker-compose.yml +85 -0
- data/init.rb +0 -2
- data/lefthook.yml +9 -0
- data/lib/new_relic/agent/adaptive_sampler.rb +9 -5
- data/lib/new_relic/agent/agent.rb +72 -49
- data/lib/new_relic/agent/agent_logger.rb +15 -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/audit_logger.rb +4 -0
- data/lib/new_relic/agent/autostart.rb +19 -17
- 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 +7 -6
- data/lib/new_relic/agent/configuration/default_source.rb +731 -476
- data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -4
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +39 -16
- data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
- data/lib/new_relic/agent/configuration/manager.rb +74 -64
- 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 +14 -12
- data/lib/new_relic/agent/configuration/yaml_source.rb +26 -5
- data/lib/new_relic/agent/connect/request_builder.rb +14 -15
- data/lib/new_relic/agent/connect/response_handler.rb +0 -3
- data/lib/new_relic/agent/custom_event_aggregator.rb +9 -9
- 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 +30 -31
- data/lib/new_relic/agent/datastores/metric_helper.rb +13 -11
- 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/mongo.rb +5 -10
- data/lib/new_relic/agent/datastores/redis.rb +2 -4
- data/lib/new_relic/agent/datastores.rb +7 -9
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +9 -9
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +21 -16
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -12
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +42 -43
- 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 +25 -25
- 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 +65 -50
- data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/error_filter.rb +173 -0
- 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 +14 -14
- data/lib/new_relic/agent/external.rb +1 -34
- 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 +16 -10
- data/lib/new_relic/agent/http_clients/abstract.rb +7 -9
- 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 +28 -26
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
- data/lib/new_relic/agent/instrumentation/active_job.rb +12 -5
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +17 -3
- data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +56 -46
- 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 +22 -16
- data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +23 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +20 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +12 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +24 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +18 -9
- data/lib/new_relic/agent/instrumentation/authlogic.rb +10 -0
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +8 -9
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +52 -46
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +20 -21
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +10 -11
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +22 -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 +23 -4
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +3 -23
- 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 +26 -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 +5 -6
- data/lib/new_relic/agent/instrumentation/mongo.rb +3 -141
- 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 +7 -2
- 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 +8 -8
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +8 -7
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +11 -47
- 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/rainbows_instrumentation.rb +11 -0
- 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 +5 -1
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +19 -0
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +9 -7
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
- data/lib/new_relic/agent/instrumentation/resque.rb +17 -8
- 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 +22 -1
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +12 -5
- data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -11
- data/lib/new_relic/agent/instrumentation/sunspot.rb +11 -1
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +27 -0
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +22 -0
- data/lib/new_relic/agent/instrumentation/thread.rb +20 -0
- 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 +38 -33
- data/lib/new_relic/agent/linking_metadata.rb +45 -0
- data/lib/new_relic/agent/local_log_decorator.rb +37 -0
- data/lib/new_relic/agent/log_event_aggregator.rb +234 -0
- data/lib/new_relic/agent/log_priority.rb +20 -0
- 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 +46 -62
- data/lib/new_relic/agent/method_tracer.rb +145 -144
- data/lib/new_relic/agent/method_tracer_helpers.rb +82 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +21 -13
- 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 +61 -53
- 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 +16 -8
- data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
- data/lib/new_relic/agent/pipe_channel_manager.rb +15 -12
- data/lib/new_relic/agent/pipe_service.rb +6 -3
- 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/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +10 -7
- data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -3
- data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
- data/lib/new_relic/agent/span_event_aggregator.rb +10 -10
- data/lib/new_relic/agent/span_event_primitive.rb +48 -45
- data/lib/new_relic/agent/sql_sampler.rb +9 -9
- data/lib/new_relic/agent/stats.rb +62 -37
- 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 +7 -7
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -2
- 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 +12 -13
- data/lib/new_relic/agent/threading/thread_profile.rb +16 -19
- data/lib/new_relic/agent/tracer.rb +57 -72
- data/lib/new_relic/agent/transaction/abstract_segment.rb +38 -10
- 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 +24 -30
- 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 +14 -16
- data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
- data/lib/new_relic/agent/transaction/tracing.rb +9 -6
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
- data/lib/new_relic/agent/transaction.rb +132 -119
- data/lib/new_relic/agent/transaction_error_primitive.rb +18 -16
- data/lib/new_relic/agent/transaction_event_aggregator.rb +7 -8
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
- data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
- data/lib/new_relic/agent/transaction_metrics.rb +8 -7
- data/lib/new_relic/agent/transaction_sampler.rb +0 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +11 -11
- data/lib/new_relic/agent/utilization/aws.rb +32 -2
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +15 -2
- 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/mri_vm.rb +13 -1
- data/lib/new_relic/agent/vm/snapshot.rb +4 -4
- data/lib/new_relic/agent/worker_loop.rb +8 -10
- data/lib/new_relic/agent.rb +36 -41
- data/lib/new_relic/cli/command.rb +15 -17
- data/lib/new_relic/cli/commands/deployments.rb +21 -23
- 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/constants.rb +0 -4
- 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 +35 -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 +7 -9
- data/lib/new_relic/environment_report.rb +16 -18
- data/lib/new_relic/helper.rb +45 -5
- data/lib/new_relic/language_support.rb +20 -2
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/local_environment.rb +9 -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 +18 -19
- 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 +2 -2
- data/lib/new_relic/traced_thread.rb +35 -0
- data/lib/new_relic/version.rb +5 -16
- data/lib/newrelic_rpm.rb +10 -34
- data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
- data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
- data/lib/tasks/all.rb +2 -2
- data/lib/tasks/config.html.erb +14 -25
- data/lib/tasks/config.rake +36 -27
- data/lib/tasks/multiverse.rb +4 -6
- data/lib/tasks/tests.rake +3 -7
- data/newrelic.yml +610 -3
- data/newrelic_rpm.gemspec +14 -14
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +98 -59
- metadata +69 -20
- data/ROADMAP.md +0 -24
- data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
- 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
- data/lib/new_relic/control/frameworks/merb.rb +0 -29
@@ -10,7 +10,7 @@ require 'net/http'
|
|
10
10
|
require 'new_relic/agent/hostname'
|
11
11
|
|
12
12
|
# We need to use the Control object but we don't want to load
|
13
|
-
# the rails
|
13
|
+
# the rails environment. The defined? clause is so that
|
14
14
|
# it won't load it twice, something it does when run inside a test
|
15
15
|
require 'new_relic/control' unless defined? NewRelic::Control
|
16
16
|
|
@@ -30,8 +30,8 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
|
|
30
30
|
def initialize command_line_args
|
31
31
|
@control = NewRelic::Control.instance
|
32
32
|
@environment = nil
|
33
|
-
@changelog
|
34
|
-
@user
|
33
|
+
@changelog = nil
|
34
|
+
@user = nil
|
35
35
|
super(command_line_args)
|
36
36
|
@description ||= @leftover && @leftover.join(" ")
|
37
37
|
@user ||= ENV['USER']
|
@@ -66,12 +66,12 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
|
|
66
66
|
@description = nil if @description && @description.strip.empty?
|
67
67
|
create_params = {}
|
68
68
|
{
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
:application_id => @appname,
|
70
|
+
:host => NewRelic::Agent::Hostname.get,
|
71
|
+
:description => @description,
|
72
|
+
:user => @user,
|
73
|
+
:revision => @revision,
|
74
|
+
:changelog => @changelog
|
75
75
|
}.each do |k, v|
|
76
76
|
create_params["deployment[#{k}]"] = v unless v.nil? || v == ''
|
77
77
|
end
|
@@ -90,9 +90,9 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
|
|
90
90
|
response = http.request(request)
|
91
91
|
|
92
92
|
if response.is_a? Net::HTTPSuccess
|
93
|
-
info "Recorded deployment to '#{@appname}' (#{@description || Time.now
|
93
|
+
info "Recorded deployment to '#{@appname}' (#{@description || Time.now})"
|
94
94
|
else
|
95
|
-
err_string = REXML::Document.new(response.body).elements['errors/error'].map(&:to_s).join("; ") rescue
|
95
|
+
err_string = REXML::Document.new(response.body).elements['errors/error'].map(&:to_s).join("; ") rescue response.message
|
96
96
|
raise NewRelic::Cli::Command::CommandFailure, "Deployment not recorded: #{err_string}"
|
97
97
|
end
|
98
98
|
rescue SystemCallError, SocketError => e
|
@@ -111,26 +111,24 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
|
|
111
111
|
private
|
112
112
|
|
113
113
|
def options
|
114
|
-
OptionParser.new %Q
|
114
|
+
OptionParser.new %Q(Usage: #{$0} #{self.class.command} [OPTIONS] ["description"] ), 40 do |o|
|
115
115
|
o.separator "OPTIONS:"
|
116
116
|
o.on("-a", "--appname=NAME", String,
|
117
|
-
|
118
|
-
|
117
|
+
"Set the application name.",
|
118
|
+
"Default is app_name setting in newrelic.yml") { |e| @appname = e }
|
119
119
|
o.on("-e", "--environment=name", String,
|
120
|
-
|
121
|
-
|
120
|
+
"Override the (RAILS|RUBY|RACK)_ENV setting",
|
121
|
+
"currently: #{control.env}") { |e| @environment = e }
|
122
122
|
o.on("-u", "--user=USER", String,
|
123
|
-
|
124
|
-
|
123
|
+
"Specify the user deploying, for information only",
|
124
|
+
"Default: #{@user || '<none>'}") { |u| @user = u }
|
125
125
|
o.on("-r", "--revision=REV", String,
|
126
|
-
|
126
|
+
"Specify the revision being deployed") { |r| @revision = r }
|
127
127
|
o.on("-l", "--license-key=KEY", String,
|
128
|
-
|
128
|
+
"Specify the license key of the account for the app being deployed") { |l| @license_key = l }
|
129
129
|
o.on("-c", "--changes",
|
130
|
-
|
130
|
+
"Read in a change log from the standard input") { @changelog = STDIN.read }
|
131
131
|
yield o if block_given?
|
132
132
|
end
|
133
133
|
end
|
134
|
-
|
135
|
-
|
136
134
|
end
|
@@ -7,7 +7,6 @@ require 'new_relic/version'
|
|
7
7
|
require 'erb'
|
8
8
|
|
9
9
|
class NewRelic::Cli::Install < NewRelic::Cli::Command
|
10
|
-
|
11
10
|
NO_LICENSE_KEY = "<PASTE LICENSE KEY HERE>"
|
12
11
|
|
13
12
|
def self.command; "install"; end
|
@@ -21,7 +20,7 @@ class NewRelic::Cli::Install < NewRelic::Cli::Command
|
|
21
20
|
# Will throw CommandFailed exception if there's any error.
|
22
21
|
#
|
23
22
|
attr_reader :dest_dir, :license_key, :generated_for_user, :quiet, :src_file, :app_name
|
24
|
-
def initialize command_line_args={}
|
23
|
+
def initialize command_line_args = {}
|
25
24
|
@dest_dir = nil
|
26
25
|
super command_line_args
|
27
26
|
if @dest_dir.nil?
|
@@ -43,7 +42,7 @@ class NewRelic::Cli::Install < NewRelic::Cli::Command
|
|
43
42
|
if File.exist?(dest_file) && !@force
|
44
43
|
raise NewRelic::Cli::Command::CommandFailure, "newrelic.yml file already exists. Use --force flag to overwrite."
|
45
44
|
end
|
46
|
-
File.open(dest_file, 'w') { |
|
45
|
+
File.open(dest_file, 'w') { |out| out.puts(content) }
|
47
46
|
|
48
47
|
puts <<-EOF unless quiet
|
49
48
|
|
@@ -60,11 +59,10 @@ you receive upon registration.
|
|
60
59
|
|
61
60
|
Visit support.newrelic.com if you are experiencing installation issues.
|
62
61
|
EOF
|
63
|
-
|
64
62
|
end
|
65
63
|
|
66
64
|
def content
|
67
|
-
@src_file ||= File.expand_path(File.join(File.dirname(__FILE__),"..","..","..","..","newrelic.yml"))
|
65
|
+
@src_file ||= File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "..", "newrelic.yml"))
|
68
66
|
template = File.read(@src_file)
|
69
67
|
ERB.new(template).result(binding)
|
70
68
|
end
|
@@ -73,14 +71,12 @@ Visit support.newrelic.com if you are experiencing installation issues.
|
|
73
71
|
|
74
72
|
def options
|
75
73
|
OptionParser.new "Usage: #{$0} #{self.class.command} [ OPTIONS] 'application name'", 40 do |o|
|
76
|
-
o.on("-f", "--force", "Overwrite newrelic.yml if it exists") { |
|
74
|
+
o.on("-f", "--force", "Overwrite newrelic.yml if it exists") { |e| @force = true }
|
77
75
|
o.on("-l", "--license_key=NAME", String,
|
78
|
-
|
76
|
+
"Use the given license key") { |e| @license_key = e }
|
79
77
|
o.on("-d", "--destdir=name", String,
|
80
|
-
|
78
|
+
"Write the newrelic.yml to the given directory, default is '.'") { |e| @dest_dir = e }
|
81
79
|
yield o if block_given?
|
82
80
|
end
|
83
81
|
end
|
84
|
-
|
85
|
-
|
86
82
|
end
|
data/lib/new_relic/coerce.rb
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
module NewRelic
|
7
7
|
module Coerce
|
8
|
-
|
9
8
|
module_function
|
10
9
|
|
11
10
|
# We really don't want to send bad values to the collector, and it doesn't
|
@@ -15,14 +14,14 @@ module NewRelic
|
|
15
14
|
# to provide documentation of expected types on to_collector_array methods,
|
16
15
|
# and to log failures if totally invalid data gets into outgoing data
|
17
16
|
|
18
|
-
def int(value, context=nil)
|
17
|
+
def int(value, context = nil)
|
19
18
|
Integer(value)
|
20
19
|
rescue => error
|
21
20
|
log_failure(value, Integer, context, error)
|
22
21
|
0
|
23
22
|
end
|
24
23
|
|
25
|
-
def int_or_nil(value, context=nil)
|
24
|
+
def int_or_nil(value, context = nil)
|
26
25
|
return nil if value.nil?
|
27
26
|
Integer(value)
|
28
27
|
rescue => error
|
@@ -30,7 +29,7 @@ module NewRelic
|
|
30
29
|
nil
|
31
30
|
end
|
32
31
|
|
33
|
-
def float(value, context=nil)
|
32
|
+
def float(value, context = nil)
|
34
33
|
result = Float(value)
|
35
34
|
raise "Value #{result.inspect} is not finite." unless result.finite?
|
36
35
|
result
|
@@ -39,7 +38,7 @@ module NewRelic
|
|
39
38
|
0.0
|
40
39
|
end
|
41
40
|
|
42
|
-
def string(value, context=nil)
|
41
|
+
def string(value, context = nil)
|
43
42
|
return value if value.nil?
|
44
43
|
String(value)
|
45
44
|
rescue => error
|
@@ -54,8 +53,6 @@ module NewRelic
|
|
54
53
|
when Float
|
55
54
|
if val.finite?
|
56
55
|
val
|
57
|
-
else
|
58
|
-
nil
|
59
56
|
end
|
60
57
|
when Symbol
|
61
58
|
val.to_s
|
@@ -76,7 +73,7 @@ module NewRelic
|
|
76
73
|
value.to_i
|
77
74
|
end
|
78
75
|
|
79
|
-
def float! value, precision=NewRelic::PRIORITY_PRECISION
|
76
|
+
def float! value, precision = NewRelic::PRIORITY_PRECISION
|
80
77
|
return nil unless value_or_nil(value)
|
81
78
|
value.to_f.round(precision)
|
82
79
|
end
|
@@ -4,58 +4,59 @@
|
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module CollectionHelper
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
7
|
+
DEFAULT_TRUNCATION_SIZE = 16 * 1024
|
8
|
+
DEFAULT_ARRAY_TRUNCATION_SIZE = 128
|
9
|
+
# Transform parameter hash into a hash whose values are strictly
|
10
|
+
# strings
|
11
|
+
def normalize_params(params)
|
12
|
+
case params
|
13
|
+
when Hash
|
14
|
+
# optimize for empty hash since that is often what this is called with.
|
15
|
+
return params if params.empty?
|
16
|
+
new_params = {}
|
17
|
+
params.each do |key, value|
|
18
|
+
new_params[truncate(normalize_params(key), 64)] = normalize_params(value)
|
19
|
+
end
|
20
|
+
new_params
|
21
|
+
when Symbol, FalseClass, TrueClass, nil
|
22
|
+
params
|
23
|
+
when Numeric
|
24
|
+
truncate(params.to_s)
|
25
|
+
when String
|
26
|
+
truncate(params)
|
27
|
+
when Array
|
28
|
+
params.first(DEFAULT_ARRAY_TRUNCATION_SIZE).map { |item| normalize_params(item) }
|
29
|
+
else
|
30
|
+
truncate(flatten(params))
|
31
|
+
end
|
31
32
|
end
|
32
|
-
end
|
33
33
|
|
34
|
-
|
34
|
+
private
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
# Convert any kind of object to a short string.
|
37
|
+
def flatten(object)
|
38
|
+
case object
|
39
|
+
when nil then ''
|
40
|
+
when object.instance_of?(String) then object
|
41
|
+
when String then String.new(object) # convert string subclasses to strings
|
42
|
+
else "#<#{object.class.to_s}>"
|
43
|
+
end
|
43
44
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
|
46
|
+
def truncate(string, len = DEFAULT_TRUNCATION_SIZE)
|
47
|
+
case string
|
48
|
+
when Symbol then string
|
49
|
+
when nil then ""
|
50
|
+
when String
|
51
|
+
real_string = flatten(string)
|
52
|
+
if real_string.size > len
|
53
|
+
real_string = real_string.slice(0...len)
|
54
|
+
real_string << "..."
|
55
|
+
end
|
56
|
+
real_string
|
57
|
+
else
|
58
|
+
truncate(flatten(string), len)
|
54
59
|
end
|
55
|
-
real_string
|
56
|
-
else
|
57
|
-
truncate(flatten(string), len)
|
58
60
|
end
|
59
61
|
end
|
60
|
-
end
|
61
62
|
end
|
data/lib/new_relic/constants.rb
CHANGED
@@ -28,10 +28,6 @@ module NewRelic
|
|
28
28
|
TRACEPARENT_KEY = "traceparent"
|
29
29
|
TRACESTATE_KEY = "tracestate"
|
30
30
|
|
31
|
-
# Right now, old and new Rubies are the same. Intention is to use "(...)" for
|
32
|
-
# Ruby 2.7+ for argument delegation, but doing so is a breaking API change.
|
33
|
-
ARGS_FOR_RUBY_VERSION = RUBY_VERSION < "2.7.0" ? "*args, &block" : "*args, &block"
|
34
|
-
|
35
31
|
HTTP_TRACEPARENT_KEY = "HTTP_#{TRACEPARENT_KEY.upcase}"
|
36
32
|
HTTP_TRACESTATE_KEY = "HTTP_#{TRACESTATE_KEY.upcase}"
|
37
33
|
HTTP_NEWRELIC_KEY = "HTTP_#{NEWRELIC_KEY.upcase}"
|
@@ -9,7 +9,7 @@ module NewRelic
|
|
9
9
|
module ClassMethods
|
10
10
|
# Access the Control singleton, lazy initialized. Default will instantiate a new
|
11
11
|
# instance or pass false to defer
|
12
|
-
def instance(create=true)
|
12
|
+
def instance(create = true)
|
13
13
|
@instance ||= create && new_instance
|
14
14
|
end
|
15
15
|
|
@@ -35,7 +35,7 @@ module NewRelic
|
|
35
35
|
|
36
36
|
# nb this does not 'load test' the framework, it loads the 'test framework'
|
37
37
|
def load_test_framework
|
38
|
-
config = File.expand_path(File.join('..','..','..','..', "test","config","newrelic.yml"), __FILE__)
|
38
|
+
config = File.expand_path(File.join('..', '..', '..', '..', "test", "config", "newrelic.yml"), __FILE__)
|
39
39
|
require "config/test_control"
|
40
40
|
NewRelic::Control::Frameworks::Test.new(local_env, config)
|
41
41
|
end
|
@@ -11,7 +11,7 @@ module NewRelic
|
|
11
11
|
# out specifically because in this context we are not monitoring
|
12
12
|
# the running process, but actually external things.
|
13
13
|
class External < NewRelic::Control::Frameworks::Ruby
|
14
|
-
def init_config(options={})
|
14
|
+
def init_config(options = {})
|
15
15
|
super
|
16
16
|
end
|
17
17
|
end
|
@@ -10,9 +10,8 @@ module NewRelic
|
|
10
10
|
# Rails specific configuration, instrumentation, environment values,
|
11
11
|
# etc.
|
12
12
|
class Rails < NewRelic::Control::Frameworks::Ruby
|
13
|
-
|
14
13
|
def env
|
15
|
-
@env ||= (
|
14
|
+
@env ||= (ENV['NEW_RELIC_ENV'] || RAILS_ENV.dup)
|
16
15
|
end
|
17
16
|
|
18
17
|
# Rails can return an empty string from this method, causing
|
@@ -43,7 +42,7 @@ module NewRelic
|
|
43
42
|
# In versions of Rails prior to 2.0, the rails config was only available to
|
44
43
|
# the init.rb, so it had to be passed on from there. This is a best effort to
|
45
44
|
# find a config and use that.
|
46
|
-
def init_config(options={})
|
45
|
+
def init_config(options = {})
|
47
46
|
@config = options[:config]
|
48
47
|
# Install the dependency detection,
|
49
48
|
if rails_config && ::Rails.configuration.respond_to?(:after_initialize)
|
@@ -63,8 +62,8 @@ module NewRelic
|
|
63
62
|
end
|
64
63
|
rescue => e
|
65
64
|
::NewRelic::Agent.logger.error("Failure during init_config for Rails. Is Rails required in a non-Rails app? Set NEW_RELIC_FRAMEWORK=ruby to avoid this message.",
|
66
|
-
|
67
|
-
|
65
|
+
"The Ruby agent will continue running, but Rails-specific features may be missing.",
|
66
|
+
e)
|
68
67
|
end
|
69
68
|
|
70
69
|
def install_agent_hooks(config)
|
@@ -103,7 +102,7 @@ module NewRelic
|
|
103
102
|
protected
|
104
103
|
|
105
104
|
def rails_vendor_root
|
106
|
-
File.join(root,'vendor','rails')
|
105
|
+
File.join(root, 'vendor', 'rails')
|
107
106
|
end
|
108
107
|
|
109
108
|
def install_shim
|
@@ -13,9 +13,8 @@ module NewRelic
|
|
13
13
|
# NewRelic::Control::Frameworks::Rails class, where the two do
|
14
14
|
# not differ
|
15
15
|
class Rails3 < NewRelic::Control::Frameworks::Rails
|
16
|
-
|
17
16
|
def env
|
18
|
-
@env ||= (
|
17
|
+
@env ||= (ENV['NEW_RELIC_ENV'] || ::Rails.env.to_s)
|
19
18
|
end
|
20
19
|
|
21
20
|
def rails_root
|
@@ -23,7 +22,7 @@ module NewRelic
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def vendor_root
|
26
|
-
@vendor_root ||= File.join(root,'vendor','rails')
|
25
|
+
@vendor_root ||= File.join(root, 'vendor', 'rails')
|
27
26
|
end
|
28
27
|
|
29
28
|
def version
|
@@ -9,14 +9,14 @@ module NewRelic
|
|
9
9
|
class Ruby < NewRelic::Control
|
10
10
|
def env
|
11
11
|
@env ||= ENV['NEW_RELIC_ENV'] || ENV['RUBY_ENV'] || ENV['RAILS_ENV'] ||
|
12
|
-
|
12
|
+
ENV['APP_ENV'] || ENV['RACK_ENV'] || 'development'
|
13
13
|
end
|
14
14
|
|
15
15
|
def root
|
16
16
|
@root ||= ENV['APP_ROOT'] || '.'
|
17
17
|
end
|
18
18
|
|
19
|
-
def init_config(options={})
|
19
|
+
def init_config(options = {})
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -8,6 +8,12 @@ module NewRelic
|
|
8
8
|
module Frameworks
|
9
9
|
# Contains basic control logic for Sinatra
|
10
10
|
class Sinatra < NewRelic::Control::Frameworks::Ruby
|
11
|
+
protected
|
12
|
+
|
13
|
+
def install_shim
|
14
|
+
super
|
15
|
+
::Sinatra::Base.class_eval { include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim }
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
@@ -8,7 +8,6 @@ require 'new_relic/agent/agent_logger'
|
|
8
8
|
|
9
9
|
module NewRelic
|
10
10
|
class Control
|
11
|
-
|
12
11
|
# Contains methods that relate to the runtime usage of the control
|
13
12
|
# object. Note that these are subject to override in the
|
14
13
|
# NewRelic::Control::Framework classes that are actually instantiated
|
@@ -47,7 +46,7 @@ module NewRelic
|
|
47
46
|
# Subclasses are not allowed to override, but must implement
|
48
47
|
# init_config({}) which is called one or more times.
|
49
48
|
#
|
50
|
-
def init_plugin(options={})
|
49
|
+
def init_plugin(options = {})
|
51
50
|
env = determine_env(options)
|
52
51
|
|
53
52
|
configure_agent(env, options)
|
@@ -87,10 +86,10 @@ module NewRelic
|
|
87
86
|
|
88
87
|
if @started_in_env && @started_in_env != env
|
89
88
|
Agent.logger.error("Attempted to start agent in #{env.inspect} environment, but agent was already running in #{@started_in_env.inspect}",
|
90
|
-
|
89
|
+
"The agent will continue running in #{@started_in_env.inspect}. To alter this, ensure the desired environment is set before the agent starts.")
|
91
90
|
else
|
92
91
|
Agent.logger.info("Starting the New Relic agent version #{NewRelic::VERSION::STRING} in #{env.inspect} environment.",
|
93
|
-
|
92
|
+
"To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the #{env.inspect} section of your newrelic.yml.")
|
94
93
|
end
|
95
94
|
|
96
95
|
env
|
@@ -164,7 +163,7 @@ module NewRelic
|
|
164
163
|
|
165
164
|
protected
|
166
165
|
|
167
|
-
def initialize(local_env, config_file_override=nil)
|
166
|
+
def initialize(local_env, config_file_override = nil)
|
168
167
|
@install_lock = Mutex.new
|
169
168
|
@local_env = local_env
|
170
169
|
@started_in_env = nil
|
@@ -7,7 +7,6 @@ module NewRelic
|
|
7
7
|
# Contains methods that relate to adding and executing files that
|
8
8
|
# contain instrumentation for the Ruby Agent
|
9
9
|
module Instrumentation
|
10
|
-
|
11
10
|
# Adds a list of files in Dir.glob format
|
12
11
|
# (e.g. '/app/foo/**/*_instrumentation.rb')
|
13
12
|
# This requires the files within a rescue block, so that any
|
@@ -57,15 +56,46 @@ module NewRelic
|
|
57
56
|
|
58
57
|
# Instrumentation for the key code points inside rails for monitoring by NewRelic.
|
59
58
|
# note this file is loaded only if the newrelic agent is enabled (through config/newrelic.yml)
|
60
|
-
instrumentation_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'agent','instrumentation'))
|
59
|
+
instrumentation_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'agent', 'instrumentation'))
|
61
60
|
@instrumentation_files <<
|
62
|
-
|
63
|
-
|
64
|
-
@instrumentation_files.each { |
|
61
|
+
File.join(instrumentation_path, '*.rb') <<
|
62
|
+
File.join(instrumentation_path, app.to_s, '*.rb')
|
63
|
+
@instrumentation_files.each { |pattern| load_instrumentation_files pattern }
|
65
64
|
DependencyDetection.detect!
|
65
|
+
ruby_22_deprecation
|
66
|
+
rails_32_deprecation
|
66
67
|
::NewRelic::Agent.logger.info "Finished instrumentation"
|
67
68
|
end
|
68
69
|
end
|
70
|
+
|
71
|
+
def rails_32_deprecation
|
72
|
+
return unless defined?(Rails::VERSION) && Gem::Version.new(Rails::VERSION::STRING) <= Gem::Version.new('3.2')
|
73
|
+
deprecation_msg = 'The Ruby Agent is dropping support for Rails 3.2 ' \
|
74
|
+
'in a future major release. Please upgrade your Rails version to continue receiving support. ' \
|
75
|
+
|
76
|
+
Agent.logger.log_once(
|
77
|
+
:warn,
|
78
|
+
:deprecated_rails_version,
|
79
|
+
deprecation_msg
|
80
|
+
)
|
81
|
+
|
82
|
+
::NewRelic::Agent.record_metric("Supportability/Deprecated/Rails32", 1)
|
83
|
+
end
|
84
|
+
|
85
|
+
def ruby_22_deprecation
|
86
|
+
return unless RUBY_VERSION <= '2.2.0'
|
87
|
+
deprecation_msg = 'The Ruby Agent is dropping support for Ruby 2.2 ' \
|
88
|
+
'in version 9.0.0. Please upgrade your Ruby version to continue receiving support. ' \
|
89
|
+
|
90
|
+
::NewRelic::Agent.logger.log_once(
|
91
|
+
:warn,
|
92
|
+
:deprecated_ruby_version,
|
93
|
+
deprecation_msg
|
94
|
+
)
|
95
|
+
|
96
|
+
::NewRelic::Agent.record_metric("Supportability/Deprecated/Ruby22", 1)
|
97
|
+
end
|
98
|
+
|
69
99
|
include Instrumentation
|
70
100
|
end
|
71
101
|
end
|
@@ -4,9 +4,8 @@
|
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
7
|
-
|
8
7
|
# Structs holding info for the remote server and proxy server
|
9
|
-
class Server < Struct.new :name, :port
|
8
|
+
class Server < Struct.new :name, :port # :nodoc:
|
10
9
|
def to_s; "#{name}:#{port}"; end
|
11
10
|
end
|
12
11
|
|
@@ -22,7 +21,7 @@ module NewRelic
|
|
22
21
|
@api_server ||= NewRelic::Control::Server.new(Agent.config[:api_host], Agent.config[:api_port])
|
23
22
|
end
|
24
23
|
|
25
|
-
def server_from_host(hostname=nil)
|
24
|
+
def server_from_host(hostname = nil)
|
26
25
|
NewRelic::Control::Server.new(hostname || Agent.config[:host], Agent.config[:port])
|
27
26
|
end
|
28
27
|
end
|
data/lib/new_relic/control.rb
CHANGED
@@ -23,7 +23,6 @@ require 'new_relic/agent'
|
|
23
23
|
require 'new_relic/delayed_job_injection'
|
24
24
|
|
25
25
|
module NewRelic
|
26
|
-
|
27
26
|
# The Control is a singleton responsible for the startup and
|
28
27
|
# initialization sequence. The initializer uses a LocalEnvironment to
|
29
28
|
# detect the framework and instantiates the framework specific
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module DependencyDetection
|
6
|
-
|
7
6
|
module_function
|
8
7
|
|
9
8
|
@items = []
|
@@ -33,7 +32,7 @@ module DependencyDetection
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def dependency_by_name(name)
|
36
|
-
@items.find {|i| i.name == name }
|
35
|
+
@items.find { |i| i.name == name }
|
37
36
|
end
|
38
37
|
|
39
38
|
def installed?(name)
|
@@ -56,7 +55,6 @@ module DependencyDetection
|
|
56
55
|
attr_reader :dependencies
|
57
56
|
attr_reader :prepend_conflicts
|
58
57
|
|
59
|
-
|
60
58
|
def executed!
|
61
59
|
@executed = true
|
62
60
|
end
|
@@ -95,19 +93,19 @@ module DependencyDetection
|
|
95
93
|
yield
|
96
94
|
end
|
97
95
|
|
98
|
-
def prepend_instrument target_class, instrumenting_module, supportability_name=nil
|
96
|
+
def prepend_instrument target_class, instrumenting_module, supportability_name = nil
|
99
97
|
log_and_instrument("Prepend", instrumenting_module, supportability_name) do
|
100
98
|
target_class.send :prepend, instrumenting_module
|
101
99
|
end
|
102
100
|
end
|
103
101
|
|
104
|
-
def chain_instrument instrumenting_module, supportability_name=nil
|
102
|
+
def chain_instrument instrumenting_module, supportability_name = nil
|
105
103
|
log_and_instrument("MethodChaining", instrumenting_module, supportability_name) do
|
106
104
|
instrumenting_module.instrument!
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
110
|
-
def chain_instrument_target target, instrumenting_module, supportability_name=nil
|
108
|
+
def chain_instrument_target target, instrumenting_module, supportability_name = nil
|
111
109
|
NewRelic::Agent.logger.info "Installing deferred #{target} instrumentation"
|
112
110
|
log_and_instrument("MethodChaining", instrumenting_module, supportability_name) do
|
113
111
|
instrumenting_module.instrument! target
|
@@ -134,7 +132,7 @@ module DependencyDetection
|
|
134
132
|
begin
|
135
133
|
dep.call
|
136
134
|
rescue => err
|
137
|
-
NewRelic::Agent.logger.error(
|
135
|
+
NewRelic::Agent.logger.error("Error while detecting #{self.name}:", err)
|
138
136
|
false
|
139
137
|
end
|
140
138
|
end
|
@@ -148,7 +146,7 @@ module DependencyDetection
|
|
148
146
|
!(disabled_configured? || deprecated_disabled_configured?)
|
149
147
|
end
|
150
148
|
|
151
|
-
# TODO:
|
149
|
+
# TODO: MAJOR VERSION
|
152
150
|
# will only return true if a disabled key is found and is truthy
|
153
151
|
def deprecated_disabled_configured?
|
154
152
|
return false if self.name.nil?
|
@@ -222,7 +220,7 @@ module DependencyDetection
|
|
222
220
|
begin
|
223
221
|
conflict.call
|
224
222
|
rescue => err
|
225
|
-
NewRelic::Agent.logger.error(
|
223
|
+
NewRelic::Agent.logger.error("Error while checking prepend conflicts #{self.name}:", err)
|
226
224
|
false # assumes no conflicts exist since `prepend` is preferred method of instrumenting
|
227
225
|
end
|
228
226
|
end
|