newrelic_rpm 8.15.0 → 9.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.build_ignore +26 -0
- data/CHANGELOG.md +538 -44
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -1
- data/README.md +11 -6
- data/Rakefile +9 -9
- data/Thorfile +1 -1
- data/bin/newrelic +1 -0
- data/bin/newrelic_cmd +1 -0
- data/bin/nrdebug +36 -36
- data/init.rb +1 -1
- data/lib/new_relic/agent/agent.rb +3 -16
- data/lib/new_relic/agent/agent_helpers/connect.rb +5 -10
- data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
- data/lib/new_relic/agent/agent_helpers/special_startup.rb +3 -4
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
- data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
- data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
- data/lib/new_relic/agent/agent_logger.rb +9 -9
- data/lib/new_relic/agent/attribute_filter.rb +2 -4
- data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
- data/lib/new_relic/agent/attribute_processing.rb +2 -2
- data/lib/new_relic/agent/audit_logger.rb +5 -5
- data/lib/new_relic/agent/autostart.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command.rb +2 -2
- data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +8 -8
- data/lib/new_relic/agent/configuration/default_source.rb +428 -586
- data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
- data/lib/new_relic/agent/configuration/high_security_source.rb +3 -5
- data/lib/new_relic/agent/configuration/manager.rb +16 -2
- data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -26
- data/lib/new_relic/agent/configuration/server_source.rb +24 -24
- data/lib/new_relic/agent/configuration/yaml_source.rb +17 -4
- data/lib/new_relic/agent/connect/request_builder.rb +1 -1
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
- 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 +2 -2
- data/lib/new_relic/agent/database.rb +4 -18
- data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
- data/lib/new_relic/agent/datastores/redis.rb +6 -6
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +8 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
- data/lib/new_relic/agent/distributed_tracing.rb +6 -6
- data/lib/new_relic/agent/error_collector.rb +36 -8
- data/lib/new_relic/agent/error_filter.rb +5 -5
- data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
- data/lib/new_relic/agent/event_loop.rb +3 -3
- data/lib/new_relic/agent/external.rb +1 -1
- data/lib/new_relic/agent/harvester.rb +1 -3
- data/lib/new_relic/agent/heap.rb +2 -1
- data/lib/new_relic/agent/hostname.rb +1 -1
- data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
- data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +83 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
- data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +111 -0
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
- data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +93 -0
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
- data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -19
- data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +42 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
- data/lib/new_relic/agent/instrumentation/action_dispatch.rb +31 -0
- data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +64 -0
- data/lib/new_relic/agent/instrumentation/action_mailbox.rb +30 -0
- data/lib/new_relic/agent/instrumentation/action_mailbox_subscriber.rb +33 -0
- data/lib/new_relic/agent/instrumentation/action_mailer.rb +30 -0
- data/lib/new_relic/agent/instrumentation/action_mailer_subscriber.rb +85 -0
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +10 -10
- data/lib/new_relic/agent/instrumentation/active_job.rb +16 -3
- data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +41 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record.rb +4 -3
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -36
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +5 -4
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
- data/lib/new_relic/agent/instrumentation/active_storage.rb +4 -0
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +2 -30
- data/lib/new_relic/agent/instrumentation/active_support.rb +21 -6
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
- data/lib/new_relic/agent/instrumentation/active_support_subscriber.rb +41 -0
- data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
- data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
- data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +12 -3
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +3 -4
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +7 -6
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +9 -5
- data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/custom_events.rb +12 -0
- data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +4 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +8 -4
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +2 -2
- data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
- data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
- data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
- data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +5 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +27 -0
- data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +23 -0
- data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +25 -0
- data/lib/new_relic/agent/instrumentation/fiber.rb +25 -0
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +8 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +7 -2
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +8 -4
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +2 -2
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
- data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
- data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +14 -5
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +12 -12
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +6 -8
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -1
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +46 -1
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +7 -3
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +7 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +7 -2
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +14 -1
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +12 -15
- data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +6 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
- data/lib/new_relic/agent/instrumentation/roda/chain.rb +43 -0
- data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
- data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +68 -0
- data/lib/new_relic/agent/instrumentation/roda/prepend.rb +24 -0
- data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +29 -0
- data/lib/new_relic/agent/instrumentation/roda.rb +36 -0
- data/lib/new_relic/agent/instrumentation/sequel.rb +8 -9
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
- data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +4 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -3
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +10 -5
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -4
- data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
- data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +77 -0
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +3 -8
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +6 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +10 -6
- data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
- data/lib/new_relic/agent/linking_metadata.rb +2 -2
- data/lib/new_relic/agent/log_event_aggregator.rb +64 -17
- data/lib/new_relic/agent/log_event_attributes.rb +115 -0
- data/lib/new_relic/agent/logging.rb +77 -37
- data/lib/new_relic/agent/messaging.rb +9 -7
- data/lib/new_relic/agent/method_tracer.rb +7 -7
- data/lib/new_relic/agent/method_tracer_helpers.rb +27 -6
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -5
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +0 -1
- data/lib/new_relic/agent/new_relic_service.rb +47 -32
- data/lib/new_relic/agent/obfuscator.rb +1 -1
- data/lib/new_relic/agent/parameter_filtering.rb +6 -6
- data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
- data/lib/new_relic/agent/pipe_service.rb +5 -3
- data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +0 -1
- data/lib/new_relic/agent/rules_engine.rb +1 -1
- data/lib/new_relic/agent/sampler.rb +2 -1
- data/lib/new_relic/agent/sampler_collection.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
- data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/span_event_primitive.rb +18 -6
- data/lib/new_relic/agent/sql_sampler.rb +2 -2
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/system_info.rb +36 -10
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
- data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
- data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +25 -16
- data/lib/new_relic/agent/transaction/abstract_segment.rb +109 -48
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +13 -14
- data/lib/new_relic/agent/transaction/external_request_segment.rb +16 -13
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +2 -3
- data/lib/new_relic/agent/transaction/request_attributes.rb +47 -11
- data/lib/new_relic/agent/transaction/segment.rb +1 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/trace.rb +1 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
- data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
- data/lib/new_relic/agent/transaction/tracing.rb +10 -4
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +90 -58
- data/lib/new_relic/agent/transaction_error_primitive.rb +21 -5
- data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/transaction_event_primitive.rb +22 -3
- data/lib/new_relic/agent/transaction_sampler.rb +3 -3
- data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
- data/lib/new_relic/agent/utilization/aws.rb +1 -1
- data/lib/new_relic/agent/utilization/azure.rb +3 -3
- data/lib/new_relic/agent/utilization/gcp.rb +4 -6
- data/lib/new_relic/agent/utilization/pcf.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +6 -8
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +133 -36
- data/lib/new_relic/cli/command.rb +4 -3
- data/lib/new_relic/cli/commands/deployments.rb +26 -25
- data/lib/new_relic/cli/commands/install.rb +23 -23
- data/lib/new_relic/collection_helper.rb +2 -2
- data/lib/new_relic/constants.rb +10 -8
- data/lib/new_relic/control/class_methods.rb +4 -10
- data/lib/new_relic/control/frameworks/rails.rb +44 -20
- data/lib/new_relic/control/frameworks/roda.rb +20 -0
- data/lib/new_relic/control/instance_methods.rb +6 -6
- data/lib/new_relic/control/instrumentation.rb +1 -15
- data/lib/new_relic/control/private_instance_methods.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +20 -18
- data/lib/new_relic/environment_report.rb +4 -4
- data/lib/new_relic/helper.rb +2 -1
- data/lib/new_relic/language_support.rb +10 -1
- data/lib/new_relic/latest_changes.rb +6 -6
- data/lib/new_relic/local_environment.rb +0 -10
- data/lib/new_relic/noticed_error.rb +25 -20
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +0 -16
- data/lib/new_relic/rack/browser_monitoring.rb +21 -17
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
- data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
- data/lib/new_relic/supportability_helper.rb +4 -1
- data/lib/new_relic/traced_thread.rb +2 -3
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +4 -4
- data/lib/sequel/extensions/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +6 -6
- data/lib/sequel/plugins/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +4 -4
- data/lib/tasks/bump_version.rake +21 -0
- data/lib/tasks/config.rake +13 -12
- data/lib/tasks/coverage_report.rake +4 -4
- data/lib/tasks/helpers/config.html.erb +93 -0
- data/lib/tasks/helpers/format.rb +19 -15
- data/lib/tasks/helpers/newrelicyml.rb +144 -0
- data/lib/tasks/helpers/version_bump.rb +62 -0
- data/lib/tasks/install.rake +4 -4
- data/lib/tasks/instrumentation_generator/instrumentation.thor +16 -19
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +1 -1
- data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
- data/lib/tasks/newrelic.rb +1 -0
- data/lib/tasks/newrelicyml.rake +13 -0
- data/lib/tasks/tests.rake +77 -6
- data/newrelic.yml +393 -274
- data/newrelic_rpm.gemspec +41 -30
- data/test/agent_helper.rb +25 -24
- metadata +172 -35
- data/.gitignore +0 -42
- data/.project +0 -23
- data/.rubocop.yml +0 -1946
- data/.rubocop_todo.yml +0 -62
- data/.simplecov +0 -15
- data/.snyk +0 -11
- data/.yardopts +0 -27
- data/Brewfile +0 -12
- data/DOCKER.md +0 -167
- data/Dockerfile +0 -10
- data/Guardfile +0 -26
- data/config/database.yml +0 -5
- data/config.dot +0 -278
- data/docker-compose.yml +0 -107
- data/lefthook.yml +0 -9
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -83
- data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -33
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +0 -215
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -36
- data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -41
- data/lib/new_relic/agent/range_extensions.rb +0 -27
- data/lib/tasks/helpers/removers.rb +0 -33
- data/lib/tasks/multiverse.rake +0 -6
- data/lib/tasks/multiverse.rb +0 -77
@@ -9,9 +9,9 @@ DependencyDetection.defer do
|
|
9
9
|
@name = :action_cable_notifications
|
10
10
|
|
11
11
|
depends_on do
|
12
|
-
defined?(
|
13
|
-
|
14
|
-
defined?(
|
12
|
+
defined?(ActionCable::VERSION::MAJOR) &&
|
13
|
+
ActionCable::VERSION::MAJOR.to_i >= 5 &&
|
14
|
+
defined?(ActiveSupport)
|
15
15
|
end
|
16
16
|
|
17
17
|
depends_on do
|
@@ -25,7 +25,7 @@ DependencyDetection.defer do
|
|
25
25
|
|
26
26
|
executes do
|
27
27
|
# enumerate the specific events we want so that we do not get unexpected additions in the future
|
28
|
-
ActiveSupport::Notifications.subscribe(
|
28
|
+
ActiveSupport::Notifications.subscribe(/\A(?:perform_action|transmit.*|broadcast)\.action_cable\z/,
|
29
29
|
NewRelic::Agent::Instrumentation::ActionCableSubscriber.new)
|
30
30
|
|
31
31
|
ActiveSupport.on_load(:action_cable) do
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/instrumentation/action_controller_subscriber'
|
6
|
+
require 'new_relic/agent/instrumentation/action_controller_other_subscriber'
|
6
7
|
require 'new_relic/agent/prepend_supportability'
|
7
8
|
|
8
9
|
DependencyDetection.defer do
|
@@ -13,7 +14,8 @@ DependencyDetection.defer do
|
|
13
14
|
end
|
14
15
|
|
15
16
|
depends_on do
|
16
|
-
|
17
|
+
!NewRelic::Agent.config[:disable_action_controller] &&
|
18
|
+
defined?(ActionController) && (defined?(ActionController::Base) || defined?(ActionController::API))
|
17
19
|
end
|
18
20
|
|
19
21
|
executes do
|
@@ -29,5 +31,16 @@ DependencyDetection.defer do
|
|
29
31
|
|
30
32
|
NewRelic::Agent::Instrumentation::ActionControllerSubscriber \
|
31
33
|
.subscribe(/^process_action.action_controller$/)
|
34
|
+
|
35
|
+
subs = %w[send_file
|
36
|
+
send_data
|
37
|
+
send_stream
|
38
|
+
redirect_to
|
39
|
+
halted_callback
|
40
|
+
unpermitted_parameters]
|
41
|
+
|
42
|
+
# have to double escape period because its going from string -> regex
|
43
|
+
NewRelic::Agent::Instrumentation::ActionControllerOtherSubscriber \
|
44
|
+
.subscribe(Regexp.new("^(#{subs.join('|')})\\.action_controller$"))
|
32
45
|
end
|
33
46
|
end
|
@@ -7,16 +7,20 @@ module NewRelic
|
|
7
7
|
module Instrumentation
|
8
8
|
module Rake
|
9
9
|
module Tracer
|
10
|
+
INSTRUMENTATION_NAME = 'Rake'
|
11
|
+
|
10
12
|
def invoke_with_newrelic_tracing(*args)
|
11
13
|
unless NewRelic::Agent::Instrumentation::Rake.should_trace?(name)
|
12
14
|
return yield
|
13
15
|
end
|
14
16
|
|
17
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
18
|
+
|
15
19
|
begin
|
16
20
|
timeout = NewRelic::Agent.config[:'rake.connect_timeout']
|
17
21
|
NewRelic::Agent.instance.wait_on_connect(timeout)
|
18
22
|
rescue => e
|
19
|
-
NewRelic::Agent.logger.error(
|
23
|
+
NewRelic::Agent.logger.error('Exception in wait_on_connect', e)
|
20
24
|
return yield
|
21
25
|
end
|
22
26
|
|
@@ -36,9 +40,9 @@ module NewRelic
|
|
36
40
|
end
|
37
41
|
|
38
42
|
def safe_from_third_party_gem?
|
39
|
-
return true unless NewRelic::LanguageSupport.bundled_gem?(
|
43
|
+
return true unless NewRelic::LanguageSupport.bundled_gem?('newrelic-rake')
|
40
44
|
|
41
|
-
::NewRelic::Agent.logger.info(
|
45
|
+
::NewRelic::Agent.logger.info('Not installing New Relic supported Rake instrumentation because the third party newrelic-rake gem is present')
|
42
46
|
false
|
43
47
|
end
|
44
48
|
|
@@ -72,11 +76,7 @@ module NewRelic
|
|
72
76
|
def instrument_invoke_prerequisites_concurrently(task)
|
73
77
|
task.instance_eval do
|
74
78
|
def invoke_prerequisites_concurrently(*_)
|
75
|
-
NewRelic::Agent::MethodTracer.trace_execution_scoped(
|
76
|
-
prereqs = self.prerequisite_tasks.map(&:name).join(", ")
|
77
|
-
if txn = ::NewRelic::Agent::Tracer.current_transaction
|
78
|
-
txn.current_segment.params[:statement] = NewRelic::Agent::Database.truncate_query("Couldn't trace concurrent prereq tasks: #{prereqs}")
|
79
|
-
end
|
79
|
+
NewRelic::Agent::MethodTracer.trace_execution_scoped('Rake/execute/multitask') do
|
80
80
|
super
|
81
81
|
end
|
82
82
|
end
|
@@ -86,19 +86,16 @@ module NewRelic
|
|
86
86
|
def before_invoke_transaction(task)
|
87
87
|
ensure_at_exit
|
88
88
|
|
89
|
-
|
90
|
-
# make one node and annotate with prereq task names
|
89
|
+
instrument_execute_on_prereqs(task)
|
91
90
|
if task.application.options.always_multitask
|
92
91
|
instrument_invoke_prerequisites_concurrently(task)
|
93
|
-
else
|
94
|
-
instrument_execute_on_prereqs(task)
|
95
92
|
end
|
96
93
|
rescue => e
|
97
|
-
NewRelic::Agent.logger.error(
|
94
|
+
NewRelic::Agent.logger.error('Error during Rake task invoke', e)
|
98
95
|
end
|
99
96
|
|
100
97
|
def record_attributes(args, task)
|
101
|
-
command_line = task.application.top_level_tasks.join(
|
98
|
+
command_line = task.application.top_level_tasks.join(' ')
|
102
99
|
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes({:command => command_line},
|
103
100
|
:'job.rake',
|
104
101
|
NewRelic::Agent::AttributeFilter::DST_NONE)
|
@@ -109,7 +106,7 @@ module NewRelic
|
|
109
106
|
NewRelic::Agent::AttributeFilter::DST_NONE)
|
110
107
|
end
|
111
108
|
rescue => e
|
112
|
-
NewRelic::Agent.logger.error(
|
109
|
+
NewRelic::Agent.logger.error('Error during Rake task attribute recording.', e)
|
113
110
|
end
|
114
111
|
|
115
112
|
# Expects literal args passed to the task and array of task names
|
@@ -8,16 +8,16 @@ require_relative 'rake/prepend'
|
|
8
8
|
|
9
9
|
DependencyDetection.defer do
|
10
10
|
# Why not :rake? newrelic-rake used that name, so avoid conflicting
|
11
|
-
|
11
|
+
@name = :rake_instrumentation
|
12
12
|
configure_with :rake
|
13
13
|
|
14
14
|
depends_on { defined?(Rake) && defined?(Rake::VERSION) }
|
15
|
-
depends_on { Gem::Version.new(Rake::VERSION) >= Gem::Version.new(
|
15
|
+
depends_on { Gem::Version.new(Rake::VERSION) >= Gem::Version.new('10.0.0') }
|
16
16
|
depends_on { NewRelic::Agent.config[:'rake.tasks'].any? }
|
17
17
|
depends_on { NewRelic::Agent::Instrumentation::Rake.safe_from_third_party_gem? }
|
18
18
|
|
19
19
|
executes do
|
20
|
-
NewRelic::Agent.logger.info(
|
20
|
+
NewRelic::Agent.logger.info('Installing Rake instrumentation')
|
21
21
|
NewRelic::Agent.logger.debug("Instrumenting Rake tasks: #{NewRelic::Agent.config[:'rake.tasks']}")
|
22
22
|
end
|
23
23
|
|
@@ -12,6 +12,6 @@ module NewRelic::Agent::Instrumentation::Redis
|
|
12
12
|
PIPELINE_OPERATION = 'pipeline'
|
13
13
|
HAS_REDIS_CLIENT = defined?(::Redis) &&
|
14
14
|
Gem::Version.new(::Redis::VERSION) >= Gem::Version.new('5.0.0') &&
|
15
|
-
|
15
|
+
!defined?(::RedisClient).nil?
|
16
16
|
end
|
17
17
|
end
|
@@ -6,6 +6,8 @@ require_relative 'constants'
|
|
6
6
|
|
7
7
|
module NewRelic::Agent::Instrumentation
|
8
8
|
module Redis
|
9
|
+
INSTRUMENTATION_NAME = NewRelic::Agent.base_name(name)
|
10
|
+
|
9
11
|
def connect_with_tracing
|
10
12
|
with_tracing(Constants::CONNECT, database: db) { yield }
|
11
13
|
end
|
@@ -43,6 +45,8 @@ module NewRelic::Agent::Instrumentation
|
|
43
45
|
private
|
44
46
|
|
45
47
|
def with_tracing(operation, statement: nil, database: nil)
|
48
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
49
|
+
|
46
50
|
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
47
51
|
product: Constants::PRODUCT_NAME,
|
48
52
|
operation: operation,
|
@@ -79,7 +83,8 @@ module NewRelic::Agent::Instrumentation
|
|
79
83
|
self
|
80
84
|
# redis-client gem v0.11+ (self is a RedisClient::Middlewares)
|
81
85
|
elsif respond_to?(:client)
|
82
|
-
|
86
|
+
# The following line needs else branch coverage
|
87
|
+
client && client.config # rubocop:disable Style/SafeNavigation
|
83
88
|
# redis-client gem <0.11 (self is a RedisClient::Middlewares)
|
84
89
|
elsif defined?(::RedisClient)
|
85
90
|
::RedisClient.config if ::RedisClient.respond_to?(:config)
|
@@ -6,7 +6,11 @@ module NewRelic::Agent::Instrumentation
|
|
6
6
|
module Resque
|
7
7
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
8
8
|
|
9
|
+
INSTRUMENTATION_NAME = NewRelic::Agent.base_name(name)
|
10
|
+
|
9
11
|
def with_tracing
|
12
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
13
|
+
|
10
14
|
begin
|
11
15
|
perform_action_with_newrelic_trace(
|
12
16
|
:name => 'perform',
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module Roda
|
7
|
+
module Chain
|
8
|
+
def self.instrument!
|
9
|
+
::Roda.class_eval do
|
10
|
+
include ::NewRelic::Agent::Instrumentation::Roda::Tracer
|
11
|
+
|
12
|
+
alias_method(:_roda_handle_main_route_without_tracing, :_roda_handle_main_route)
|
13
|
+
|
14
|
+
def _roda_handle_main_route(*args)
|
15
|
+
_roda_handle_main_route_with_tracing(*args) do
|
16
|
+
_roda_handle_main_route_without_tracing(*args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Build
|
24
|
+
module Chain
|
25
|
+
def self.instrument!
|
26
|
+
::Roda.class_eval do
|
27
|
+
include ::NewRelic::Agent::Instrumentation::Roda::Tracer
|
28
|
+
|
29
|
+
class << self
|
30
|
+
alias_method(:build_rack_app_without_tracing, :build_rack_app)
|
31
|
+
|
32
|
+
def build_rack_app
|
33
|
+
build_rack_app_with_tracing do
|
34
|
+
build_rack_app_without_tracing
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module Roda
|
7
|
+
module Ignorer
|
8
|
+
def self.should_ignore?(app, type)
|
9
|
+
return false unless app.opts.include?(:newrelic_ignores)
|
10
|
+
|
11
|
+
app.opts[:newrelic_ignores][type].any? do |pattern|
|
12
|
+
pattern === app.request.path_info
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def newrelic_ignore(*routes)
|
17
|
+
set_newrelic_ignore(:routes, *routes)
|
18
|
+
end
|
19
|
+
|
20
|
+
def newrelic_ignore_apdex(*routes)
|
21
|
+
set_newrelic_ignore(:apdex, *routes)
|
22
|
+
end
|
23
|
+
|
24
|
+
def newrelic_ignore_enduser(*routes)
|
25
|
+
set_newrelic_ignore(:enduser, *routes)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def set_newrelic_ignore(type, *routes)
|
31
|
+
# Create a newrelic_ignores hash if one doesn't exist
|
32
|
+
opts[:newrelic_ignores] = Hash.new([]) if !opts.include?(:newrelic_ignores)
|
33
|
+
|
34
|
+
if routes.empty?
|
35
|
+
opts[:newrelic_ignores][type] += [Regexp.new('.*')]
|
36
|
+
else
|
37
|
+
opts[:newrelic_ignores][type] += routes.map do |r|
|
38
|
+
# Roda adds leading slashes to routes, so we need to do the same
|
39
|
+
"#{'/' unless r.start_with?('/')}#{r}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module Roda
|
7
|
+
module Tracer
|
8
|
+
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
9
|
+
|
10
|
+
INSTRUMENTATION_NAME = 'Roda'
|
11
|
+
|
12
|
+
def self.included(clazz)
|
13
|
+
clazz.extend(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
def newrelic_middlewares
|
17
|
+
middlewares = [NewRelic::Rack::BrowserMonitoring]
|
18
|
+
if NewRelic::Rack::AgentHooks.needed?
|
19
|
+
middlewares << NewRelic::Rack::AgentHooks
|
20
|
+
end
|
21
|
+
middlewares
|
22
|
+
end
|
23
|
+
|
24
|
+
def build_rack_app_with_tracing
|
25
|
+
unless NewRelic::Agent.config[:disable_roda_auto_middleware]
|
26
|
+
newrelic_middlewares.each do |middleware_class|
|
27
|
+
self.use middleware_class
|
28
|
+
end
|
29
|
+
end
|
30
|
+
yield
|
31
|
+
end
|
32
|
+
|
33
|
+
# Roda makes use of Rack, so we can get params from the request object
|
34
|
+
def rack_request_params
|
35
|
+
begin
|
36
|
+
@_request.params
|
37
|
+
rescue => e
|
38
|
+
NewRelic::Agent.logger.debug('Failed to get params from Rack request.', e)
|
39
|
+
NewRelic::EMPTY_HASH
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def _roda_handle_main_route_with_tracing(*args)
|
44
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
45
|
+
|
46
|
+
perform_action_with_newrelic_trace(
|
47
|
+
category: :roda,
|
48
|
+
name: ::NewRelic::Agent::Instrumentation::Roda::TransactionNamer.transaction_name(request),
|
49
|
+
params: ::NewRelic::Agent::ParameterFiltering::apply_filters(request.env, rack_request_params)
|
50
|
+
) do
|
51
|
+
yield
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def do_not_trace?
|
56
|
+
NewRelic::Agent::Instrumentation::Roda::Ignorer.should_ignore?(self, :routes)
|
57
|
+
end
|
58
|
+
|
59
|
+
def ignore_apdex?
|
60
|
+
NewRelic::Agent::Instrumentation::Roda::Ignorer.should_ignore?(self, :apdex)
|
61
|
+
end
|
62
|
+
|
63
|
+
def ignore_enduser?
|
64
|
+
NewRelic::Agent::Instrumentation::Roda::Ignorer.should_ignore?(self, :enduser)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
module NewRelic::Agent::Instrumentation
|
6
|
+
module Roda
|
7
|
+
module Prepend
|
8
|
+
include ::NewRelic::Agent::Instrumentation::Roda::Tracer
|
9
|
+
|
10
|
+
def _roda_handle_main_route(*args)
|
11
|
+
_roda_handle_main_route_with_tracing(*args) { super }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Build
|
16
|
+
module Prepend
|
17
|
+
include ::NewRelic::Agent::Instrumentation::Roda::Tracer
|
18
|
+
def build_rack_app
|
19
|
+
build_rack_app_with_tracing { super }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
module NewRelic
|
6
|
+
module Agent
|
7
|
+
module Instrumentation
|
8
|
+
module Roda
|
9
|
+
module TransactionNamer
|
10
|
+
extend self
|
11
|
+
|
12
|
+
REGEX_MULTIPLE_SLASHES = %r{^[/^]*(.*?)[/$?]*$}.freeze
|
13
|
+
|
14
|
+
def transaction_name(request)
|
15
|
+
path = request.path || ::NewRelic::Agent::UNKNOWN_METRIC
|
16
|
+
name = path.gsub(REGEX_MULTIPLE_SLASHES, '\1') # remove any rogue slashes
|
17
|
+
name = NewRelic::ROOT if name.empty?
|
18
|
+
name = "#{request.request_method} #{name}" if request.respond_to?(:request_method)
|
19
|
+
|
20
|
+
name
|
21
|
+
rescue => e
|
22
|
+
::NewRelic::Agent.logger.debug("#{e.class} : #{e.message} - Error encountered trying to identify Roda transaction name")
|
23
|
+
::NewRelic::Agent::UNKNOWN_METRIC
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require_relative 'roda/instrumentation'
|
6
|
+
require_relative 'roda/roda_transaction_namer'
|
7
|
+
require_relative 'roda/ignorer'
|
8
|
+
|
9
|
+
DependencyDetection.defer do
|
10
|
+
named :roda
|
11
|
+
|
12
|
+
depends_on do
|
13
|
+
defined?(Roda) &&
|
14
|
+
Gem::Version.new(Roda::RodaVersion) >= Gem::Version.new('3.19.0') &&
|
15
|
+
Roda::RodaPlugins::Base::ClassMethods.private_method_defined?(:build_rack_app) &&
|
16
|
+
Roda::RodaPlugins::Base::InstanceMethods.method_defined?(:_roda_handle_main_route)
|
17
|
+
end
|
18
|
+
|
19
|
+
executes do
|
20
|
+
require_relative '../../rack/agent_hooks'
|
21
|
+
require_relative '../../rack/browser_monitoring'
|
22
|
+
|
23
|
+
NewRelic::Agent.logger.info('Installing Roda instrumentation')
|
24
|
+
|
25
|
+
if use_prepend?
|
26
|
+
require_relative 'roda/prepend'
|
27
|
+
prepend_instrument Roda.singleton_class, NewRelic::Agent::Instrumentation::Roda::Build::Prepend
|
28
|
+
prepend_instrument Roda, NewRelic::Agent::Instrumentation::Roda::Prepend
|
29
|
+
else
|
30
|
+
require_relative 'roda/chain'
|
31
|
+
chain_instrument NewRelic::Agent::Instrumentation::Roda::Build::Chain
|
32
|
+
chain_instrument NewRelic::Agent::Instrumentation::Roda::Chain
|
33
|
+
end
|
34
|
+
Roda.class_eval { extend NewRelic::Agent::Instrumentation::Roda::Ignorer }
|
35
|
+
end
|
36
|
+
end
|
@@ -11,8 +11,7 @@ DependencyDetection.defer do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
depends_on do
|
14
|
-
!NewRelic::Agent.config[:disable_sequel_instrumentation]
|
15
|
-
!NewRelic::Agent.config[:disable_database_instrumentation]
|
14
|
+
!NewRelic::Agent.config[:disable_sequel_instrumentation]
|
16
15
|
end
|
17
16
|
|
18
17
|
def supported_sequel_version?
|
@@ -27,21 +26,21 @@ DependencyDetection.defer do
|
|
27
26
|
NewRelic::Agent.logger.info('Installing Sequel instrumentation')
|
28
27
|
|
29
28
|
if Sequel::Database.respond_to?(:extension)
|
30
|
-
Sequel::Database.extension(:
|
29
|
+
Sequel::Database.extension(:new_relic_instrumentation)
|
31
30
|
else
|
32
|
-
NewRelic::Agent.logger.info(
|
33
|
-
NewRelic::Agent.logger.info(
|
34
|
-
|
31
|
+
NewRelic::Agent.logger.info('Detected Sequel version %s.' % [Sequel::VERSION])
|
32
|
+
NewRelic::Agent.logger.info('Please see additional documentation: ' +
|
33
|
+
'https://docs.newrelic.com/docs/apm/agents/ruby-agent/frameworks/sequel-instrumentation/')
|
35
34
|
end
|
36
35
|
|
37
36
|
Sequel.synchronize { Sequel::DATABASES.dup }.each do |db|
|
38
|
-
db.extension(:
|
37
|
+
db.extension(:new_relic_instrumentation)
|
39
38
|
end
|
40
39
|
|
41
|
-
Sequel::Model.plugin(:
|
40
|
+
Sequel::Model.plugin(:new_relic_instrumentation) if defined?(Sequel::Model)
|
42
41
|
else
|
43
42
|
|
44
|
-
NewRelic::Agent.logger.info(
|
43
|
+
NewRelic::Agent.logger.info('Sequel instrumentation requires at least version 3.37.0.')
|
45
44
|
|
46
45
|
end
|
47
46
|
end
|
@@ -9,22 +9,22 @@ module NewRelic
|
|
9
9
|
extend self
|
10
10
|
|
11
11
|
# Fallback if the product cannot be determined
|
12
|
-
DEFAULT_PRODUCT_NAME =
|
12
|
+
DEFAULT_PRODUCT_NAME = 'Sequel'.freeze
|
13
13
|
|
14
14
|
# A Sequel adapter is called an "adapter_scheme" and can be accessed from
|
15
15
|
# the database:
|
16
16
|
#
|
17
17
|
# DB.adapter_scheme
|
18
18
|
PRODUCT_NAMES = {
|
19
|
-
:ibmdb =>
|
20
|
-
:firebird =>
|
21
|
-
:informix =>
|
22
|
-
:jdbc =>
|
23
|
-
:mysql =>
|
24
|
-
:mysql2 =>
|
25
|
-
:oracle =>
|
26
|
-
:postgres =>
|
27
|
-
:sqlite =>
|
19
|
+
:ibmdb => 'IBMDB2',
|
20
|
+
:firebird => 'Firebird',
|
21
|
+
:informix => 'Informix',
|
22
|
+
:jdbc => 'JDBC',
|
23
|
+
:mysql => 'MySQL',
|
24
|
+
:mysql2 => 'MySQL',
|
25
|
+
:oracle => 'Oracle',
|
26
|
+
:postgres => 'Postgres',
|
27
|
+
:sqlite => 'SQLite'
|
28
28
|
}.freeze
|
29
29
|
|
30
30
|
def product_name_from_adapter(adapter)
|
@@ -6,7 +6,11 @@ module NewRelic::Agent::Instrumentation::Sidekiq
|
|
6
6
|
class Client
|
7
7
|
include Sidekiq::ClientMiddleware if defined?(Sidekiq::ClientMiddleware)
|
8
8
|
|
9
|
+
INSTRUMENTATION_NAME = 'SidekiqClient'
|
10
|
+
|
9
11
|
def call(_worker_class, job, *_)
|
12
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
13
|
+
|
10
14
|
job[NewRelic::NEWRELIC_KEY] ||= distributed_tracing_headers if ::NewRelic::Agent.config[:'distributed_tracing.enabled']
|
11
15
|
yield
|
12
16
|
end
|
@@ -23,7 +23,7 @@ if defined?(Sidekiq::VERSION) && Sidekiq::VERSION < '7.0.0'
|
|
23
23
|
:category => 'OtherTransaction/SidekiqJob'
|
24
24
|
}
|
25
25
|
rescue => e
|
26
|
-
NewRelic::Agent.logger.error(
|
26
|
+
NewRelic::Agent.logger.error('Failure during deserializing YAML for Sidekiq::Extensions::DelayedClass', e)
|
27
27
|
NewRelic::Agent::Instrumentation::Sidekiq::Server.default_trace_args(msg)
|
28
28
|
end
|
29
29
|
end
|
@@ -7,9 +7,16 @@ module NewRelic::Agent::Instrumentation::Sidekiq
|
|
7
7
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
8
8
|
include Sidekiq::ServerMiddleware if defined?(Sidekiq::ServerMiddleware)
|
9
9
|
|
10
|
+
ATTRIBUTE_BASE_NAMESPACE = 'sidekiq.args'
|
11
|
+
ATTRIBUTE_FILTER_TYPES = %i[include exclude].freeze
|
12
|
+
ATTRIBUTE_JOB_NAMESPACE = :"job.#{ATTRIBUTE_BASE_NAMESPACE}"
|
13
|
+
INSTRUMENTATION_NAME = 'SidekiqServer'
|
14
|
+
|
10
15
|
# Client middleware has additional parameters, and our tests use the
|
11
16
|
# middleware client-side to work inline.
|
12
17
|
def call(worker, msg, queue, *_)
|
18
|
+
NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)
|
19
|
+
|
13
20
|
trace_args = if worker.respond_to?(:newrelic_trace_args)
|
14
21
|
worker.newrelic_trace_args(msg, queue)
|
15
22
|
else
|
@@ -18,10 +25,16 @@ module NewRelic::Agent::Instrumentation::Sidekiq
|
|
18
25
|
trace_headers = msg.delete(NewRelic::NEWRELIC_KEY)
|
19
26
|
|
20
27
|
perform_action_with_newrelic_trace(trace_args) do
|
21
|
-
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
|
22
|
-
NewRelic::Agent::
|
28
|
+
NewRelic::Agent::Transaction.merge_untrusted_agent_attributes(
|
29
|
+
NewRelic::Agent::AttributePreFiltering.pre_filter(msg['args'], self.class.nr_attribute_options),
|
30
|
+
ATTRIBUTE_JOB_NAMESPACE,
|
31
|
+
NewRelic::Agent::AttributeFilter::DST_NONE
|
32
|
+
)
|
33
|
+
|
34
|
+
if ::NewRelic::Agent.config[:'distributed_tracing.enabled'] && trace_headers&.any?
|
35
|
+
::NewRelic::Agent::DistributedTracing::accept_distributed_trace_headers(trace_headers, 'Other')
|
36
|
+
end
|
23
37
|
|
24
|
-
::NewRelic::Agent::DistributedTracing::accept_distributed_trace_headers(trace_headers, "Other") if ::NewRelic::Agent.config[:'distributed_tracing.enabled']
|
25
38
|
yield
|
26
39
|
end
|
27
40
|
end
|
@@ -33,5 +46,15 @@ module NewRelic::Agent::Instrumentation::Sidekiq
|
|
33
46
|
:category => 'OtherTransaction/SidekiqJob'
|
34
47
|
}
|
35
48
|
end
|
49
|
+
|
50
|
+
def self.nr_attribute_options
|
51
|
+
@nr_attribute_options ||= begin
|
52
|
+
ATTRIBUTE_FILTER_TYPES.each_with_object({}) do |type, opts|
|
53
|
+
pattern =
|
54
|
+
NewRelic::Agent::AttributePreFiltering.formulate_regexp_union(:"#{ATTRIBUTE_BASE_NAMESPACE}.#{type}")
|
55
|
+
opts[type] = pattern if pattern
|
56
|
+
end.merge(attribute_namespace: ATTRIBUTE_JOB_NAMESPACE)
|
57
|
+
end
|
58
|
+
end
|
36
59
|
end
|
37
60
|
end
|