newrelic_rpm 8.7.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 +4 -0
- data/.rubocop.yml +68 -189
- data/.rubocop_todo.yml +52 -0
- data/.simplecov +15 -0
- data/.snyk +11 -0
- data/.yardopts +1 -0
- data/Brewfile +1 -0
- data/CHANGELOG.md +181 -23
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +0 -1
- data/Guardfile +1 -0
- data/README.md +1 -1
- data/Rakefile +13 -20
- data/Thorfile +5 -0
- data/bin/newrelic +2 -1
- data/bin/newrelic_cmd +1 -0
- data/bin/nrdebug +66 -45
- data/config.dot +5 -5
- data/init.rb +4 -4
- data/install.rb +2 -2
- data/lib/new_relic/agent/adaptive_sampler.rb +4 -4
- data/lib/new_relic/agent/agent/shutdown.rb +34 -0
- data/lib/new_relic/agent/agent/special_startup.rb +70 -0
- data/lib/new_relic/agent/agent/start_worker_thread.rb +163 -0
- data/lib/new_relic/agent/agent/startup.rb +196 -0
- data/lib/new_relic/agent/agent.rb +134 -534
- data/lib/new_relic/agent/agent_logger.rb +8 -10
- data/lib/new_relic/agent/attribute_filter.rb +40 -21
- data/lib/new_relic/agent/attribute_processing.rb +7 -7
- data/lib/new_relic/agent/attributes.rb +2 -2
- data/lib/new_relic/agent/audit_logger.rb +3 -3
- data/lib/new_relic/agent/autostart.rb +2 -2
- 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 +8 -8
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +105 -41
- data/lib/new_relic/agent/configuration/dotted_hash.rb +2 -2
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -5
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +1 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -1
- data/lib/new_relic/agent/configuration/manager.rb +5 -5
- data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
- data/lib/new_relic/agent/configuration/mask_defaults.rb +3 -3
- data/lib/new_relic/agent/configuration/security_policy_source.rb +7 -4
- data/lib/new_relic/agent/configuration/server_source.rb +7 -7
- data/lib/new_relic/agent/configuration/yaml_source.rb +6 -4
- data/lib/new_relic/agent/configuration.rb +1 -1
- data/lib/new_relic/agent/connect/request_builder.rb +3 -3
- data/lib/new_relic/agent/connect/response_handler.rb +5 -5
- data/lib/new_relic/agent/custom_event_aggregator.rb +5 -5
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscator.rb +2 -2
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
- data/lib/new_relic/agent/database.rb +21 -21
- data/lib/new_relic/agent/database_adapter.rb +1 -1
- data/lib/new_relic/agent/datastores/metric_helper.rb +12 -13
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +4 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +2 -4
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +2 -2
- data/lib/new_relic/agent/datastores/mongo.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +3 -3
- data/lib/new_relic/agent/datastores.rb +4 -4
- data/lib/new_relic/agent/deprecator.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +16 -17
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +9 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +18 -19
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +8 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +2 -3
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +40 -40
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +16 -15
- data/lib/new_relic/agent/distributed_tracing.rb +17 -18
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +6 -5
- data/lib/new_relic/agent/error_event_aggregator.rb +3 -4
- data/lib/new_relic/agent/error_filter.rb +5 -5
- data/lib/new_relic/agent/error_trace_aggregator.rb +3 -3
- data/lib/new_relic/agent/event_aggregator.rb +20 -20
- 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 +9 -9
- data/lib/new_relic/agent/external.rb +10 -10
- data/lib/new_relic/agent/guid_generator.rb +2 -2
- data/lib/new_relic/agent/harvester.rb +1 -1
- data/lib/new_relic/agent/heap.rb +5 -5
- data/lib/new_relic/agent/hostname.rb +4 -3
- data/lib/new_relic/agent/http_clients/abstract.rb +1 -2
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +5 -6
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -5
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +2 -3
- 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 +1 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -5
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +31 -23
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +7 -6
- data/lib/new_relic/agent/instrumentation/active_job.rb +11 -4
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +4 -3
- data/lib/new_relic/agent/instrumentation/active_record.rb +9 -9
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +37 -21
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +21 -11
- data/lib/new_relic/agent/instrumentation/active_storage.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +16 -15
- data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +2 -2
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +2 -2
- data/lib/new_relic/agent/instrumentation/authlogic.rb +2 -2
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +10 -10
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +10 -11
- data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -2
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +25 -17
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +21 -22
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +19 -16
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +2 -3
- data/lib/new_relic/agent/instrumentation/curb.rb +2 -2
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +44 -44
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -3
- data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +1 -2
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -3
- data/lib/new_relic/agent/instrumentation/excon.rb +2 -2
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +6 -6
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/grape/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +97 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +89 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +111 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +30 -0
- data/lib/new_relic/agent/instrumentation/grpc/helper.rb +32 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/chain.rb +69 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +134 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_desc_prepend.rb +35 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_server_prepend.rb +26 -0
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +23 -0
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +25 -0
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +6 -6
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httprb.rb +2 -2
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -2
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +5 -1
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/logger.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +24 -17
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +8 -9
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +17 -15
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +21 -15
- data/lib/new_relic/agent/instrumentation/memcache.rb +5 -6
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +2 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +0 -1
- data/lib/new_relic/agent/instrumentation/mongo.rb +2 -2
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +15 -14
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +6 -6
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino.rb +2 -2
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -2
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +12 -12
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +7 -7
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -2
- data/lib/new_relic/agent/instrumentation/rake/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +3 -4
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +5 -6
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +3 -4
- data/lib/new_relic/agent/instrumentation/redis.rb +2 -2
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +3 -3
- data/lib/new_relic/agent/instrumentation/sequel.rb +8 -8
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -5
- data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sunspot.rb +4 -4
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread.rb +2 -2
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +8 -8
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
- 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 +8 -8
- data/lib/new_relic/agent/linking_metadata.rb +2 -3
- data/lib/new_relic/agent/local_log_decorator.rb +0 -1
- data/lib/new_relic/agent/log_event_aggregator.rb +7 -7
- data/lib/new_relic/agent/log_once.rb +1 -1
- data/lib/new_relic/agent/log_priority.rb +1 -1
- data/lib/new_relic/agent/logging.rb +13 -13
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +19 -20
- data/lib/new_relic/agent/method_tracer.rb +15 -10
- data/lib/new_relic/agent/method_tracer_helpers.rb +83 -1
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -4
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +3 -3
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +2 -2
- data/lib/new_relic/agent/monitors.rb +5 -5
- data/lib/new_relic/agent/new_relic_service/encoders.rb +2 -2
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +4 -4
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +1 -1
- data/lib/new_relic/agent/new_relic_service.rb +214 -166
- data/lib/new_relic/agent/{noticible_error.rb → noticeable_error.rb} +2 -3
- data/lib/new_relic/agent/null_logger.rb +1 -1
- data/lib/new_relic/agent/obfuscator.rb +3 -3
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/payload_metric_mapping.rb +1 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +10 -5
- data/lib/new_relic/agent/pipe_service.rb +2 -2
- data/lib/new_relic/agent/prepend_supportability.rb +2 -2
- data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -4
- data/lib/new_relic/agent/range_extensions.rb +8 -28
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +2 -2
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine.rb +2 -2
- 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 +2 -2
- data/lib/new_relic/agent/samplers/memory_sampler.rb +10 -10
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/vm_sampler.rb +3 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -2
- data/lib/new_relic/agent/span_event_primitive.rb +24 -19
- data/lib/new_relic/agent/sql_sampler.rb +8 -8
- data/lib/new_relic/agent/stats.rb +15 -4
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +4 -4
- data/lib/new_relic/agent/stats_engine.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +6 -6
- data/lib/new_relic/agent/system_info.rb +68 -53
- data/lib/new_relic/agent/threading/agent_thread.rb +13 -9
- data/lib/new_relic/agent/threading/backtrace_node.rb +6 -4
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
- data/lib/new_relic/agent/threading/thread_profile.rb +4 -4
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +19 -17
- data/lib/new_relic/agent/transaction/abstract_segment.rb +93 -34
- data/lib/new_relic/agent/transaction/datastore_segment.rb +12 -12
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +52 -48
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
- data/lib/new_relic/agent/transaction/external_request_segment.rb +37 -29
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +6 -6
- data/lib/new_relic/agent/transaction/request_attributes.rb +29 -29
- data/lib/new_relic/agent/transaction/segment.rb +8 -8
- 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 +3 -3
- data/lib/new_relic/agent/transaction/trace_builder.rb +10 -10
- data/lib/new_relic/agent/transaction/trace_context.rb +22 -20
- data/lib/new_relic/agent/transaction/trace_node.rb +9 -9
- data/lib/new_relic/agent/transaction/tracing.rb +7 -7
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
- data/lib/new_relic/agent/transaction.rb +35 -31
- data/lib/new_relic/agent/transaction_error_primitive.rb +9 -9
- data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -5
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -4
- data/lib/new_relic/agent/transaction_event_recorder.rb +15 -14
- data/lib/new_relic/agent/transaction_metrics.rb +4 -4
- data/lib/new_relic/agent/transaction_sampler.rb +5 -5
- data/lib/new_relic/agent/transaction_time_aggregator.rb +14 -14
- data/lib/new_relic/agent/utilization/aws.rb +4 -4
- data/lib/new_relic/agent/utilization/azure.rb +2 -2
- data/lib/new_relic/agent/utilization/gcp.rb +7 -7
- data/lib/new_relic/agent/utilization/pcf.rb +4 -4
- data/lib/new_relic/agent/utilization/vendor.rb +28 -28
- data/lib/new_relic/agent/utilization_data.rb +1 -1
- 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 +36 -23
- data/lib/new_relic/agent/vm/snapshot.rb +2 -2
- data/lib/new_relic/agent/vm.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +2 -2
- data/lib/new_relic/agent.rb +27 -27
- data/lib/new_relic/cli/command.rb +6 -6
- data/lib/new_relic/cli/commands/deployments.rb +81 -29
- data/lib/new_relic/cli/commands/install.rb +6 -6
- data/lib/new_relic/coerce.rb +5 -6
- data/lib/new_relic/collection_helper.rb +4 -4
- data/lib/new_relic/constants.rb +0 -1
- data/lib/new_relic/control/class_methods.rb +1 -1
- data/lib/new_relic/control/frameworks/external.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +3 -3
- 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/rails_notifications.rb +1 -1
- 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 +20 -42
- data/lib/new_relic/control/instrumentation.rb +7 -7
- data/lib/new_relic/control/private_instance_methods.rb +48 -0
- data/lib/new_relic/control/server_methods.rb +2 -2
- 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 +23 -22
- data/lib/new_relic/environment_report.rb +24 -14
- data/lib/new_relic/helper.rb +5 -5
- data/lib/new_relic/language_support.rb +8 -3
- data/lib/new_relic/latest_changes.rb +4 -4
- data/lib/new_relic/local_environment.rb +9 -11
- data/lib/new_relic/metric_data.rb +30 -24
- data/lib/new_relic/metric_spec.rb +3 -3
- data/lib/new_relic/noticed_error.rb +3 -6
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +1 -1
- data/lib/new_relic/rack/browser_monitoring.rb +132 -123
- data/lib/new_relic/rack.rb +1 -1
- data/lib/new_relic/recipes/capistrano3.rb +3 -59
- data/lib/new_relic/recipes/capistrano_legacy.rb +13 -13
- data/lib/new_relic/recipes/helpers/send_deployment.rb +69 -0
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/supportability_helper.rb +6 -6
- data/lib/new_relic/traced_thread.rb +5 -7
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +8 -8
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/config.rake +8 -112
- data/lib/tasks/coverage_report.rake +28 -0
- 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 +4 -0
- 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 +4 -0
- data/lib/tasks/multiverse.rb +5 -30
- data/lib/tasks/newrelic.rb +1 -1
- data/lib/tasks/tests.rake +7 -8
- data/newrelic.yml +514 -483
- data/newrelic_rpm.gemspec +16 -21
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +125 -147
- metadata +82 -90
- data/bin/mongrel_rpm +0 -32
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/heap'
|
6
6
|
require 'new_relic/agent/event_buffer'
|
@@ -34,13 +34,13 @@ module NewRelic
|
|
34
34
|
priority ||= priority_for(event)
|
35
35
|
if priority_for(@items[0]) < priority
|
36
36
|
heapify_items_array
|
37
|
-
incoming = event ||
|
37
|
+
incoming = event || yield
|
38
38
|
@items[0] = incoming
|
39
39
|
@items.fix(0)
|
40
40
|
incoming
|
41
41
|
end
|
42
42
|
else
|
43
|
-
@items << (event ||
|
43
|
+
@items << (event || yield)
|
44
44
|
@captured_lifetime += 1
|
45
45
|
@items[-1]
|
46
46
|
end
|
@@ -61,7 +61,7 @@ module NewRelic
|
|
61
61
|
@items.to_a.dup
|
62
62
|
end
|
63
63
|
|
64
|
-
def decrement_lifetime_counts_by
|
64
|
+
def decrement_lifetime_counts_by(n)
|
65
65
|
@captured_lifetime -= n
|
66
66
|
@seen_lifetime -= n
|
67
67
|
end
|
@@ -1,45 +1,25 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
7
7
|
module RangeExtensions
|
8
8
|
module_function
|
9
9
|
|
10
|
-
def intersects?
|
11
|
-
r1.
|
12
|
-
end
|
13
|
-
|
14
|
-
def merge r1, r2
|
15
|
-
return unless intersects? r1, r2
|
16
|
-
range_min = r1.begin < r2.begin ? r1.begin : r2.begin
|
17
|
-
range_max = r1.end > r2.end ? r1.end : r2.end
|
18
|
-
range_min..range_max
|
19
|
-
end
|
20
|
-
|
21
|
-
# Takes an array of ranges and a range which it will
|
22
|
-
# merge into an existing range if they intersect, otherwise
|
23
|
-
# it will append this range to the end the array.
|
24
|
-
def merge_or_append range, ranges
|
25
|
-
ranges.each_with_index do |r, i|
|
26
|
-
if merged = merge(r, range)
|
27
|
-
ranges[i] = merged
|
28
|
-
return ranges
|
29
|
-
end
|
30
|
-
end
|
31
|
-
ranges.push range
|
10
|
+
def intersects?(r1, r2)
|
11
|
+
r1.begin > r2.begin ? r2.cover?(r1.begin) : r1.cover?(r2.begin)
|
32
12
|
end
|
33
13
|
|
34
14
|
# Computes the amount of overlap between range and an array of ranges.
|
35
15
|
# For efficiency, it assumes that range intersects with each of the
|
36
16
|
# ranges in the ranges array.
|
37
|
-
def compute_overlap
|
17
|
+
def compute_overlap(range, ranges)
|
38
18
|
ranges.inject(0) do |memo, other|
|
39
|
-
next memo unless intersects?
|
40
|
-
|
41
|
-
|
42
|
-
|
19
|
+
next memo unless intersects?(range, other)
|
20
|
+
|
21
|
+
memo += (range.end < other.end ? range.end : other.end) -
|
22
|
+
(range.begin > other.begin ? range.begin : other.begin)
|
43
23
|
end
|
44
24
|
end
|
45
25
|
end
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
segment.match(@match_expression)
|
37
37
|
end
|
38
38
|
else
|
39
|
-
string.match
|
39
|
+
string.match(@match_expression)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/rules_engine/replacement_rule'
|
6
6
|
require 'new_relic/agent/rules_engine/segment_terms_rule'
|
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
# Build segment_rules in reverse order from which they're provided,
|
37
37
|
# so that when we eliminate duplicates with #uniq!, we retain the last
|
38
38
|
# instances of repeated rules.
|
39
|
-
segment_rules.unshift
|
39
|
+
segment_rules.unshift(SegmentTermsRule.new(spec))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
#
|
5
5
|
# A Sampler is used to capture meaningful metrics in a background thread
|
6
6
|
# periodically. They will be invoked about once a minute, each time the agent
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/sampler'
|
6
6
|
require 'new_relic/delayed_job_injection'
|
@@ -87,7 +87,7 @@ module NewRelic
|
|
87
87
|
all_count = 0
|
88
88
|
queue_counts(column_name).each do |column_val, count|
|
89
89
|
all_count += count
|
90
|
-
column_val = "default" if column_val.nil? || column_val ==
|
90
|
+
column_val = "default" if column_val.nil? || column_val == NewRelic::EMPTY_STR
|
91
91
|
metric = "Workers/DelayedJob/queue_length/#{metric_node}/#{column_val}"
|
92
92
|
NewRelic::Agent.record_metric(metric, count)
|
93
93
|
end
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/sampler'
|
6
6
|
require 'new_relic/helper'
|
@@ -19,21 +19,21 @@ module NewRelic
|
|
19
19
|
# macos, linux, solaris
|
20
20
|
if defined? JRuby
|
21
21
|
@sampler = JavaHeapSampler.new
|
22
|
-
elsif platform
|
22
|
+
elsif platform.include?('linux')
|
23
23
|
@sampler = ProcStatus.new
|
24
24
|
if !@sampler.can_run?
|
25
|
-
::NewRelic::Agent.logger.debug
|
25
|
+
::NewRelic::Agent.logger.debug("Error attempting to use /proc/#{$$}/status file for reading memory. Using ps command instead.")
|
26
26
|
@sampler = ShellPS.new("ps -o rsz")
|
27
27
|
else
|
28
|
-
::NewRelic::Agent.logger.debug
|
28
|
+
::NewRelic::Agent.logger.debug("Using /proc/#{$$}/status for reading process memory.")
|
29
29
|
end
|
30
|
-
elsif platform
|
30
|
+
elsif platform.include?('darwin9') # 10.5
|
31
31
|
@sampler = ShellPS.new("ps -o rsz")
|
32
32
|
elsif platform =~ /darwin(1|2)\d+/ # >= 10.6
|
33
33
|
@sampler = ShellPS.new("ps -o rss")
|
34
|
-
elsif platform
|
34
|
+
elsif platform.include?('freebsd')
|
35
35
|
@sampler = ShellPS.new("ps -o rss")
|
36
|
-
elsif platform
|
36
|
+
elsif platform.include?('solaris')
|
37
37
|
@sampler = ShellPS.new("/usr/bin/ps -o rss -p")
|
38
38
|
end
|
39
39
|
|
@@ -46,7 +46,7 @@ module NewRelic
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.platform
|
49
|
-
if RUBY_PLATFORM
|
49
|
+
if RUBY_PLATFORM.include?('java')
|
50
50
|
begin
|
51
51
|
NewRelic::Helper.run_command('uname -s').downcase
|
52
52
|
rescue NewRelic::CommandRunFailedError, NewRelic::CommandExecutableNotFoundError
|
@@ -84,12 +84,12 @@ module NewRelic
|
|
84
84
|
begin
|
85
85
|
m = get_memory
|
86
86
|
if m.nil?
|
87
|
-
::NewRelic::Agent.logger.warn
|
87
|
+
::NewRelic::Agent.logger.warn("Unable to get the resident memory for process #{$$}. Disabling memory sampler.")
|
88
88
|
@broken = true
|
89
89
|
end
|
90
90
|
return m
|
91
91
|
rescue => e
|
92
|
-
::NewRelic::Agent.logger.warn
|
92
|
+
::NewRelic::Agent.logger.warn("Unable to get the resident memory for process #{$$}. Disabling memory sampler.", e)
|
93
93
|
@broken = true
|
94
94
|
return nil
|
95
95
|
end
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/sampler'
|
6
6
|
require 'new_relic/agent/vm'
|
@@ -18,6 +18,7 @@ module NewRelic
|
|
18
18
|
MINOR_GC_METRIC = 'RubyVM/GC/minor_gc_count'.freeze
|
19
19
|
METHOD_INVALIDATIONS_METRIC = 'RubyVM/CacheInvalidations/method'.freeze
|
20
20
|
CONSTANT_INVALIDATIONS_METRIC = 'RubyVM/CacheInvalidations/constant'.freeze
|
21
|
+
CONSTANT_MISSES_METRIC = 'RubyVM/CacheMisses/constant'.freeze
|
21
22
|
|
22
23
|
attr_reader :transaction_count
|
23
24
|
|
@@ -114,6 +115,7 @@ module NewRelic
|
|
114
115
|
record_delta(snap, :minor_gc_count, MINOR_GC_METRIC, tcount)
|
115
116
|
record_delta(snap, :method_cache_invalidations, METHOD_INVALIDATIONS_METRIC, tcount)
|
116
117
|
record_delta(snap, :constant_cache_invalidations, CONSTANT_INVALIDATIONS_METRIC, tcount)
|
118
|
+
record_delta(snap, :constant_cache_misses, CONSTANT_MISSES_METRIC, tcount)
|
117
119
|
record_heap_live_metric(snap)
|
118
120
|
record_heap_free_metric(snap)
|
119
121
|
record_thread_count_metric(snap)
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'newrelic_rpm' unless defined?(NewRelic)
|
6
6
|
require 'new_relic/agent' unless defined?(NewRelic::Agent)
|
@@ -24,7 +24,7 @@ module NewRelic
|
|
24
24
|
return unless enabled?
|
25
25
|
|
26
26
|
@lock.synchronize do
|
27
|
-
@buffer.append
|
27
|
+
@buffer.append(priority: priority, event: event, &blk)
|
28
28
|
notify_if_full
|
29
29
|
end
|
30
30
|
end
|
@@ -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
|
@@ -21,7 +20,6 @@ module NewRelic
|
|
21
20
|
TRACE_ID_KEY = 'traceId'
|
22
21
|
GUID_KEY = 'guid'
|
23
22
|
PARENT_ID_KEY = 'parentId'
|
24
|
-
GRANDPARENT_ID_KEY = 'grandparentId'
|
25
23
|
TRANSACTION_ID_KEY = 'transactionId'
|
26
24
|
SAMPLED_KEY = 'sampled'
|
27
25
|
PRIORITY_KEY = 'priority'
|
@@ -52,20 +50,20 @@ module NewRelic
|
|
52
50
|
|
53
51
|
# Builds a Hash of error attributes as well as the Span ID when
|
54
52
|
# an error is present. Otherwise, returns nil when no error present.
|
55
|
-
def error_attributes
|
53
|
+
def error_attributes(segment)
|
56
54
|
return if Agent.config[:high_security] || !segment.noticed_error
|
57
55
|
segment.noticed_error.build_error_attributes
|
58
56
|
segment.noticed_error_attributes
|
59
57
|
end
|
60
58
|
|
61
|
-
def for_segment
|
59
|
+
def for_segment(segment)
|
62
60
|
intrinsics = intrinsics_for(segment)
|
63
61
|
intrinsics[CATEGORY_KEY] = GENERIC_CATEGORY
|
64
62
|
|
65
63
|
[intrinsics, custom_attributes(segment), agent_attributes(segment)]
|
66
64
|
end
|
67
65
|
|
68
|
-
def for_external_request_segment
|
66
|
+
def for_external_request_segment(segment)
|
69
67
|
intrinsics = intrinsics_for(segment)
|
70
68
|
|
71
69
|
intrinsics[COMPONENT_KEY] = segment.library
|
@@ -80,10 +78,14 @@ module NewRelic
|
|
80
78
|
agent_attributes[HTTP_URL_KEY] = truncate(segment.uri)
|
81
79
|
end
|
82
80
|
|
81
|
+
if segment.respond_to?(:record_agent_attributes?) && segment.record_agent_attributes?
|
82
|
+
agent_attributes.merge!(agent_attributes(segment))
|
83
|
+
end
|
84
|
+
|
83
85
|
[intrinsics, custom_attributes(segment), agent_attributes]
|
84
86
|
end
|
85
87
|
|
86
|
-
def for_datastore_segment
|
88
|
+
def for_datastore_segment(segment)
|
87
89
|
intrinsics = intrinsics_for(segment)
|
88
90
|
|
89
91
|
intrinsics[COMPONENT_KEY] = segment.product
|
@@ -113,7 +115,7 @@ module NewRelic
|
|
113
115
|
|
114
116
|
private
|
115
117
|
|
116
|
-
def intrinsics_for
|
118
|
+
def intrinsics_for(segment)
|
117
119
|
intrinsics = {
|
118
120
|
TYPE_KEY => EVENT_TYPE,
|
119
121
|
TRACE_ID_KEY => segment.transaction.trace_id,
|
@@ -155,7 +157,7 @@ module NewRelic
|
|
155
157
|
intrinsics
|
156
158
|
end
|
157
159
|
|
158
|
-
def custom_attributes
|
160
|
+
def custom_attributes(segment)
|
159
161
|
attributes = segment.attributes
|
160
162
|
if attributes
|
161
163
|
result = attributes.custom_attributes_for(NewRelic::Agent::AttributeFilter::DST_SPAN_EVENTS)
|
@@ -165,21 +167,24 @@ module NewRelic
|
|
165
167
|
end
|
166
168
|
end
|
167
169
|
|
168
|
-
def
|
169
|
-
return
|
170
|
-
return
|
171
|
-
|
170
|
+
def merge_hashes(hash1, hash2)
|
171
|
+
return hash1 if hash2.nil? || hash2.empty?
|
172
|
+
return hash2 if hash1.nil? || hash1.empty?
|
173
|
+
|
174
|
+
hash1.merge!(hash2)
|
172
175
|
end
|
173
176
|
|
174
|
-
def agent_attributes
|
177
|
+
def agent_attributes(segment)
|
175
178
|
agent_attributes = segment.attributes
|
176
179
|
.agent_attributes_for(NewRelic::Agent::AttributeFilter::DST_SPAN_EVENTS)
|
177
180
|
error_attributes = error_attributes(segment)
|
178
|
-
|
179
|
-
|
181
|
+
code_attributes = segment.code_attributes
|
182
|
+
agent_attributes = merge_hashes(agent_attributes, error_attributes)
|
183
|
+
agent_attributes = merge_hashes(agent_attributes, code_attributes)
|
184
|
+
agent_attributes.freeze
|
180
185
|
end
|
181
186
|
|
182
|
-
def parent_guid
|
187
|
+
def parent_guid(segment)
|
183
188
|
if segment.parent
|
184
189
|
segment.parent.guid
|
185
190
|
elsif txn = segment.transaction
|
@@ -187,11 +192,11 @@ module NewRelic
|
|
187
192
|
end
|
188
193
|
end
|
189
194
|
|
190
|
-
def milliseconds_since_epoch
|
195
|
+
def milliseconds_since_epoch(segment)
|
191
196
|
Integer(segment.start_time.to_f * 1000.0)
|
192
197
|
end
|
193
198
|
|
194
|
-
def truncate
|
199
|
+
def truncate(value, max_size = 255)
|
195
200
|
value = value.to_s
|
196
201
|
if value.bytesize > max_size
|
197
202
|
value.byteslice(0, max_size - 2).chop! << ELLIPSIS
|
@@ -200,7 +205,7 @@ module NewRelic
|
|
200
205
|
end
|
201
206
|
end
|
202
207
|
|
203
|
-
def allowed?
|
208
|
+
def allowed?(key)
|
204
209
|
NewRelic::Agent.instance.attribute_filter.allows_key?(key, AttributeFilter::DST_SPAN_EVENTS)
|
205
210
|
end
|
206
211
|
end
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'zlib'
|
6
6
|
require 'base64'
|
@@ -74,8 +74,8 @@ module NewRelic
|
|
74
74
|
data.set_transaction_name(name)
|
75
75
|
if data.sql_data.size > 0
|
76
76
|
@samples_lock.synchronize do
|
77
|
-
::NewRelic::Agent.logger.debug
|
78
|
-
save_slow_sql
|
77
|
+
::NewRelic::Agent.logger.debug("Examining #{data.sql_data.size} slow transaction sql statement(s)")
|
78
|
+
save_slow_sql(data)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -162,7 +162,7 @@ module NewRelic
|
|
162
162
|
if transaction && transaction.distributed_tracer.distributed_trace_payload
|
163
163
|
params = {}
|
164
164
|
payload = transaction.distributed_tracer.distributed_trace_payload
|
165
|
-
DistributedTraceAttributes.copy_from_transaction
|
165
|
+
DistributedTraceAttributes.copy_from_transaction(transaction, payload, params)
|
166
166
|
params[PRIORITY] = transaction.priority
|
167
167
|
end
|
168
168
|
params
|
@@ -176,7 +176,7 @@ module NewRelic
|
|
176
176
|
if state.is_sql_recorded?
|
177
177
|
if duration > Agent.config[:'slow_sql.explain_threshold']
|
178
178
|
backtrace = caller.join("\n")
|
179
|
-
params = distributed_trace_attributes
|
179
|
+
params = distributed_trace_attributes(state)
|
180
180
|
data.sql_data << SlowSql.new(statement, metric_name, duration, backtrace, params)
|
181
181
|
end
|
182
182
|
end
|
@@ -196,7 +196,7 @@ module NewRelic
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def harvest!
|
199
|
-
return
|
199
|
+
return NewRelic::EMPTY_ARRAY unless enabled?
|
200
200
|
|
201
201
|
slowest = []
|
202
202
|
@samples_lock.synchronize do
|
@@ -300,7 +300,7 @@ module NewRelic
|
|
300
300
|
super()
|
301
301
|
@params = slow_sql.base_params
|
302
302
|
@sql_id = consistent_hash(normalized_query)
|
303
|
-
set_primary
|
303
|
+
set_primary(slow_sql, path, uri)
|
304
304
|
record_data_point(float(slow_sql.duration))
|
305
305
|
end
|
306
306
|
|
@@ -315,7 +315,7 @@ module NewRelic
|
|
315
315
|
|
316
316
|
def aggregate(slow_sql, path, uri)
|
317
317
|
if slow_sql.duration > max_call_time
|
318
|
-
set_primary
|
318
|
+
set_primary(slow_sql, path, uri)
|
319
319
|
end
|
320
320
|
|
321
321
|
record_data_point(float(slow_sql.duration))
|
@@ -1,6 +1,7 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
4
5
|
module NewRelic
|
5
6
|
module Agent
|
6
7
|
class Stats
|
@@ -48,8 +49,14 @@ module NewRelic
|
|
48
49
|
self
|
49
50
|
end
|
50
51
|
|
51
|
-
def
|
52
|
-
|
52
|
+
def hash_merge(hash)
|
53
|
+
@call_count = hash[:count] if hash[:count]
|
54
|
+
@total_call_time = hash[:total] if hash[:total]
|
55
|
+
@total_exclusive_time = hash[:total] if hash[:total]
|
56
|
+
@min_call_time = hash[:min] if hash[:min]
|
57
|
+
@max_call_time = hash[:max] if hash[:max]
|
58
|
+
@sum_of_squares = hash[:sum_of_squares] if hash[:sum_of_squares]
|
59
|
+
self
|
53
60
|
end
|
54
61
|
|
55
62
|
def to_json(*_)
|
@@ -63,9 +70,13 @@ module NewRelic
|
|
63
70
|
}.to_json(*_)
|
64
71
|
end
|
65
72
|
|
73
|
+
def to_s
|
74
|
+
"[#{'%2i' % call_count.to_i} calls #{'%.4f' % total_call_time.to_f}s / #{'%.4f' % total_exclusive_time.to_f}s ex]"
|
75
|
+
end
|
76
|
+
|
66
77
|
def record(value = nil, aux = nil, &blk)
|
67
78
|
if blk
|
68
|
-
yield
|
79
|
+
yield(self)
|
69
80
|
else
|
70
81
|
case value
|
71
82
|
when Numeric
|
@@ -1,8 +1,7 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
|
-
# -*- coding: utf-8 -*-
|
6
5
|
module NewRelic
|
7
6
|
module Agent
|
8
7
|
class StatsEngine
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
# A Hash-like class for storing metric data.
|
6
6
|
#
|
@@ -76,11 +76,11 @@ module NewRelic
|
|
76
76
|
|
77
77
|
def each
|
78
78
|
@scoped.each do |k, v|
|
79
|
-
yield
|
79
|
+
yield(k, v)
|
80
80
|
end
|
81
81
|
@unscoped.each do |k, v|
|
82
82
|
spec = NewRelic::MetricSpec.new(k)
|
83
|
-
yield
|
83
|
+
yield(spec, v)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -127,7 +127,7 @@ module NewRelic
|
|
127
127
|
hash[key] = stats
|
128
128
|
# Try to restore the default_proc so we won't continually trip the error
|
129
129
|
if hash.respond_to?(:default_proc=)
|
130
|
-
hash.default_proc =
|
130
|
+
hash.default_proc = proc { |h, k| h[k] = NewRelic::Agent::Stats.new }
|
131
131
|
end
|
132
132
|
stats
|
133
133
|
end
|
@@ -1,6 +1,6 @@
|
|
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.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/stats_engine/gc_profiler'
|
6
6
|
require 'new_relic/agent/stats_engine/stats_hash'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
# encoding: utf-8
|
3
2
|
# This file is distributed under New Relic's license terms.
|
4
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
5
5
|
|
6
6
|
require 'new_relic/agent/event_aggregator'
|
7
7
|
require 'new_relic/agent/timestamp_sampled_buffer'
|
@@ -16,21 +16,21 @@ module NewRelic
|
|
16
16
|
enabled_key :'transaction_events.enabled'
|
17
17
|
buffer_class TimestampSampledBuffer
|
18
18
|
|
19
|
-
def record
|
19
|
+
def record(event)
|
20
20
|
return unless enabled?
|
21
21
|
|
22
22
|
@lock.synchronize do
|
23
|
-
@buffer.append
|
23
|
+
@buffer.append(event: event, priority: -event[0][TIMESTAMP])
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def after_harvest
|
30
|
-
record_dropped_synthetics
|
29
|
+
def after_harvest(metadata)
|
30
|
+
record_dropped_synthetics(metadata)
|
31
31
|
end
|
32
32
|
|
33
|
-
def record_dropped_synthetics
|
33
|
+
def record_dropped_synthetics(metadata)
|
34
34
|
num_dropped = metadata[:seen] - metadata[:captured]
|
35
35
|
return unless num_dropped > 0
|
36
36
|
|