newrelic_rpm 8.10.0 → 8.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +32 -190
- data/.rubocop_todo.yml +52 -0
- data/.simplecov +11 -2
- data/CHANGELOG.md +91 -26
- data/Gemfile +0 -1
- data/README.md +1 -1
- data/Rakefile +3 -20
- data/Thorfile +5 -0
- data/bin/nrdebug +63 -43
- data/config.dot +5 -5
- data/init.rb +1 -2
- data/install.rb +1 -2
- data/lib/new_relic/agent/adaptive_sampler.rb +0 -1
- data/lib/new_relic/agent/agent/shutdown.rb +0 -1
- data/lib/new_relic/agent/agent/special_startup.rb +0 -1
- data/lib/new_relic/agent/agent/start_worker_thread.rb +0 -1
- data/lib/new_relic/agent/agent/startup.rb +0 -1
- data/lib/new_relic/agent/agent.rb +100 -73
- data/lib/new_relic/agent/agent_logger.rb +4 -5
- data/lib/new_relic/agent/attribute_filter.rb +39 -21
- data/lib/new_relic/agent/attribute_processing.rb +3 -4
- data/lib/new_relic/agent/attributes.rb +0 -1
- data/lib/new_relic/agent/audit_logger.rb +2 -3
- data/lib/new_relic/agent/autostart.rb +0 -1
- data/lib/new_relic/agent/chained_call.rb +0 -1
- data/lib/new_relic/agent/commands/agent_command.rb +0 -1
- data/lib/new_relic/agent/commands/agent_command_router.rb +3 -4
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -1
- data/lib/new_relic/agent/configuration/default_source.rb +56 -27
- data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -2
- data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +0 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +0 -1
- data/lib/new_relic/agent/configuration/manager.rb +1 -2
- data/lib/new_relic/agent/configuration/manual_source.rb +0 -1
- data/lib/new_relic/agent/configuration/mask_defaults.rb +2 -3
- data/lib/new_relic/agent/configuration/security_policy_source.rb +0 -1
- data/lib/new_relic/agent/configuration/server_source.rb +0 -1
- data/lib/new_relic/agent/configuration/yaml_source.rb +2 -3
- data/lib/new_relic/agent/configuration.rb +0 -1
- data/lib/new_relic/agent/connect/request_builder.rb +1 -2
- data/lib/new_relic/agent/connect/response_handler.rb +1 -2
- data/lib/new_relic/agent/custom_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +0 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +0 -1
- data/lib/new_relic/agent/database/obfuscator.rb +0 -1
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +0 -1
- data/lib/new_relic/agent/database.rb +13 -14
- data/lib/new_relic/agent/database_adapter.rb +0 -1
- data/lib/new_relic/agent/datastores/metric_helper.rb +0 -4
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -4
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +0 -1
- data/lib/new_relic/agent/datastores/mongo.rb +0 -1
- data/lib/new_relic/agent/datastores/redis.rb +0 -1
- data/lib/new_relic/agent/datastores.rb +0 -1
- data/lib/new_relic/agent/deprecator.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +0 -2
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +0 -1
- data/lib/new_relic/agent/distributed_tracing.rb +0 -1
- data/lib/new_relic/agent/encoding_normalizer.rb +0 -1
- data/lib/new_relic/agent/error_collector.rb +0 -1
- data/lib/new_relic/agent/error_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/error_filter.rb +4 -5
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -2
- data/lib/new_relic/agent/event_aggregator.rb +0 -1
- data/lib/new_relic/agent/event_buffer.rb +0 -1
- data/lib/new_relic/agent/event_listener.rb +0 -1
- data/lib/new_relic/agent/event_loop.rb +2 -3
- data/lib/new_relic/agent/external.rb +1 -2
- data/lib/new_relic/agent/guid_generator.rb +0 -1
- data/lib/new_relic/agent/harvester.rb +0 -1
- data/lib/new_relic/agent/heap.rb +2 -3
- data/lib/new_relic/agent/hostname.rb +0 -1
- data/lib/new_relic/agent/http_clients/abstract.rb +0 -1
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +0 -1
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +0 -1
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +0 -1
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +0 -1
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +8 -5
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +1 -2
- data/lib/new_relic/agent/instrumentation/active_job.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_storage.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +0 -1
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -1
- data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -1
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +0 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -3
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +14 -11
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +0 -1
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -2
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +0 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grape/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grape.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +0 -9
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +10 -9
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +0 -6
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc/helper.rb +2 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_desc_prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_server_prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httprb.rb +0 -1
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +0 -1
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/logger.rb +0 -1
- data/lib/new_relic/agent/instrumentation/memcache/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +1 -2
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +4 -5
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +0 -1
- data/lib/new_relic/agent/instrumentation/mongo.rb +0 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +1 -2
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/net_http.rb +0 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/padrino.rb +0 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/queue_time.rb +0 -2
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +5 -1
- data/lib/new_relic/agent/instrumentation/rake/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +0 -1
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sequel.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +1 -2
- data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -1
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/thread.rb +0 -1
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/tilt.rb +0 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +0 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -4
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
- data/lib/new_relic/agent/instrumentation.rb +0 -1
- data/lib/new_relic/agent/internal_agent_error.rb +0 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -2
- data/lib/new_relic/agent/linking_metadata.rb +0 -1
- data/lib/new_relic/agent/local_log_decorator.rb +0 -1
- data/lib/new_relic/agent/log_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/log_once.rb +0 -1
- data/lib/new_relic/agent/log_priority.rb +0 -1
- data/lib/new_relic/agent/logging.rb +0 -1
- data/lib/new_relic/agent/memory_logger.rb +0 -1
- data/lib/new_relic/agent/messaging.rb +1 -2
- data/lib/new_relic/agent/method_tracer.rb +0 -1
- data/lib/new_relic/agent/method_tracer_helpers.rb +1 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +0 -1
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +0 -1
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +0 -1
- data/lib/new_relic/agent/monitors.rb +0 -1
- data/lib/new_relic/agent/new_relic_service/encoders.rb +0 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +0 -1
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +0 -1
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +0 -1
- data/lib/new_relic/agent/new_relic_service.rb +193 -142
- data/lib/new_relic/agent/{noticible_error.rb → noticeable_error.rb} +1 -2
- data/lib/new_relic/agent/null_logger.rb +0 -1
- data/lib/new_relic/agent/obfuscator.rb +1 -2
- data/lib/new_relic/agent/parameter_filtering.rb +0 -1
- data/lib/new_relic/agent/payload_metric_mapping.rb +0 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +0 -1
- data/lib/new_relic/agent/pipe_service.rb +0 -1
- data/lib/new_relic/agent/prepend_supportability.rb +0 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -3
- data/lib/new_relic/agent/range_extensions.rb +0 -1
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +0 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +0 -1
- data/lib/new_relic/agent/rules_engine.rb +0 -1
- data/lib/new_relic/agent/sampler.rb +0 -1
- data/lib/new_relic/agent/sampler_collection.rb +0 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +0 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +0 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +5 -6
- data/lib/new_relic/agent/samplers/object_sampler.rb +0 -1
- data/lib/new_relic/agent/samplers/vm_sampler.rb +2 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/span_event_primitive.rb +0 -2
- data/lib/new_relic/agent/sql_sampler.rb +0 -1
- data/lib/new_relic/agent/stats.rb +12 -3
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +0 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -2
- data/lib/new_relic/agent/stats_engine.rb +0 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/system_info.rb +1 -2
- data/lib/new_relic/agent/threading/agent_thread.rb +12 -9
- data/lib/new_relic/agent/threading/backtrace_node.rb +0 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +0 -1
- data/lib/new_relic/agent/threading/thread_profile.rb +1 -2
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +0 -1
- data/lib/new_relic/agent/tracer.rb +7 -6
- data/lib/new_relic/agent/transaction/abstract_segment.rb +2 -3
- data/lib/new_relic/agent/transaction/datastore_segment.rb +0 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +0 -1
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +0 -1
- data/lib/new_relic/agent/transaction/external_request_segment.rb +1 -2
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +0 -1
- data/lib/new_relic/agent/transaction/request_attributes.rb +0 -1
- data/lib/new_relic/agent/transaction/segment.rb +0 -1
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +0 -1
- data/lib/new_relic/agent/transaction/trace.rb +0 -1
- data/lib/new_relic/agent/transaction/trace_builder.rb +0 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +0 -1
- data/lib/new_relic/agent/transaction/trace_node.rb +2 -3
- data/lib/new_relic/agent/transaction/tracing.rb +0 -1
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction.rb +3 -5
- data/lib/new_relic/agent/transaction_error_primitive.rb +0 -1
- data/lib/new_relic/agent/transaction_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/transaction_event_primitive.rb +0 -1
- data/lib/new_relic/agent/transaction_event_recorder.rb +1 -2
- data/lib/new_relic/agent/transaction_metrics.rb +1 -2
- data/lib/new_relic/agent/transaction_sampler.rb +0 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -2
- data/lib/new_relic/agent/utilization/aws.rb +0 -1
- data/lib/new_relic/agent/utilization/azure.rb +1 -2
- data/lib/new_relic/agent/utilization/gcp.rb +1 -2
- data/lib/new_relic/agent/utilization/pcf.rb +1 -2
- data/lib/new_relic/agent/utilization/vendor.rb +1 -2
- data/lib/new_relic/agent/utilization_data.rb +0 -1
- data/lib/new_relic/agent/vm/jruby_vm.rb +0 -1
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +0 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +35 -23
- data/lib/new_relic/agent/vm/snapshot.rb +1 -2
- data/lib/new_relic/agent/vm.rb +0 -1
- data/lib/new_relic/agent/worker_loop.rb +0 -1
- data/lib/new_relic/agent.rb +13 -16
- data/lib/new_relic/cli/command.rb +1 -2
- data/lib/new_relic/cli/commands/deployments.rb +72 -21
- data/lib/new_relic/cli/commands/install.rb +0 -1
- data/lib/new_relic/coerce.rb +0 -1
- data/lib/new_relic/collection_helper.rb +1 -2
- data/lib/new_relic/constants.rb +0 -1
- data/lib/new_relic/control/class_methods.rb +0 -1
- data/lib/new_relic/control/frameworks/external.rb +0 -1
- data/lib/new_relic/control/frameworks/rails.rb +0 -1
- data/lib/new_relic/control/frameworks/rails3.rb +0 -1
- data/lib/new_relic/control/frameworks/rails4.rb +0 -1
- data/lib/new_relic/control/frameworks/rails_notifications.rb +0 -1
- data/lib/new_relic/control/frameworks/ruby.rb +0 -1
- data/lib/new_relic/control/frameworks/sinatra.rb +0 -1
- data/lib/new_relic/control/frameworks.rb +0 -1
- data/lib/new_relic/control/instance_methods.rb +17 -40
- data/lib/new_relic/control/instrumentation.rb +0 -1
- data/lib/new_relic/control/private_instance_methods.rb +48 -0
- data/lib/new_relic/control/server_methods.rb +0 -1
- data/lib/new_relic/control.rb +0 -1
- data/lib/new_relic/delayed_job_injection.rb +0 -1
- data/lib/new_relic/dependency_detection.rb +3 -4
- data/lib/new_relic/environment_report.rb +23 -14
- data/lib/new_relic/helper.rb +1 -2
- data/lib/new_relic/language_support.rb +7 -3
- data/lib/new_relic/latest_changes.rb +3 -4
- data/lib/new_relic/local_environment.rb +3 -4
- data/lib/new_relic/metric_data.rb +27 -22
- data/lib/new_relic/metric_spec.rb +0 -1
- data/lib/new_relic/noticed_error.rb +3 -6
- data/lib/new_relic/rack/agent_hooks.rb +0 -1
- data/lib/new_relic/rack/agent_middleware.rb +0 -1
- data/lib/new_relic/rack/browser_monitoring.rb +131 -123
- data/lib/new_relic/rack.rb +0 -1
- data/lib/new_relic/recipes/capistrano3.rb +2 -59
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -2
- data/lib/new_relic/recipes/helpers/send_deployment.rb +69 -0
- data/lib/new_relic/recipes.rb +0 -1
- data/lib/new_relic/supportability_helper.rb +1 -2
- data/lib/new_relic/traced_thread.rb +0 -1
- data/lib/new_relic/version.rb +1 -2
- data/lib/newrelic_rpm.rb +0 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +2 -3
- data/lib/sequel/plugins/newrelic_instrumentation.rb +0 -1
- data/lib/tasks/all.rb +0 -1
- data/lib/tasks/config.rake +4 -113
- data/lib/tasks/coverage_report.rake +20 -15
- data/lib/tasks/{config.html.erb → helpers/config.html.erb} +0 -0
- data/lib/tasks/{config.text.erb → helpers/config.text.erb} +0 -0
- data/lib/tasks/helpers/format.rb +120 -0
- data/lib/tasks/helpers/matches.rb +12 -0
- data/lib/tasks/helpers/prompt.rb +24 -0
- data/lib/tasks/helpers/removers.rb +33 -0
- data/lib/tasks/install.rake +0 -1
- data/lib/tasks/instrumentation_generator/README.md +63 -0
- data/lib/tasks/instrumentation_generator/TODO.md +33 -0
- data/lib/tasks/instrumentation_generator/instrumentation.thor +102 -0
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +9 -0
- data/lib/tasks/instrumentation_generator/templates/chain.tt +21 -0
- data/lib/tasks/instrumentation_generator/templates/chain_method.tt +7 -0
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +29 -0
- data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +12 -0
- data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +3 -0
- data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +19 -0
- data/lib/tasks/instrumentation_generator/templates/prepend.tt +13 -0
- data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +3 -0
- data/lib/tasks/instrumentation_generator/templates/test.tt +15 -0
- data/lib/tasks/multiverse.rake +0 -1
- data/lib/tasks/multiverse.rb +3 -29
- data/lib/tasks/newrelic.rb +0 -1
- data/lib/tasks/tests.rake +3 -8
- data/newrelic.yml +10 -1
- data/newrelic_rpm.gemspec +14 -19
- data/recipes/newrelic.rb +0 -1
- data/test/agent_helper.rb +22 -54
- metadata +50 -101
- data/bin/mongrel_rpm +0 -33
@@ -0,0 +1,21 @@
|
|
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 <%= @class_name %>
|
7
|
+
def self.instrument!
|
8
|
+
::<%= @class_name %>.class_eval do
|
9
|
+
include NewRelic::Agent::Instrumentation::<%= @class_name %>
|
10
|
+
|
11
|
+
alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)
|
12
|
+
|
13
|
+
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
14
|
+
<%= @method.downcase %>_with_tracing<%= "(#{@args})" unless @args.empty? %> do
|
15
|
+
<%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
alias_method :<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>
|
2
|
+
|
3
|
+
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
4
|
+
<%= @method.downcase %>_with_tracing<%= "(#{@args})" unless @args.empty? %> do
|
5
|
+
<%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
|
6
|
+
end
|
7
|
+
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
|
+
require_relative '<%= @name.downcase %>/instrumentation'
|
6
|
+
require_relative '<%= @name.downcase %>/chain'
|
7
|
+
require_relative '<%= @name.downcase %>/prepend'
|
8
|
+
|
9
|
+
DependencyDetection.defer do
|
10
|
+
named :<%= @name.match?(/\-|\_/) ? "'#{@name.downcase}'" : @name.downcase %>
|
11
|
+
|
12
|
+
depends_on do
|
13
|
+
# The class that needs to be defined to prepend/chain onto. This can be used
|
14
|
+
# to determine whether the library is installed.
|
15
|
+
defined?(::<%= @class_name %>)
|
16
|
+
# Add any additional requirements to verify whether this instrumentation
|
17
|
+
# should be installed
|
18
|
+
end
|
19
|
+
|
20
|
+
executes do
|
21
|
+
::NewRelic::Agent.logger.info('Installing <%= @name.downcase %> instrumentation')
|
22
|
+
|
23
|
+
if use_prepend?
|
24
|
+
prepend_instrument ::<%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
|
25
|
+
else
|
26
|
+
chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,12 @@
|
|
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 <%= @class_name %>
|
7
|
+
|
8
|
+
def <%= @method.downcase %>_with_tracing<%= "(#{@args})" unless @args.empty? %>
|
9
|
+
# add instrumentation content here
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
development:
|
3
|
+
error_collector:
|
4
|
+
enabled: true
|
5
|
+
apdex_t: 0.5
|
6
|
+
monitor_mode: true
|
7
|
+
license_key: bootstrap_newrelic_admin_license_key_000
|
8
|
+
instrumentation:
|
9
|
+
<%= @name.downcase %>: <%= @instrumentation_method_global_erb_snippet %>
|
10
|
+
app_name: test
|
11
|
+
log_level: debug
|
12
|
+
host: 127.0.0.1
|
13
|
+
api_host: 127.0.0.1
|
14
|
+
transaction_trace:
|
15
|
+
record_sql: obfuscated
|
16
|
+
enabled: true
|
17
|
+
stack_trace_threshold: 0.5
|
18
|
+
transaction_threshold: 1.0
|
19
|
+
capture_params: false
|
@@ -0,0 +1,13 @@
|
|
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 <%= @class_name %>::Prepend
|
7
|
+
include NewRelic::Agent::Instrumentation::<%= @class_name %>
|
8
|
+
|
9
|
+
def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
|
10
|
+
<%= @method.downcase %>_with_tracing<%= "(#{@args})" unless @args.empty? %> { super }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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
|
+
class <%= @class_name %>InstrumentationTest < Minitest::Test
|
6
|
+
def setup
|
7
|
+
@stats_engine = NewRelic::Agent.instance.stats_engine
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
NewRelic::Agent.instance.stats_engine.clear_stats
|
12
|
+
end
|
13
|
+
|
14
|
+
# Add tests Here
|
15
|
+
end
|
data/lib/tasks/multiverse.rake
CHANGED
data/lib/tasks/multiverse.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -36,6 +35,9 @@
|
|
36
35
|
# # Runs with a specific test seed
|
37
36
|
# bundle exec rake test:multiverse[my_gem,seed=1337]
|
38
37
|
|
38
|
+
require_relative 'helpers/removers'
|
39
|
+
include Removers
|
40
|
+
|
39
41
|
namespace :test do
|
40
42
|
desc "Run functional test suite for New Relic"
|
41
43
|
task :multiverse, [:suite, :param1, :param2, :param3, :param4] => ['multiverse:env'] do |_, args|
|
@@ -43,34 +45,6 @@ namespace :test do
|
|
43
45
|
end
|
44
46
|
|
45
47
|
namespace :multiverse do
|
46
|
-
def remove_local_multiverse_databases
|
47
|
-
list_databases_command = %(echo "show databases" | mysql -u root)
|
48
|
-
databases = `#{list_databases_command}`.chomp!.split("\n").select { |s| s =~ /multiverse/ }
|
49
|
-
databases.each do |database|
|
50
|
-
puts "Dropping #{database}"
|
51
|
-
`echo "drop database #{database}" | mysql -u root`
|
52
|
-
end
|
53
|
-
rescue => error
|
54
|
-
puts "ERROR: Cannot get MySQL databases..."
|
55
|
-
puts error.message
|
56
|
-
end
|
57
|
-
|
58
|
-
def remove_generated_gemfiles
|
59
|
-
file_path = File.expand_path("test/multiverse/suites")
|
60
|
-
Dir.glob(File.join(file_path, "**", "Gemfile*")).each do |fn|
|
61
|
-
puts "Removing #{fn.gsub(file_path, '.../suites')}"
|
62
|
-
FileUtils.rm(fn)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def remove_generated_gemfile_lockfiles
|
67
|
-
file_path = File.expand_path("test/environments")
|
68
|
-
Dir.glob(File.join(file_path, "**", "Gemfile.lock")).each do |fn|
|
69
|
-
puts "Removing #{fn.gsub(file_path, '.../environments')}"
|
70
|
-
FileUtils.rm(fn)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
48
|
task :env do
|
75
49
|
# ENV['SUITES_DIRECTORY'] = File.expand_path('../../test/multiverse/suites', __FILE__)
|
76
50
|
require File.expand_path('../../../test/multiverse/lib/multiverse', __FILE__)
|
data/lib/tasks/newrelic.rb
CHANGED
data/lib/tasks/tests.rake
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
5
4
|
|
5
|
+
require_relative 'helpers/matches'
|
6
|
+
include Matches
|
7
|
+
|
6
8
|
begin
|
7
9
|
require 'rake/testtask'
|
8
10
|
rescue LoadError
|
@@ -10,13 +12,6 @@ end
|
|
10
12
|
|
11
13
|
if defined? Rake::TestTask
|
12
14
|
namespace :test do
|
13
|
-
def look_for_seed(tasks)
|
14
|
-
matches = tasks.map { |t| /(seed=.*?)[,\]]/.match(t) }.compact
|
15
|
-
if matches.any?
|
16
|
-
matches.first[1]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
15
|
tasks = Rake.application.top_level_tasks
|
21
16
|
ENV["TESTOPTS"] ||= ""
|
22
17
|
if tasks.any? { |t| t.include?("verbose") }
|
data/newrelic.yml
CHANGED
@@ -301,6 +301,15 @@ common: &default_settings
|
|
301
301
|
# Configures the TCP/IP port for the Trace Observer Host
|
302
302
|
# infinite_tracing.trace_observer.port: 443
|
303
303
|
|
304
|
+
# Configure the compression level for data sent to the Trace Observer
|
305
|
+
# May be one of [none|low|medium|high]
|
306
|
+
# By default, compression is not used (level = none)
|
307
|
+
# infinite_tracing.compression_level: none
|
308
|
+
|
309
|
+
# If true, data sent to the Trace Observer will be batched instead of
|
310
|
+
# the default of each span being sent individually
|
311
|
+
# infinite_tracing.batching: false
|
312
|
+
|
304
313
|
# Controls auto-instrumentation of bunny at start up.
|
305
314
|
# May be one of [auto|prepend|chain|disabled].
|
306
315
|
# instrumentation.bunny: auto
|
@@ -399,7 +408,7 @@ common: &default_settings
|
|
399
408
|
# May be one of [auto|prepend|chain|disabled].
|
400
409
|
# instrumentation.typhoeus: auto
|
401
410
|
|
402
|
-
# Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an
|
411
|
+
# Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asynchronous transaction.
|
403
412
|
# May be one of [auto|prepend|chain|disabled].
|
404
413
|
# instrumentation.thread: auto
|
405
414
|
|
data/newrelic_rpm.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#-*- coding: utf-8 -*-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
lib = File.expand_path('../lib', __FILE__)
|
@@ -22,7 +21,7 @@ Gem or plugin, hosted on
|
|
22
21
|
https://github.com/newrelic/newrelic-ruby-agent/
|
23
22
|
EOS
|
24
23
|
s.email = "support@newrelic.com"
|
25
|
-
s.executables = [
|
24
|
+
s.executables = %w[newrelic_cmd newrelic nrdebug]
|
26
25
|
s.extra_rdoc_files = [
|
27
26
|
"CHANGELOG.md",
|
28
27
|
"LICENSE",
|
@@ -47,23 +46,19 @@ https://github.com/newrelic/newrelic-ruby-agent/
|
|
47
46
|
s.homepage = "https://github.com/newrelic/rpm"
|
48
47
|
s.require_paths = ["lib"]
|
49
48
|
s.summary = "New Relic Ruby Agent"
|
50
|
-
s.add_development_dependency '
|
51
|
-
s.add_development_dependency '
|
52
|
-
s.add_development_dependency '
|
53
|
-
s.add_development_dependency 'minitest', '4.7.5'
|
49
|
+
s.add_development_dependency 'bundler'
|
50
|
+
s.add_development_dependency 'feedjira', '3.2.1' unless ENV['CI'] || RUBY_VERSION < '2.5' # for Gabby
|
51
|
+
s.add_development_dependency 'httparty' unless ENV['CI'] # for perf tests and Gabby
|
52
|
+
s.add_development_dependency 'minitest', "#{RUBY_VERSION >= '2.7.0' ? '5.3.3' : '4.7.5'}"
|
54
53
|
s.add_development_dependency 'minitest-stub-const', '0.6'
|
55
|
-
s.add_development_dependency 'mocha', '~> 1.
|
54
|
+
s.add_development_dependency 'mocha', '~> 1.14.0'
|
55
|
+
s.add_development_dependency 'pry' unless ENV['CI']
|
56
|
+
s.add_development_dependency 'rake', '12.3.3'
|
57
|
+
s.add_development_dependency 'rubocop' if RUBY_VERSION > '2.5.0'
|
58
|
+
s.add_development_dependency 'rubocop-minitest' if RUBY_VERSION > '2.5.0'
|
59
|
+
s.add_development_dependency 'rubocop-performance' if RUBY_VERSION > '2.5.0'
|
60
|
+
s.add_development_dependency 'rubocop-rake' if RUBY_VERSION > '2.5.0'
|
61
|
+
s.add_development_dependency 'simplecov' if RUBY_VERSION >= '2.7.0'
|
62
|
+
s.add_development_dependency 'thor'
|
56
63
|
s.add_development_dependency 'yard'
|
57
|
-
s.add_development_dependency 'pry-nav', '~> 0.3.0'
|
58
|
-
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9'
|
59
|
-
s.add_development_dependency 'guard', '~> 2.16.0'
|
60
|
-
s.add_development_dependency 'guard-minitest', '~> 2.4.0'
|
61
|
-
s.add_development_dependency 'bundler'
|
62
|
-
s.add_development_dependency 'rubocop'
|
63
|
-
s.add_development_dependency 'rubocop-performance'
|
64
|
-
if RUBY_VERSION >= '2.7.0'
|
65
|
-
s.add_development_dependency 'simplecov'
|
66
|
-
s.add_development_dependency 'simplecov_json_formatter'
|
67
|
-
end
|
68
|
-
s.add_development_dependency 'httparty'
|
69
64
|
end
|
data/recipes/newrelic.rb
CHANGED
data/test/agent_helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
3
|
# frozen_string_literal: true
|
@@ -14,20 +13,6 @@ rescue LoadError
|
|
14
13
|
# NOP -- Net::HTTP::STATUS_CODES was introduced in Ruby 2.5
|
15
14
|
end
|
16
15
|
|
17
|
-
module MiniTest
|
18
|
-
module Assertions
|
19
|
-
# The failure message is backwards. This patch reverses the message
|
20
|
-
# Note: passing +msg+ caused two failure messages to be shown on failure
|
21
|
-
# and was more confusing than patching here.
|
22
|
-
def assert_match(matcher, obj, msg = nil)
|
23
|
-
msg = message(msg) { "Expected #{mu_pp(obj)} to match #{mu_pp(matcher)}" }
|
24
|
-
assert_respond_to matcher, :"=~"
|
25
|
-
matcher = Regexp.new(Regexp.escape(matcher)) if String === matcher
|
26
|
-
assert matcher =~ obj, msg
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
16
|
class ArrayLogDevice
|
32
17
|
def initialize(array = [])
|
33
18
|
@array = array
|
@@ -45,15 +30,8 @@ def fake_guid(length = 16)
|
|
45
30
|
NewRelic::Agent::GuidGenerator.generate_guid(length)
|
46
31
|
end
|
47
32
|
|
48
|
-
def assert_match(matcher, obj, msg = nil)
|
49
|
-
msg = message(msg) { "Expected #{mu_pp(matcher)} to match #{mu_pp(obj)}" }
|
50
|
-
assert_respond_to matcher, :"=~"
|
51
|
-
matcher = Regexp.new(Regexp.escape(matcher)) if String === matcher
|
52
|
-
assert matcher =~ obj, msg
|
53
|
-
end
|
54
|
-
|
55
33
|
def assert_between(floor, ceiling, value, message = "expected #{floor} <= #{value} <= #{ceiling}")
|
56
|
-
assert((floor <= value && value <= ceiling), message)
|
34
|
+
assert((floor <= value && value <= ceiling), message) # rubocop:disable Minitest/AssertWithExpectedArgument
|
57
35
|
end
|
58
36
|
|
59
37
|
def assert_in_delta(expected, actual, delta)
|
@@ -70,8 +48,7 @@ end
|
|
70
48
|
|
71
49
|
def assert_has_traced_error(error_class)
|
72
50
|
errors = harvest_error_traces!
|
73
|
-
|
74
|
-
errors.find { |e| e.exception_class_name == error_class.name } != nil, \
|
51
|
+
refute_nil errors.find { |e| e.exception_class_name == error_class.name }, \
|
75
52
|
"Didn't find error of class #{error_class}"
|
76
53
|
end
|
77
54
|
|
@@ -103,29 +80,23 @@ def last_error_event
|
|
103
80
|
harvest_error_events!.last.last
|
104
81
|
end
|
105
82
|
|
106
|
-
unless defined? assert_block
|
107
|
-
def assert_block(*msgs)
|
108
|
-
assert yield, *msgs
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
83
|
unless defined? assert_includes
|
113
84
|
def assert_includes(collection, member, msg = nil)
|
114
85
|
msg = "Expected #{collection.inspect} to include #{member.inspect}"
|
115
|
-
|
86
|
+
assert_includes collection, member, msg
|
116
87
|
end
|
117
88
|
end
|
118
89
|
|
119
90
|
unless defined? assert_not_includes
|
120
91
|
def assert_not_includes(collection, member, msg = nil)
|
121
92
|
msg = "Expected #{collection.inspect} not to include #{member.inspect}"
|
122
|
-
|
93
|
+
refute_includes collection, member, msg
|
123
94
|
end
|
124
95
|
end
|
125
96
|
|
126
97
|
unless defined? assert_empty
|
127
98
|
def assert_empty(collection, msg = nil)
|
128
|
-
|
99
|
+
assert_empty collection, msg
|
129
100
|
end
|
130
101
|
end
|
131
102
|
|
@@ -136,8 +107,7 @@ end
|
|
136
107
|
|
137
108
|
def assert_log_contains(log, message)
|
138
109
|
lines = log.array
|
139
|
-
|
140
|
-
assert (lines.any? { |line| line.match(message) }), failure_message
|
110
|
+
assert (lines.any? { |line| line.match(message) })
|
141
111
|
end
|
142
112
|
|
143
113
|
def assert_audit_log_contains(audit_log_contents, needle)
|
@@ -147,7 +117,7 @@ def assert_audit_log_contains(audit_log_contents, needle)
|
|
147
117
|
regex = /[:"]/
|
148
118
|
needle = needle.gsub(regex, '')
|
149
119
|
haystack = audit_log_contents.gsub(regex, '')
|
150
|
-
|
120
|
+
assert_includes(haystack, needle, "Expected log to contain '#{needle}'")
|
151
121
|
end
|
152
122
|
|
153
123
|
# Because we don't generate a strictly machine-readable representation of
|
@@ -257,7 +227,7 @@ def assert_metrics_recorded(expected)
|
|
257
227
|
msg += "\nDid find specs: [\n#{matches.join(",\n")}\n]" unless matches.empty?
|
258
228
|
msg += "\nAll specs in there were: #{format_metric_spec_list(all_specs)}"
|
259
229
|
|
260
|
-
assert(actual_stats, msg)
|
230
|
+
assert(actual_stats, msg) # rubocop:disable Minitest/AssertWithExpectedArgument
|
261
231
|
end
|
262
232
|
assert_stats_has_values(actual_stats, expected_spec, expected_attrs)
|
263
233
|
end
|
@@ -290,12 +260,12 @@ def assert_metrics_recorded_exclusive(expected, options = {})
|
|
290
260
|
expected_metrics = expected.keys.map { |s| metric_spec_from_specish(s) }
|
291
261
|
|
292
262
|
unexpected_metrics = recorded_metrics - expected_metrics
|
293
|
-
unexpected_metrics.reject! { |m| m.name
|
263
|
+
unexpected_metrics.reject! { |m| m.name.include?('GC/Transaction') }
|
294
264
|
|
295
265
|
assert_equal(0, unexpected_metrics.size, "Found unexpected metrics: #{format_metric_spec_list(unexpected_metrics)}")
|
296
266
|
end
|
297
267
|
|
298
|
-
def
|
268
|
+
def assert_newrelic_metadata_present(metadata)
|
299
269
|
assert metadata.key?('newrelic')
|
300
270
|
refute_nil metadata['newrelic']
|
301
271
|
end
|
@@ -330,7 +300,7 @@ def assert_metrics_not_recorded(not_expected)
|
|
330
300
|
found_but_not_expected << spec
|
331
301
|
end
|
332
302
|
end
|
333
|
-
|
303
|
+
assert_empty(found_but_not_expected, "Found unexpected metrics: #{format_metric_spec_list(found_but_not_expected)}")
|
334
304
|
end
|
335
305
|
|
336
306
|
alias :refute_metrics_recorded :assert_metrics_not_recorded
|
@@ -341,8 +311,7 @@ def assert_no_metrics_match(regex)
|
|
341
311
|
matching_metrics << metric if metric.match(regex)
|
342
312
|
end
|
343
313
|
|
344
|
-
|
345
|
-
[],
|
314
|
+
assert_empty(
|
346
315
|
matching_metrics,
|
347
316
|
"Found unexpected metrics:\n" + matching_metrics.map { |m| " '#{m}'" }.join("\n") + "\n\n"
|
348
317
|
)
|
@@ -359,17 +328,17 @@ end
|
|
359
328
|
|
360
329
|
def assert_truthy(expected, msg = nil)
|
361
330
|
msg ||= "Expected #{expected.inspect} to be truthy"
|
362
|
-
|
331
|
+
refute !expected, msg
|
363
332
|
end
|
364
333
|
|
365
334
|
def assert_falsy(expected, msg = nil)
|
366
335
|
msg ||= "Expected #{expected.inspect} to be falsy"
|
367
|
-
|
336
|
+
refute expected, msg
|
368
337
|
end
|
369
338
|
|
370
339
|
unless defined? assert_false
|
371
340
|
def assert_false(expected)
|
372
|
-
|
341
|
+
refute expected
|
373
342
|
end
|
374
343
|
end
|
375
344
|
|
@@ -400,8 +369,7 @@ def in_transaction(*args, &blk)
|
|
400
369
|
category = (opts && opts.delete(:category)) || :other
|
401
370
|
|
402
371
|
# At least one test passes `:transaction_name => nil`, so handle it gently
|
403
|
-
name = opts.key?(:transaction_name) ? opts.delete(:transaction_name) :
|
404
|
-
args.first || 'dummy'
|
372
|
+
name = opts.key?(:transaction_name) ? opts.delete(:transaction_name) : args.first || 'dummy'
|
405
373
|
|
406
374
|
state = NewRelic::Agent::Tracer.state
|
407
375
|
txn = nil
|
@@ -426,13 +394,13 @@ def with_disabled_defaults_transformer(key)
|
|
426
394
|
end
|
427
395
|
|
428
396
|
# Convenience wrapper to stand up a transaction and provide a segment within
|
429
|
-
# that transaction to work with. The same
|
397
|
+
# that transaction to work with. The same arguments as provided to in_transaction
|
430
398
|
# may be supplied.
|
431
399
|
def with_segment(*args, &blk)
|
432
400
|
segment = nil
|
433
|
-
txn = in_transaction(*args) do |
|
434
|
-
segment =
|
435
|
-
yield(segment,
|
401
|
+
txn = in_transaction(*args) do |t|
|
402
|
+
segment = t.current_segment
|
403
|
+
yield(segment, t)
|
436
404
|
end
|
437
405
|
[segment, txn]
|
438
406
|
end
|
@@ -885,7 +853,7 @@ def load_cross_agent_test(name)
|
|
885
853
|
data = File.read(test_file_path)
|
886
854
|
data.gsub!('callCount', 'call_count')
|
887
855
|
data = ::JSON.load(data)
|
888
|
-
data.each { |testcase| testcase['testname'].
|
856
|
+
data.each { |testcase| testcase['testname'].tr!(' ', '_') if String === testcase['testname'] }
|
889
857
|
data
|
890
858
|
end
|
891
859
|
|
@@ -916,7 +884,7 @@ def assert_event_attributes(event, test_name, expected_attributes, non_expected_
|
|
916
884
|
event_attrs.each do |name, actual_value|
|
917
885
|
msg << " #{name}: #{actual_value.inspect}\n"
|
918
886
|
end
|
919
|
-
|
887
|
+
assert_empty(incorrect_attributes, msg)
|
920
888
|
|
921
889
|
non_expected_attributes.each do |name|
|
922
890
|
refute event_attrs[name], "Found value '#{event_attrs[name]}' for attribute '#{name}', but expected nothing in #{test_name}"
|