newrelic_rpm 5.7.0.350 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +788 -0
- data/CONTRIBUTING.md +106 -19
- data/Gemfile +6 -2
- data/Guardfile +18 -1
- data/LICENSE +208 -38
- data/README.md +80 -84
- data/ROADMAP.md +24 -0
- data/Rakefile +2 -0
- data/THIRD_PARTY_NOTICES.md +213 -0
- data/bin/nrdebug +1 -1
- data/init.rb +1 -1
- data/install.rb +1 -1
- data/lib/new_relic/agent/adaptive_sampler.rb +1 -1
- data/lib/new_relic/agent/agent.rb +176 -191
- data/lib/new_relic/agent/agent_logger.rb +5 -1
- data/lib/new_relic/agent/attribute_filter.rb +8 -8
- data/lib/new_relic/agent/attribute_processing.rb +1 -1
- data/lib/new_relic/agent/attributes.rb +152 -0
- data/lib/new_relic/agent/audit_logger.rb +11 -1
- data/lib/new_relic/agent/autostart.rb +19 -15
- data/lib/new_relic/agent/chained_call.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command_router.rb +3 -22
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +447 -89
- data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -1
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -3
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
- data/lib/new_relic/agent/configuration/high_security_source.rb +2 -1
- data/lib/new_relic/agent/configuration/manager.rb +16 -12
- data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
- data/lib/new_relic/agent/configuration/security_policy_source.rb +1 -1
- data/lib/new_relic/agent/configuration/server_source.rb +39 -4
- data/lib/new_relic/agent/configuration/yaml_source.rb +12 -7
- data/lib/new_relic/agent/configuration.rb +1 -1
- data/lib/new_relic/agent/connect/request_builder.rb +61 -0
- data/lib/new_relic/agent/connect/response_handler.rb +61 -0
- data/lib/new_relic/agent/custom_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
- data/lib/new_relic/agent/database/obfuscator.rb +1 -1
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
- data/lib/new_relic/agent/database.rb +2 -3
- data/lib/new_relic/agent/database_adapter.rb +33 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +2 -3
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +3 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +9 -9
- data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo.rb +2 -2
- data/lib/new_relic/agent/datastores/redis.rb +1 -5
- data/lib/new_relic/agent/datastores.rb +7 -9
- data/lib/new_relic/agent/deprecator.rb +1 -1
- data/lib/new_relic/agent/{cross_app_payload.rb → distributed_tracing/cross_app_payload.rb} +3 -2
- data/lib/new_relic/agent/{cross_app_tracing.rb → distributed_tracing/cross_app_tracing.rb} +61 -46
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +84 -0
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +75 -0
- data/lib/new_relic/agent/{distributed_trace_payload.rb → distributed_tracing/distributed_trace_payload.rb} +32 -113
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +39 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +246 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +126 -0
- data/lib/new_relic/agent/distributed_tracing.rb +115 -32
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +37 -20
- data/lib/new_relic/agent/error_event_aggregator.rb +10 -7
- data/lib/new_relic/agent/error_trace_aggregator.rb +2 -1
- data/lib/new_relic/agent/event_aggregator.rb +27 -33
- data/lib/new_relic/agent/event_buffer.rb +1 -1
- data/lib/new_relic/agent/event_listener.rb +1 -1
- data/lib/new_relic/agent/event_loop.rb +1 -1
- data/lib/new_relic/agent/external.rb +13 -11
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/harvester.rb +1 -1
- data/lib/new_relic/agent/heap.rb +1 -1
- data/lib/new_relic/agent/hostname.rb +16 -2
- data/lib/new_relic/agent/http_clients/abstract.rb +82 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +25 -20
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +29 -14
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +18 -22
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +11 -12
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +17 -5
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +5 -7
- data/lib/new_relic/agent/http_clients/uri_util.rb +12 -11
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +26 -43
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +53 -73
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +81 -56
- data/lib/new_relic/agent/instrumentation/active_job.rb +7 -8
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +85 -38
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +17 -6
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +152 -0
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +35 -11
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +47 -49
- data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +13 -9
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +10 -9
- data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +45 -0
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +152 -0
- data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +35 -0
- data/lib/new_relic/agent/instrumentation/bunny.rb +13 -132
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +10 -4
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +93 -0
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +222 -0
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +63 -0
- data/lib/new_relic/agent/instrumentation/curb.rb +11 -183
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +5 -3
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +38 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +53 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +34 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +9 -49
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +8 -5
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +4 -3
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +25 -0
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +100 -0
- data/lib/new_relic/agent/instrumentation/grape/prepend.rb +17 -0
- data/lib/new_relic/agent/instrumentation/grape.rb +14 -118
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +25 -0
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +38 -0
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +17 -0
- data/lib/new_relic/agent/instrumentation/httpclient.rb +10 -30
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +22 -0
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +30 -0
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/httprb.rb +29 -0
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/chain.rb +16 -0
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +39 -118
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +56 -0
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +88 -0
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +88 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +55 -68
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +4 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +20 -11
- data/lib/new_relic/agent/instrumentation/mongo.rb +17 -4
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +36 -3
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +25 -0
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +40 -0
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +21 -0
- data/lib/new_relic/agent/instrumentation/net_http.rb +39 -0
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +100 -0
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +34 -0
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +27 -0
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +20 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +19 -52
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +57 -0
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +32 -0
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +73 -0
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +36 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +30 -138
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_cable.rb +6 -7
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_controller.rb +4 -4
- data/lib/new_relic/agent/instrumentation/{rails4 → rails_notifications}/action_view.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +25 -0
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +144 -0
- data/lib/new_relic/agent/instrumentation/rake/prepend.rb +14 -0
- data/lib/new_relic/agent/instrumentation/rake.rb +14 -155
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +34 -0
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +65 -0
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +24 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +11 -104
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +22 -0
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +33 -0
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +16 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +9 -26
- data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +48 -24
- data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +55 -0
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +30 -35
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +118 -0
- data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +33 -0
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -160
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +22 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +82 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +14 -0
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +12 -74
- data/lib/new_relic/agent/instrumentation.rb +1 -1
- data/lib/new_relic/agent/internal_agent_error.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +3 -3
- data/lib/new_relic/agent/log_once.rb +1 -1
- data/lib/new_relic/agent/logging.rb +139 -0
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +15 -82
- data/lib/new_relic/agent/method_tracer.rb +10 -8
- data/lib/new_relic/agent/method_tracer_helpers.rb +5 -5
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +110 -0
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +27 -0
- data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +4 -4
- data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +4 -7
- data/lib/new_relic/agent/monitors.rb +27 -0
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -2
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +6 -27
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +1 -1
- data/lib/new_relic/agent/new_relic_service.rb +95 -40
- data/lib/new_relic/agent/noticible_error.rb +22 -0
- data/lib/new_relic/agent/null_logger.rb +1 -1
- data/lib/new_relic/agent/obfuscator.rb +1 -1
- data/lib/new_relic/agent/parameter_filtering.rb +19 -6
- data/lib/new_relic/agent/payload_metric_mapping.rb +1 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
- data/lib/new_relic/agent/pipe_service.rb +1 -1
- data/lib/new_relic/agent/prepend_supportability.rb +1 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +9 -4
- data/lib/new_relic/agent/range_extensions.rb +1 -1
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine.rb +1 -1
- data/lib/new_relic/agent/sampler.rb +1 -1
- data/lib/new_relic/agent/sampler_collection.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +2 -2
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/vm_sampler.rb +1 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +3 -5
- data/lib/new_relic/agent/span_event_primitive.rb +108 -54
- data/lib/new_relic/agent/sql_sampler.rb +10 -10
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +2 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
- data/lib/new_relic/agent/stats_engine.rb +3 -3
- data/lib/new_relic/agent/supported_versions.rb +3 -3
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/system_info.rb +18 -4
- data/lib/new_relic/agent/threading/agent_thread.rb +2 -2
- data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +4 -4
- data/lib/new_relic/agent/threading/thread_profile.rb +10 -24
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +509 -0
- data/lib/new_relic/agent/transaction/abstract_segment.rb +33 -6
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +177 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +59 -149
- data/lib/new_relic/agent/transaction/external_request_segment.rb +32 -39
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -12
- data/lib/new_relic/agent/transaction/request_attributes.rb +1 -1
- data/lib/new_relic/agent/transaction/segment.rb +28 -2
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/trace.rb +6 -13
- data/lib/new_relic/agent/transaction/trace_builder.rb +1 -2
- data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +11 -9
- data/lib/new_relic/agent/transaction/tracing.rb +1 -100
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +140 -170
- data/lib/new_relic/agent/transaction_error_primitive.rb +11 -16
- data/lib/new_relic/agent/transaction_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -40
- data/lib/new_relic/agent/transaction_event_recorder.rb +4 -4
- data/lib/new_relic/agent/transaction_metrics.rb +1 -1
- data/lib/new_relic/agent/transaction_sampler.rb +2 -6
- data/lib/new_relic/agent/transaction_time_aggregator.rb +20 -6
- data/lib/new_relic/agent/utilization/aws.rb +1 -1
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization/gcp.rb +1 -1
- data/lib/new_relic/agent/utilization/pcf.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +1 -1
- data/lib/new_relic/agent/utilization_data.rb +37 -2
- data/lib/new_relic/agent/vm/jruby_vm.rb +1 -1
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +7 -5
- data/lib/new_relic/agent/vm/snapshot.rb +1 -1
- data/lib/new_relic/agent/vm.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +106 -18
- data/lib/new_relic/cli/command.rb +1 -1
- data/lib/new_relic/cli/commands/deployments.rb +2 -3
- data/lib/new_relic/cli/commands/install.rb +4 -3
- data/lib/new_relic/coerce.rb +32 -7
- data/lib/new_relic/collection_helper.rb +1 -1
- data/lib/new_relic/constants.rb +42 -0
- data/lib/new_relic/control/class_methods.rb +8 -2
- data/lib/new_relic/control/frameworks/external.rb +1 -1
- data/lib/new_relic/control/frameworks/merb.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +12 -10
- data/lib/new_relic/control/frameworks/rails3.rb +1 -1
- data/lib/new_relic/control/frameworks/rails4.rb +1 -1
- data/lib/new_relic/control/frameworks/{rails5.rb → rails_notifications.rb} +2 -2
- data/lib/new_relic/control/frameworks/ruby.rb +1 -1
- data/lib/new_relic/control/frameworks/sinatra.rb +1 -1
- data/lib/new_relic/control/frameworks.rb +1 -1
- data/lib/new_relic/control/instance_methods.rb +12 -2
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/server_methods.rb +1 -1
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +124 -14
- data/lib/new_relic/environment_report.rb +2 -4
- data/lib/new_relic/helper.rb +1 -1
- 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 +1 -1
- data/lib/new_relic/metric_data.rb +1 -1
- data/lib/new_relic/metric_spec.rb +1 -1
- data/lib/new_relic/noticed_error.rb +35 -18
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +2 -2
- data/lib/new_relic/rack/browser_monitoring.rb +16 -9
- data/lib/new_relic/rack.rb +1 -1
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/supportability_helper.rb +16 -1
- data/lib/new_relic/version.rb +3 -3
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +1 -1
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/config.rake +1 -2
- data/lib/tasks/multiverse.rb +35 -1
- data/lib/tasks/newrelic.rb +1 -1
- data/lib/tasks/tests.rake +6 -1
- data/newrelic_rpm.gemspec +22 -17
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +358 -78
- metadata +147 -66
- data/.travis.yml +0 -228
- data/cert/cacert.pem +0 -1177
- data/lib/new_relic/agent/commands/xray_session.rb +0 -55
- data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -110
- data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -41
- data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
- data/lib/new_relic/agent/instrumentation/active_record_4.rb +0 -42
- data/lib/new_relic/agent/instrumentation/active_record_5.rb +0 -41
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +0 -104
- data/lib/new_relic/agent/instrumentation/http.rb +0 -46
- data/lib/new_relic/agent/instrumentation/net.rb +0 -50
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -32
- data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +0 -27
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/new_relic/agent/transaction_state.rb +0 -186
- data/lib/new_relic/build.rb +0 -2
- data/lib/new_relic/metrics.rb +0 -13
- data/lib/tasks/versions.html.erb +0 -28
- data/lib/tasks/versions.postface.html +0 -8
- data/lib/tasks/versions.preface.html +0 -9
- data/lib/tasks/versions.rake +0 -65
- data/lib/tasks/versions.txt.erb +0 -14
@@ -1,17 +1,20 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
require_relative 'rake/instrumentation'
|
6
|
+
require_relative 'rake/chain'
|
7
|
+
require_relative 'rake/prepend'
|
4
8
|
|
5
9
|
DependencyDetection.defer do
|
6
10
|
# Why not :rake? newrelic-rake used that name, so avoid conflicting
|
7
11
|
named :rake_instrumentation
|
12
|
+
configure_with :rake
|
8
13
|
|
9
|
-
depends_on
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
::NewRelic::Agent::Instrumentation::RakeInstrumentation.should_install?
|
14
|
-
end
|
14
|
+
depends_on { defined?(::Rake) && defined?(::Rake::VERSION) }
|
15
|
+
depends_on { Gem::Version.new(::Rake::VERSION) >= Gem::Version.new("10.0.0") }
|
16
|
+
depends_on { ::NewRelic::Agent.config[:'rake.tasks'].any? }
|
17
|
+
depends_on { ::NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }
|
15
18
|
|
16
19
|
executes do
|
17
20
|
::NewRelic::Agent.logger.info "Installing Rake instrumentation"
|
@@ -19,154 +22,10 @@ DependencyDetection.defer do
|
|
19
22
|
end
|
20
23
|
|
21
24
|
executes do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def invoke(*args)
|
27
|
-
unless NewRelic::Agent::Instrumentation::RakeInstrumentation.should_trace? name
|
28
|
-
return invoke_without_newrelic(*args)
|
29
|
-
end
|
30
|
-
|
31
|
-
begin
|
32
|
-
timeout = NewRelic::Agent.config[:'rake.connect_timeout']
|
33
|
-
NewRelic::Agent.instance.wait_on_connect(timeout)
|
34
|
-
rescue => e
|
35
|
-
NewRelic::Agent.logger.error("Exception in wait_on_connect", e)
|
36
|
-
return invoke_without_newrelic(*args)
|
37
|
-
end
|
38
|
-
|
39
|
-
NewRelic::Agent::Instrumentation::RakeInstrumentation.before_invoke_transaction(self)
|
40
|
-
|
41
|
-
state = NewRelic::Agent::TransactionState.tl_get
|
42
|
-
NewRelic::Agent::Transaction.wrap(state, "OtherTransaction/Rake/invoke/#{name}", :rake) do
|
43
|
-
NewRelic::Agent::Instrumentation::RakeInstrumentation.record_attributes(args, self)
|
44
|
-
invoke_without_newrelic(*args)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
module NewRelic
|
53
|
-
module Agent
|
54
|
-
module Instrumentation
|
55
|
-
module RakeInstrumentation
|
56
|
-
def self.should_install?
|
57
|
-
is_supported_version? && safe_from_third_party_gem?
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.is_supported_version?
|
61
|
-
Gem::Version.new(::Rake::VERSION) >= Gem::Version.new("10.0.0")
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.safe_from_third_party_gem?
|
65
|
-
if NewRelic::LanguageSupport.bundled_gem?("newrelic-rake")
|
66
|
-
::NewRelic::Agent.logger.info("Not installing New Relic supported Rake instrumentation because the third party newrelic-rake gem is present")
|
67
|
-
false
|
68
|
-
else
|
69
|
-
true
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.should_trace?(name)
|
74
|
-
NewRelic::Agent.config[:'rake.tasks'].any? do |regex|
|
75
|
-
regex.match(name)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.instrument_execute_on_prereqs(task)
|
80
|
-
task.prerequisite_tasks.each do |child_task|
|
81
|
-
instrument_execute(child_task)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.instrument_execute(task)
|
86
|
-
return if task.instance_variable_get(:@__newrelic_instrumented_execute)
|
87
|
-
|
88
|
-
task.instance_variable_set(:@__newrelic_instrumented_execute, true)
|
89
|
-
task.instance_eval do
|
90
|
-
def execute(*args, &block)
|
91
|
-
NewRelic::Agent::MethodTracer.trace_execution_scoped("Rake/execute/#{self.name}") do
|
92
|
-
super
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
instrument_execute_on_prereqs(task)
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.instrument_invoke_prerequisites_concurrently(task)
|
101
|
-
task.instance_eval do
|
102
|
-
def invoke_prerequisites_concurrently(*_)
|
103
|
-
NewRelic::Agent::MethodTracer.trace_execution_scoped("Rake/execute/multitask") do
|
104
|
-
prereqs = self.prerequisite_tasks.map(&:name).join(", ")
|
105
|
-
if txn = ::NewRelic::Agent::TransactionState.tl_get.current_transaction
|
106
|
-
txn.current_segment.params[:statement] = NewRelic::Agent::Database.truncate_query("Couldn't trace concurrent prereq tasks: #{prereqs}")
|
107
|
-
end
|
108
|
-
super
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.before_invoke_transaction(task)
|
115
|
-
ensure_at_exit
|
116
|
-
|
117
|
-
# We can't represent overlapping operations yet, so if multitask just
|
118
|
-
# make one node and annotate with prereq task names
|
119
|
-
if task.application.options.always_multitask
|
120
|
-
instrument_invoke_prerequisites_concurrently(task)
|
121
|
-
else
|
122
|
-
instrument_execute_on_prereqs(task)
|
123
|
-
end
|
124
|
-
rescue => e
|
125
|
-
NewRelic::Agent.logger.error("Error during Rake task invoke", e)
|
126
|
-
end
|
127
|
-
|
128
|
-
def self.record_attributes(args, task)
|
129
|
-
command_line = task.application.top_level_tasks.join(" ")
|
130
|
-
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes({ :command => command_line },
|
131
|
-
:'job.rake',
|
132
|
-
NewRelic::Agent::AttributeFilter::DST_NONE)
|
133
|
-
named_args = name_the_args(args, task.arg_names)
|
134
|
-
unless named_args.empty?
|
135
|
-
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(named_args,
|
136
|
-
:'job.rake.args',
|
137
|
-
NewRelic::Agent::AttributeFilter::DST_NONE)
|
138
|
-
end
|
139
|
-
rescue => e
|
140
|
-
NewRelic::Agent.logger.error("Error during Rake task attribute recording.", e)
|
141
|
-
end
|
142
|
-
|
143
|
-
# Expects literal args passed to the task and array of task names
|
144
|
-
# If names are present without matching args, still sets them with nils
|
145
|
-
def self.name_the_args(args, names)
|
146
|
-
unfulfilled_names_length = names.length - args.length
|
147
|
-
if unfulfilled_names_length > 0
|
148
|
-
args.concat(Array.new(unfulfilled_names_length))
|
149
|
-
end
|
150
|
-
|
151
|
-
result = {}
|
152
|
-
args.zip(names).each_with_index do |(value, key), index|
|
153
|
-
result[key || index.to_s] = value
|
154
|
-
end
|
155
|
-
result
|
156
|
-
end
|
157
|
-
|
158
|
-
def self.ensure_at_exit
|
159
|
-
return if @installed_at_exit
|
160
|
-
|
161
|
-
at_exit do
|
162
|
-
# The agent's default at_exit might not default to installing, but
|
163
|
-
# if we are running an instrumented rake task, we always want it.
|
164
|
-
NewRelic::Agent.shutdown
|
165
|
-
end
|
166
|
-
|
167
|
-
@installed_at_exit = true
|
168
|
-
end
|
169
|
-
end
|
25
|
+
if use_prepend?
|
26
|
+
prepend_instrument ::Rake::Task, NewRelic::Agent::Instrumentation::Rake::Prepend
|
27
|
+
else
|
28
|
+
chain_instrument NewRelic::Agent::Instrumentation::Rake::Chain
|
170
29
|
end
|
171
30
|
end
|
172
31
|
end
|
@@ -0,0 +1,34 @@
|
|
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
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
module NewRelic::Agent::Instrumentation
|
7
|
+
module Redis
|
8
|
+
module Chain
|
9
|
+
def self.instrument!
|
10
|
+
::Redis::Client.class_eval do
|
11
|
+
include NewRelic::Agent::Instrumentation::Redis
|
12
|
+
|
13
|
+
alias_method :call_without_new_relic, :call
|
14
|
+
|
15
|
+
def call(*args, &block)
|
16
|
+
call_with_tracing(args[0]) { call_without_new_relic(*args, &block) }
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method :call_pipeline_without_new_relic, :call_pipeline
|
20
|
+
|
21
|
+
def call_pipeline(*args, &block)
|
22
|
+
call_pipeline_with_tracing(args[0]) { call_pipeline_without_new_relic(*args, &block) }
|
23
|
+
end
|
24
|
+
|
25
|
+
alias_method :connect_without_new_relic, :connect
|
26
|
+
|
27
|
+
def connect(*args, &block)
|
28
|
+
connect_with_tracing { connect_without_new_relic(*args, &block) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
module NewRelic::Agent::Instrumentation
|
7
|
+
module Redis
|
8
|
+
PRODUCT_NAME = 'Redis'
|
9
|
+
CONNECT = 'connect'
|
10
|
+
UNKNOWN = "unknown"
|
11
|
+
LOCALHOST = "localhost"
|
12
|
+
MULTI_OPERATION = 'multi'
|
13
|
+
PIPELINE_OPERATION = 'pipeline'
|
14
|
+
|
15
|
+
def call_with_tracing command, &block
|
16
|
+
operation = command[0]
|
17
|
+
statement = ::NewRelic::Agent::Datastores::Redis.format_command(command)
|
18
|
+
|
19
|
+
with_tracing(operation, statement) { yield }
|
20
|
+
end
|
21
|
+
|
22
|
+
def call_pipeline_with_tracing pipeline
|
23
|
+
operation = pipeline.is_a?(::Redis::Pipeline::Multi) ? MULTI_OPERATION : PIPELINE_OPERATION
|
24
|
+
statement = ::NewRelic::Agent::Datastores::Redis.format_pipeline_commands(pipeline.commands)
|
25
|
+
|
26
|
+
with_tracing(operation, statement) { yield }
|
27
|
+
end
|
28
|
+
|
29
|
+
def connect_with_tracing
|
30
|
+
with_tracing(CONNECT) { yield }
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def with_tracing operation, statement=nil
|
36
|
+
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
37
|
+
product: PRODUCT_NAME,
|
38
|
+
operation: operation,
|
39
|
+
host: _nr_hostname,
|
40
|
+
port_path_or_id: _nr_port_path_or_id,
|
41
|
+
database_name: db
|
42
|
+
)
|
43
|
+
begin
|
44
|
+
segment.notice_nosql_statement(statement) if statement
|
45
|
+
NewRelic::Agent::Tracer.capture_segment_error(segment) { yield }
|
46
|
+
ensure
|
47
|
+
segment.finish if segment
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def _nr_hostname
|
52
|
+
self.path ? LOCALHOST : self.host
|
53
|
+
rescue => e
|
54
|
+
NewRelic::Agent.logger.debug "Failed to retrieve Redis host: #{e}"
|
55
|
+
UNKNOWN
|
56
|
+
end
|
57
|
+
|
58
|
+
def _nr_port_path_or_id
|
59
|
+
self.path || self.port
|
60
|
+
rescue => e
|
61
|
+
NewRelic::Agent.logger.debug "Failed to retrieve Redis port_path_or_id: #{e}"
|
62
|
+
UNKNOWN
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -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
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
module NewRelic::Agent::Instrumentation
|
7
|
+
module Redis
|
8
|
+
module Prepend
|
9
|
+
include NewRelic::Agent::Instrumentation::Redis
|
10
|
+
|
11
|
+
def call *args, &block
|
12
|
+
call_with_tracing(args[0]) { super }
|
13
|
+
end
|
14
|
+
|
15
|
+
def call_pipeline *args, &block
|
16
|
+
call_pipeline_with_tracing(args[0]) { super }
|
17
|
+
end
|
18
|
+
|
19
|
+
def connect *args, &block
|
20
|
+
connect_with_tracing { super }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,47 +1,21 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/datastores'
|
6
6
|
require 'new_relic/agent/datastores/redis'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
module Redis
|
12
|
-
extend self
|
13
|
-
|
14
|
-
UNKNOWN = "unknown".freeze
|
15
|
-
LOCALHOST = "localhost".freeze
|
16
|
-
|
17
|
-
def host_for(client)
|
18
|
-
client.path ? LOCALHOST : client.host
|
19
|
-
rescue => e
|
20
|
-
NewRelic::Agent.logger.debug "Failed to retrieve Redis host: #{e}"
|
21
|
-
UNKNOWN
|
22
|
-
end
|
23
|
-
|
24
|
-
def port_path_or_id_for(client)
|
25
|
-
client.path || client.port
|
26
|
-
rescue => e
|
27
|
-
NewRelic::Agent.logger.debug "Failed to retrieve Redis port_path_or_id: #{e}"
|
28
|
-
UNKNOWN
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
8
|
+
require_relative 'redis/instrumentation'
|
9
|
+
require_relative 'redis/chain'
|
10
|
+
require_relative 'redis/prepend'
|
34
11
|
|
35
12
|
DependencyDetection.defer do
|
36
13
|
# Why not :redis? newrelic-redis used that name, so avoid conflicting
|
37
14
|
named :redis_instrumentation
|
38
|
-
|
15
|
+
configure_with :redis
|
16
|
+
|
39
17
|
depends_on do
|
40
|
-
defined? ::Redis
|
41
|
-
end
|
42
|
-
|
43
|
-
depends_on do
|
44
|
-
NewRelic::Agent.config[:disable_redis] == false
|
18
|
+
defined?(::Redis) && defined?(::Redis::VERSION)
|
45
19
|
end
|
46
20
|
|
47
21
|
depends_on do
|
@@ -51,77 +25,10 @@ DependencyDetection.defer do
|
|
51
25
|
|
52
26
|
executes do
|
53
27
|
NewRelic::Agent.logger.info 'Installing Redis Instrumentation'
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
def call(*args, &block)
|
59
|
-
operation = args[0][0]
|
60
|
-
statement = ::NewRelic::Agent::Datastores::Redis.format_command(args[0])
|
61
|
-
|
62
|
-
hostname = NewRelic::Agent::Instrumentation::Redis.host_for(self)
|
63
|
-
port_path_or_id = NewRelic::Agent::Instrumentation::Redis.port_path_or_id_for(self)
|
64
|
-
|
65
|
-
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
66
|
-
product: NewRelic::Agent::Datastores::Redis::PRODUCT_NAME,
|
67
|
-
operation: operation,
|
68
|
-
host: hostname,
|
69
|
-
port_path_or_id: port_path_or_id,
|
70
|
-
database_name: db
|
71
|
-
)
|
72
|
-
begin
|
73
|
-
segment.notice_nosql_statement(statement) if statement
|
74
|
-
call_without_new_relic(*args, &block)
|
75
|
-
ensure
|
76
|
-
segment.finish if segment
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
alias_method :call_pipeline_without_new_relic, :call_pipeline
|
81
|
-
|
82
|
-
def call_pipeline(*args, &block)
|
83
|
-
pipeline = args[0]
|
84
|
-
operation = pipeline.is_a?(::Redis::Pipeline::Multi) ? NewRelic::Agent::Datastores::Redis::MULTI_OPERATION : NewRelic::Agent::Datastores::Redis::PIPELINE_OPERATION
|
85
|
-
statement = ::NewRelic::Agent::Datastores::Redis.format_pipeline_commands(pipeline.commands)
|
86
|
-
|
87
|
-
hostname = NewRelic::Agent::Instrumentation::Redis.host_for(self)
|
88
|
-
port_path_or_id = NewRelic::Agent::Instrumentation::Redis.port_path_or_id_for(self)
|
89
|
-
|
90
|
-
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
91
|
-
product: NewRelic::Agent::Datastores::Redis::PRODUCT_NAME,
|
92
|
-
operation: operation,
|
93
|
-
host: hostname,
|
94
|
-
port_path_or_id: port_path_or_id,
|
95
|
-
database_name: db
|
96
|
-
)
|
97
|
-
begin
|
98
|
-
segment.notice_nosql_statement(statement)
|
99
|
-
call_pipeline_without_new_relic(*args, &block)
|
100
|
-
ensure
|
101
|
-
segment.finish if segment
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
alias_method :connect_without_new_relic, :connect
|
106
|
-
|
107
|
-
def connect(*args, &block)
|
108
|
-
hostname = NewRelic::Agent::Instrumentation::Redis.host_for(self)
|
109
|
-
port_path_or_id = NewRelic::Agent::Instrumentation::Redis.port_path_or_id_for(self)
|
110
|
-
|
111
|
-
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
112
|
-
product: NewRelic::Agent::Datastores::Redis::PRODUCT_NAME,
|
113
|
-
operation: NewRelic::Agent::Datastores::Redis::CONNECT,
|
114
|
-
host: hostname,
|
115
|
-
port_path_or_id: port_path_or_id,
|
116
|
-
database_name: db
|
117
|
-
)
|
118
|
-
|
119
|
-
begin
|
120
|
-
connect_without_new_relic(*args, &block)
|
121
|
-
ensure
|
122
|
-
segment.finish if segment
|
123
|
-
end
|
124
|
-
end
|
28
|
+
if use_prepend?
|
29
|
+
prepend_instrument ::Redis::Client, NewRelic::Agent::Instrumentation::Redis::Prepend
|
30
|
+
else
|
31
|
+
chain_instrument NewRelic::Agent::Instrumentation::Redis::Chain
|
125
32
|
end
|
126
33
|
end
|
127
34
|
end
|
@@ -0,0 +1,22 @@
|
|
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
|
+
|
6
|
+
module NewRelic::Agent::Instrumentation
|
7
|
+
module Resque
|
8
|
+
module Chain
|
9
|
+
def self.instrument!
|
10
|
+
::Resque::Job.class_eval do
|
11
|
+
include NewRelic::Agent::Instrumentation::Resque
|
12
|
+
|
13
|
+
alias_method :perform_without_instrumentation, :perform
|
14
|
+
|
15
|
+
def perform
|
16
|
+
with_tracing { perform_without_instrumentation }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
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
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
module NewRelic::Agent::Instrumentation
|
7
|
+
module Resque
|
8
|
+
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
9
|
+
|
10
|
+
def with_tracing
|
11
|
+
begin
|
12
|
+
perform_action_with_newrelic_trace(
|
13
|
+
:name => 'perform',
|
14
|
+
:class_name => self.payload_class,
|
15
|
+
:category => 'OtherTransaction/ResqueJob') do
|
16
|
+
|
17
|
+
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
|
18
|
+
args,
|
19
|
+
:'job.resque.args',
|
20
|
+
NewRelic::Agent::AttributeFilter::DST_NONE)
|
21
|
+
|
22
|
+
yield
|
23
|
+
end
|
24
|
+
ensure
|
25
|
+
# Stopping the event loop before flushing the pipe.
|
26
|
+
# The goal is to avoid conflict during write.
|
27
|
+
NewRelic::Agent.agent.stop_event_loop
|
28
|
+
NewRelic::Agent.agent.flush_pipe_data
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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
|
+
|
6
|
+
module NewRelic::Agent::Instrumentation
|
7
|
+
module Resque
|
8
|
+
module Prepend
|
9
|
+
include NewRelic::Agent::Instrumentation::Resque
|
10
|
+
|
11
|
+
def perform
|
12
|
+
with_tracing { super }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
|
5
|
+
require_relative 'resque/instrumentation'
|
6
|
+
require_relative 'resque/chain'
|
7
|
+
require_relative 'resque/prepend'
|
4
8
|
|
5
9
|
DependencyDetection.defer do
|
6
10
|
@name = :resque
|
@@ -22,31 +26,10 @@ DependencyDetection.defer do
|
|
22
26
|
end
|
23
27
|
|
24
28
|
executes do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
alias_method :perform_without_instrumentation, :perform
|
30
|
-
|
31
|
-
def perform
|
32
|
-
begin
|
33
|
-
perform_action_with_newrelic_trace(
|
34
|
-
:name => 'perform',
|
35
|
-
:class_name => self.payload_class,
|
36
|
-
:category => 'OtherTransaction/ResqueJob') do
|
37
|
-
|
38
|
-
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
|
39
|
-
args,
|
40
|
-
:'job.resque.args',
|
41
|
-
NewRelic::Agent::AttributeFilter::DST_NONE)
|
42
|
-
|
43
|
-
perform_without_instrumentation
|
44
|
-
end
|
45
|
-
ensure
|
46
|
-
NewRelic::Agent.agent.flush_pipe_data
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
29
|
+
if use_prepend?
|
30
|
+
prepend_instrument ::Resque::Job, NewRelic::Agent::Instrumentation::Resque::Prepend
|
31
|
+
else
|
32
|
+
chain_instrument NewRelic::Agent::Instrumentation::Resque::Chain
|
50
33
|
end
|
51
34
|
|
52
35
|
if NewRelic::LanguageSupport.can_fork?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
# encoding: utf-8
|
3
3
|
# This file is distributed under New Relic's license terms.
|
4
|
-
# See https://github.com/newrelic/
|
4
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
5
5
|
|
6
6
|
DependencyDetection.defer do
|
7
7
|
@name = :sequel
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|