newrelic_rpm 8.9.0 → 8.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -6
- data/.simplecov +1 -0
- data/.snyk +11 -0
- data/Brewfile +1 -0
- data/CHANGELOG.md +56 -0
- data/Guardfile +1 -0
- data/Rakefile +5 -0
- data/bin/mongrel_rpm +7 -6
- data/bin/newrelic +2 -1
- data/bin/newrelic_cmd +1 -0
- data/bin/nrdebug +3 -2
- data/init.rb +3 -2
- data/install.rb +1 -0
- data/lib/new_relic/agent/adaptive_sampler.rb +4 -3
- data/lib/new_relic/agent/agent/shutdown.rb +3 -2
- data/lib/new_relic/agent/agent/special_startup.rb +3 -2
- data/lib/new_relic/agent/agent/start_worker_thread.rb +15 -14
- data/lib/new_relic/agent/agent/startup.rb +11 -10
- data/lib/new_relic/agent/agent.rb +35 -33
- data/lib/new_relic/agent/agent_logger.rb +2 -1
- data/lib/new_relic/agent/attribute_filter.rb +1 -0
- data/lib/new_relic/agent/attribute_processing.rb +4 -3
- data/lib/new_relic/agent/attributes.rb +2 -1
- data/lib/new_relic/agent/audit_logger.rb +1 -0
- data/lib/new_relic/agent/autostart.rb +1 -0
- data/lib/new_relic/agent/chained_call.rb +1 -0
- data/lib/new_relic/agent/commands/agent_command.rb +1 -0
- data/lib/new_relic/agent/commands/agent_command_router.rb +4 -3
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -0
- data/lib/new_relic/agent/configuration/default_source.rb +35 -7
- data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +2 -1
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +1 -0
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
- data/lib/new_relic/agent/configuration/manager.rb +2 -1
- data/lib/new_relic/agent/configuration/manual_source.rb +1 -0
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -0
- data/lib/new_relic/agent/configuration/security_policy_source.rb +7 -3
- data/lib/new_relic/agent/configuration/server_source.rb +7 -6
- data/lib/new_relic/agent/configuration/yaml_source.rb +4 -1
- data/lib/new_relic/agent/configuration.rb +1 -0
- data/lib/new_relic/agent/connect/request_builder.rb +1 -0
- data/lib/new_relic/agent/connect/response_handler.rb +4 -3
- data/lib/new_relic/agent/custom_event_aggregator.rb +5 -4
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -0
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +1 -0
- data/lib/new_relic/agent/database/obfuscator.rb +2 -1
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -0
- data/lib/new_relic/agent/database.rb +3 -2
- data/lib/new_relic/agent/database_adapter.rb +1 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +9 -8
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -0
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -0
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +2 -1
- data/lib/new_relic/agent/datastores/mongo.rb +1 -0
- data/lib/new_relic/agent/datastores/redis.rb +3 -2
- data/lib/new_relic/agent/datastores.rb +4 -3
- data/lib/new_relic/agent/deprecator.rb +1 -0
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +1 -0
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +16 -16
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +9 -9
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +18 -18
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +8 -8
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +2 -2
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +40 -39
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +16 -14
- data/lib/new_relic/agent/distributed_tracing.rb +17 -17
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -0
- data/lib/new_relic/agent/error_collector.rb +6 -4
- data/lib/new_relic/agent/error_event_aggregator.rb +3 -3
- data/lib/new_relic/agent/error_filter.rb +1 -0
- data/lib/new_relic/agent/error_trace_aggregator.rb +2 -1
- data/lib/new_relic/agent/event_aggregator.rb +20 -19
- data/lib/new_relic/agent/event_buffer.rb +1 -0
- data/lib/new_relic/agent/event_listener.rb +1 -0
- data/lib/new_relic/agent/event_loop.rb +7 -6
- data/lib/new_relic/agent/external.rb +9 -8
- data/lib/new_relic/agent/guid_generator.rb +2 -1
- data/lib/new_relic/agent/harvester.rb +1 -0
- data/lib/new_relic/agent/heap.rb +3 -2
- data/lib/new_relic/agent/hostname.rb +4 -2
- data/lib/new_relic/agent/http_clients/abstract.rb +1 -1
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +5 -5
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -1
- data/lib/new_relic/agent/http_clients/uri_util.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -4
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +2 -0
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +6 -4
- data/lib/new_relic/agent/instrumentation/active_job.rb +2 -1
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +9 -8
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +15 -14
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -2
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -3
- data/lib/new_relic/agent/instrumentation/active_storage.rb +2 -1
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +16 -14
- data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +2 -1
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +2 -1
- data/lib/new_relic/agent/instrumentation/authlogic.rb +2 -1
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +10 -9
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +10 -10
- data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +4 -3
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +13 -9
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +21 -21
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +8 -8
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/curb.rb +2 -1
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +43 -42
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +2 -1
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +6 -5
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +5 -4
- data/lib/new_relic/agent/instrumentation/grape/prepend.rb +4 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +106 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +88 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +117 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +31 -0
- data/lib/new_relic/agent/instrumentation/grpc/helper.rb +31 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/chain.rb +70 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +135 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_desc_prepend.rb +36 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_server_prepend.rb +27 -0
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +24 -0
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +26 -0
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +6 -5
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -1
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -3
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/httprb.rb +2 -1
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -1
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +2 -1
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +5 -0
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +2 -1
- data/lib/new_relic/agent/instrumentation/memcache/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +19 -19
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +8 -8
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +17 -14
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +14 -14
- data/lib/new_relic/agent/instrumentation/memcache.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -0
- data/lib/new_relic/agent/instrumentation/mongo.rb +2 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +14 -12
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -4
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +5 -4
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +2 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -0
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +12 -11
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +1 -0
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +7 -6
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +4 -3
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -5
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -0
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +3 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +3 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +3 -1
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +2 -1
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/rake.rb +3 -2
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis.rb +2 -1
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -1
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -0
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +3 -2
- data/lib/new_relic/agent/instrumentation/sequel.rb +8 -7
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -0
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -4
- data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +2 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +2 -1
- data/lib/new_relic/agent/instrumentation/sunspot.rb +2 -1
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +2 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/thread.rb +2 -1
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/tilt.rb +1 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +6 -5
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -1
- data/lib/new_relic/agent/instrumentation.rb +1 -0
- data/lib/new_relic/agent/internal_agent_error.rb +1 -0
- data/lib/new_relic/agent/javascript_instrumentor.rb +7 -6
- data/lib/new_relic/agent/linking_metadata.rb +2 -2
- data/lib/new_relic/agent/log_event_aggregator.rb +6 -5
- data/lib/new_relic/agent/log_once.rb +1 -0
- data/lib/new_relic/agent/log_priority.rb +1 -0
- data/lib/new_relic/agent/logging.rb +13 -12
- data/lib/new_relic/agent/memory_logger.rb +1 -0
- data/lib/new_relic/agent/messaging.rb +18 -18
- data/lib/new_relic/agent/method_tracer.rb +6 -5
- data/lib/new_relic/agent/method_tracer_helpers.rb +8 -5
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +3 -2
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +3 -2
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -0
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +2 -1
- data/lib/new_relic/agent/monitors.rb +5 -4
- data/lib/new_relic/agent/new_relic_service/encoders.rb +2 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +4 -3
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -0
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +1 -0
- data/lib/new_relic/agent/new_relic_service.rb +11 -11
- data/lib/new_relic/agent/noticible_error.rb +1 -1
- data/lib/new_relic/agent/null_logger.rb +1 -0
- data/lib/new_relic/agent/obfuscator.rb +2 -1
- data/lib/new_relic/agent/parameter_filtering.rb +1 -0
- data/lib/new_relic/agent/payload_metric_mapping.rb +1 -0
- data/lib/new_relic/agent/pipe_channel_manager.rb +6 -5
- data/lib/new_relic/agent/pipe_service.rb +1 -0
- data/lib/new_relic/agent/prepend_supportability.rb +2 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +2 -1
- data/lib/new_relic/agent/range_extensions.rb +8 -27
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +2 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -0
- data/lib/new_relic/agent/rules_engine.rb +2 -1
- data/lib/new_relic/agent/sampler.rb +1 -0
- data/lib/new_relic/agent/sampler_collection.rb +1 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -0
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +5 -4
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -0
- data/lib/new_relic/agent/samplers/vm_sampler.rb +1 -0
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -1
- data/lib/new_relic/agent/span_event_primitive.rb +15 -11
- data/lib/new_relic/agent/sql_sampler.rb +7 -6
- data/lib/new_relic/agent/stats.rb +3 -1
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -0
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +3 -2
- data/lib/new_relic/agent/stats_engine.rb +1 -0
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +6 -5
- data/lib/new_relic/agent/system_info.rb +8 -7
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -0
- data/lib/new_relic/agent/threading/backtrace_node.rb +6 -3
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -0
- data/lib/new_relic/agent/threading/thread_profile.rb +1 -0
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -0
- data/lib/new_relic/agent/tracer.rb +12 -11
- data/lib/new_relic/agent/transaction/abstract_segment.rb +64 -31
- data/lib/new_relic/agent/transaction/datastore_segment.rb +12 -11
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +52 -47
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -21
- data/lib/new_relic/agent/transaction/external_request_segment.rb +36 -27
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +6 -5
- data/lib/new_relic/agent/transaction/request_attributes.rb +29 -28
- data/lib/new_relic/agent/transaction/segment.rb +8 -7
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -0
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -0
- data/lib/new_relic/agent/transaction/trace.rb +3 -2
- data/lib/new_relic/agent/transaction/trace_builder.rb +10 -9
- data/lib/new_relic/agent/transaction/trace_context.rb +22 -19
- data/lib/new_relic/agent/transaction/trace_node.rb +9 -8
- data/lib/new_relic/agent/transaction/tracing.rb +7 -6
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -0
- data/lib/new_relic/agent/transaction.rb +22 -21
- data/lib/new_relic/agent/transaction_error_primitive.rb +9 -8
- data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -4
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -3
- data/lib/new_relic/agent/transaction_event_recorder.rb +14 -12
- data/lib/new_relic/agent/transaction_metrics.rb +3 -2
- data/lib/new_relic/agent/transaction_sampler.rb +4 -3
- data/lib/new_relic/agent/transaction_time_aggregator.rb +13 -12
- data/lib/new_relic/agent/utilization/aws.rb +4 -3
- data/lib/new_relic/agent/utilization/azure.rb +1 -0
- data/lib/new_relic/agent/utilization/gcp.rb +6 -5
- data/lib/new_relic/agent/utilization/pcf.rb +3 -2
- data/lib/new_relic/agent/utilization/vendor.rb +27 -26
- data/lib/new_relic/agent/utilization_data.rb +1 -0
- data/lib/new_relic/agent/vm/jruby_vm.rb +1 -0
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -0
- data/lib/new_relic/agent/vm/mri_vm.rb +1 -0
- data/lib/new_relic/agent/vm/snapshot.rb +1 -0
- data/lib/new_relic/agent/vm.rb +1 -0
- data/lib/new_relic/agent/worker_loop.rb +2 -1
- data/lib/new_relic/agent.rb +11 -10
- data/lib/new_relic/cli/command.rb +5 -4
- data/lib/new_relic/cli/commands/deployments.rb +9 -8
- data/lib/new_relic/cli/commands/install.rb +6 -5
- data/lib/new_relic/coerce.rb +4 -4
- data/lib/new_relic/collection_helper.rb +2 -1
- data/lib/new_relic/control/class_methods.rb +1 -0
- data/lib/new_relic/control/frameworks/external.rb +1 -0
- data/lib/new_relic/control/frameworks/rails.rb +3 -2
- data/lib/new_relic/control/frameworks/rails3.rb +1 -0
- data/lib/new_relic/control/frameworks/rails4.rb +1 -0
- data/lib/new_relic/control/frameworks/rails_notifications.rb +1 -0
- data/lib/new_relic/control/frameworks/ruby.rb +1 -0
- data/lib/new_relic/control/frameworks/sinatra.rb +1 -0
- data/lib/new_relic/control/frameworks.rb +1 -0
- data/lib/new_relic/control/instance_methods.rb +5 -4
- data/lib/new_relic/control/instrumentation.rb +7 -6
- data/lib/new_relic/control/server_methods.rb +2 -1
- data/lib/new_relic/control.rb +1 -0
- data/lib/new_relic/delayed_job_injection.rb +1 -0
- data/lib/new_relic/dependency_detection.rb +18 -16
- data/lib/new_relic/environment_report.rb +1 -0
- data/lib/new_relic/helper.rb +4 -3
- data/lib/new_relic/language_support.rb +1 -0
- data/lib/new_relic/latest_changes.rb +1 -0
- data/lib/new_relic/local_environment.rb +5 -6
- data/lib/new_relic/metric_data.rb +3 -2
- data/lib/new_relic/metric_spec.rb +2 -1
- data/lib/new_relic/noticed_error.rb +1 -1
- data/lib/new_relic/rack/agent_hooks.rb +1 -0
- data/lib/new_relic/rack/agent_middleware.rb +1 -0
- data/lib/new_relic/rack/browser_monitoring.rb +3 -2
- data/lib/new_relic/rack.rb +1 -0
- data/lib/new_relic/recipes/capistrano3.rb +7 -6
- data/lib/new_relic/recipes/capistrano_legacy.rb +12 -11
- data/lib/new_relic/recipes.rb +1 -0
- data/lib/new_relic/supportability_helper.rb +5 -4
- data/lib/new_relic/version.rb +2 -1
- data/lib/newrelic_rpm.rb +1 -0
- data/lib/sequel/extensions/newrelic_instrumentation.rb +6 -5
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -0
- data/lib/tasks/all.rb +1 -0
- data/lib/tasks/config.rake +2 -1
- data/lib/tasks/coverage_report.rake +2 -1
- data/lib/tasks/install.rake +1 -0
- data/lib/tasks/multiverse.rake +1 -0
- data/lib/tasks/multiverse.rb +8 -7
- data/lib/tasks/newrelic.rb +1 -0
- data/lib/tasks/tests.rake +1 -0
- data/newrelic.yml +505 -486
- data/newrelic_rpm.gemspec +3 -1
- data/recipes/newrelic.rb +1 -0
- data/test/agent_helper.rb +113 -103
- metadata +28 -2
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
module NewRelic
|
6
7
|
module Agent
|
@@ -37,16 +38,16 @@ module NewRelic
|
|
37
38
|
|
38
39
|
def add_server_side_config(config_data)
|
39
40
|
if config_data['agent_config']
|
40
|
-
::NewRelic::Agent.logger.debug
|
41
|
+
::NewRelic::Agent.logger.debug("Using config from server")
|
41
42
|
end
|
42
43
|
|
43
|
-
::NewRelic::Agent.logger.debug
|
44
|
+
::NewRelic::Agent.logger.debug("Server provided config: #{config_data.inspect}")
|
44
45
|
server_config = NewRelic::Agent::Configuration::ServerSource.new(config_data, @config)
|
45
46
|
@config.replace_or_add_config(server_config)
|
46
47
|
end
|
47
48
|
|
48
49
|
def add_security_policy_config(security_policies)
|
49
|
-
::NewRelic::Agent.logger.info
|
50
|
+
::NewRelic::Agent.logger.info('Installing security policies')
|
50
51
|
security_policy_source = NewRelic::Agent::Configuration::SecurityPolicySource.new(security_policies)
|
51
52
|
@config.replace_or_add_config(security_policy_source)
|
52
53
|
# drop data collected before applying security policies
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'new_relic/agent/event_aggregator'
|
6
7
|
require 'new_relic/agent/attribute_processing'
|
@@ -20,7 +21,7 @@ module NewRelic
|
|
20
21
|
enabled_key :'custom_insights_events.enabled'
|
21
22
|
|
22
23
|
def record(type, attributes)
|
23
|
-
unless attributes.is_a?
|
24
|
+
unless attributes.is_a?(Hash)
|
24
25
|
raise ArgumentError, "Expected Hash but got #{attributes.class}"
|
25
26
|
end
|
26
27
|
|
@@ -57,19 +58,19 @@ module NewRelic
|
|
57
58
|
@type_strings = Hash.new { |hash, key| hash[key] = key.to_s.freeze }
|
58
59
|
end
|
59
60
|
|
60
|
-
def after_harvest
|
61
|
+
def after_harvest(metadata)
|
61
62
|
dropped_count = metadata[:seen] - metadata[:captured]
|
62
63
|
note_dropped_events(metadata[:seen], dropped_count)
|
63
64
|
record_supportability_metrics(metadata[:seen], metadata[:captured], dropped_count)
|
64
65
|
end
|
65
66
|
|
66
|
-
def note_dropped_events
|
67
|
+
def note_dropped_events(total_count, dropped_count)
|
67
68
|
if dropped_count > 0
|
68
69
|
NewRelic::Agent.logger.warn("Dropped #{dropped_count} custom events out of #{total_count}.")
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
|
-
def record_supportability_metrics
|
73
|
+
def record_supportability_metrics(total_count, captured_count, dropped_count)
|
73
74
|
engine = NewRelic::Agent.instance.stats_engine
|
74
75
|
engine.tl_record_supportability_metric_count("Events/Customer/Seen", total_count)
|
75
76
|
engine.tl_record_supportability_metric_count("Events/Customer/Sent", captured_count)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'new_relic/agent/database/obfuscator'
|
6
7
|
require 'new_relic/agent/database/postgres_explain_obfuscator'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'new_relic/agent/database/obfuscation_helpers'
|
6
7
|
|
@@ -50,7 +51,7 @@ module NewRelic
|
|
50
51
|
def default_sql_obfuscator(sql)
|
51
52
|
stmt = sql.kind_of?(Statement) ? sql : Statement.new(sql)
|
52
53
|
|
53
|
-
if stmt.sql.end_with?
|
54
|
+
if stmt.sql.end_with?(ELLIPSIS)
|
54
55
|
return QUERY_TOO_LARGE_MESSAGE
|
55
56
|
end
|
56
57
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'singleton'
|
6
7
|
require 'new_relic/agent/database/explain_plan_helpers'
|
@@ -236,7 +237,7 @@ module NewRelic
|
|
236
237
|
|
237
238
|
NEWLINE = "\n".freeze
|
238
239
|
|
239
|
-
def append_sql
|
240
|
+
def append_sql(new_sql)
|
240
241
|
return if new_sql.empty?
|
241
242
|
@sql = Database.truncate_query(@sql << NEWLINE << new_sql)
|
242
243
|
end
|
@@ -258,7 +259,7 @@ module NewRelic
|
|
258
259
|
# between usage of mysql and mysql2. Obfuscation is the same, though.
|
259
260
|
elsif adapter == MYSQL2_PREFIX
|
260
261
|
:mysql2
|
261
|
-
elsif adapter.start_with?
|
262
|
+
elsif adapter.start_with?(SQLITE_PREFIX)
|
262
263
|
:sqlite
|
263
264
|
else
|
264
265
|
adapter.to_sym
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
module NewRelic
|
6
7
|
module Agent
|
@@ -48,15 +49,15 @@ module NewRelic
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
51
|
-
def self.scoped_metric_for
|
52
|
+
def self.scoped_metric_for(product, operation, collection = nil)
|
52
53
|
if collection
|
53
|
-
statement_metric_for
|
54
|
+
statement_metric_for(product, collection, operation)
|
54
55
|
else
|
55
|
-
operation_metric_for
|
56
|
+
operation_metric_for(product, operation)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
59
|
-
def self.unscoped_metrics_for
|
60
|
+
def self.unscoped_metrics_for(product, operation, collection = nil, host = nil, port_path_or_id = nil)
|
60
61
|
suffix = all_suffix
|
61
62
|
|
62
63
|
metrics = [
|
@@ -67,14 +68,14 @@ module NewRelic
|
|
67
68
|
]
|
68
69
|
|
69
70
|
if NewRelic::Agent.config[:'datastore_tracer.instance_reporting.enabled'] && host && port_path_or_id
|
70
|
-
metrics.unshift
|
71
|
+
metrics.unshift(instance_metric_for(product, host, port_path_or_id))
|
71
72
|
end
|
72
|
-
metrics.unshift
|
73
|
+
metrics.unshift(operation_metric_for(product, operation)) if collection
|
73
74
|
|
74
75
|
metrics
|
75
76
|
end
|
76
77
|
|
77
|
-
def self.product_operation_collection_for
|
78
|
+
def self.product_operation_collection_for(product, operation, collection = nil, generic_product = nil)
|
78
79
|
if overrides = overridden_operation_and_collection
|
79
80
|
if should_override?(overrides, product, generic_product)
|
80
81
|
operation = overrides[0] || operation
|
@@ -90,7 +91,7 @@ module NewRelic
|
|
90
91
|
# Order of these metrics matters--the first metric in the list will
|
91
92
|
# be treated as the scoped metric in a bunch of different cases.
|
92
93
|
metrics = unscoped_metrics_for(product, operation, collection, host, port_path_or_id)
|
93
|
-
metrics.unshift
|
94
|
+
metrics.unshift(scoped_metric_for(product, operation, collection))
|
94
95
|
|
95
96
|
metrics
|
96
97
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
4
6
|
require 'new_relic/agent/datastores/mongo/obfuscator'
|
5
7
|
|
6
8
|
module NewRelic
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'new_relic/agent/datastores/mongo/obfuscator'
|
6
7
|
require 'new_relic/agent/datastores/metric_helper'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
module NewRelic
|
6
7
|
module Agent
|
@@ -10,7 +11,7 @@ module NewRelic
|
|
10
11
|
ALLOWLIST = [:operation].freeze
|
11
12
|
|
12
13
|
def self.obfuscate_statement(source, allowlist = ALLOWLIST)
|
13
|
-
if source.is_a?
|
14
|
+
if source.is_a?(Hash)
|
14
15
|
obfuscated = {}
|
15
16
|
source.each do |key, value|
|
16
17
|
if allowlist.include?(key)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
module NewRelic
|
6
7
|
module Agent
|
@@ -25,7 +26,7 @@ module NewRelic
|
|
25
26
|
|
26
27
|
def self.format_command(command_with_args)
|
27
28
|
if Agent.config[:'transaction_tracer.record_redis_arguments']
|
28
|
-
result =
|
29
|
+
result = String.new('')
|
29
30
|
|
30
31
|
append_command_with_args(result, command_with_args)
|
31
32
|
|
@@ -36,7 +37,7 @@ module NewRelic
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def self.format_pipeline_commands(commands_with_args)
|
39
|
-
result =
|
40
|
+
result = String.new('')
|
40
41
|
|
41
42
|
commands_with_args.each do |command|
|
42
43
|
if result.length >= MAXIMUM_COMMAND_LENGTH
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'new_relic/agent/datastores/metric_helper'
|
6
7
|
|
@@ -43,7 +44,7 @@ module NewRelic
|
|
43
44
|
|
44
45
|
visibility = NewRelic::Helper.instance_method_visibility(klass, method_name)
|
45
46
|
|
46
|
-
alias_method
|
47
|
+
alias_method(method_name_without_newrelic, method_name)
|
47
48
|
|
48
49
|
define_method(method_name) do |*args, &blk|
|
49
50
|
segment = NewRelic::Agent::Tracer.start_datastore_segment(
|
@@ -57,8 +58,8 @@ module NewRelic
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
send
|
61
|
-
send
|
61
|
+
send(visibility, method_name)
|
62
|
+
send(visibility, method_name_without_newrelic)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
@@ -52,7 +52,7 @@ module NewRelic
|
|
52
52
|
result
|
53
53
|
end
|
54
54
|
|
55
|
-
def insert_cross_app_header
|
55
|
+
def insert_cross_app_header(headers)
|
56
56
|
return unless CrossAppTracing.cross_app_enabled?
|
57
57
|
|
58
58
|
@is_cross_app_caller = true
|
@@ -60,17 +60,17 @@ module NewRelic
|
|
60
60
|
trip_id = cat_trip_id
|
61
61
|
path_hash = cat_path_hash
|
62
62
|
|
63
|
-
insert_request_headers
|
63
|
+
insert_request_headers(headers, txn_guid, trip_id, path_hash)
|
64
64
|
end
|
65
65
|
|
66
|
-
def add_message_cat_headers
|
66
|
+
def add_message_cat_headers(headers)
|
67
67
|
return unless CrossAppTracing.cross_app_enabled?
|
68
68
|
@is_cross_app_caller = true
|
69
|
-
insert_message_headers
|
69
|
+
insert_message_headers(headers,
|
70
70
|
transaction.guid,
|
71
71
|
cat_trip_id,
|
72
72
|
cat_path_hash,
|
73
|
-
transaction.raw_synthetics_header
|
73
|
+
transaction.raw_synthetics_header)
|
74
74
|
end
|
75
75
|
|
76
76
|
def record_cross_app_metrics
|
@@ -90,7 +90,7 @@ module NewRelic
|
|
90
90
|
|
91
91
|
private
|
92
92
|
|
93
|
-
def insert_message_headers
|
93
|
+
def insert_message_headers(headers, txn_guid, trip_id, path_hash, synthetics_header)
|
94
94
|
headers[NR_MESSAGE_BROKER_ID_HEADER] = obfuscator.obfuscate(Agent.config[:cross_process_id])
|
95
95
|
headers[NR_MESSAGE_BROKER_TXN_HEADER] = obfuscator.obfuscate(::JSON.dump([txn_guid, false, trip_id, path_hash]))
|
96
96
|
headers[NR_MESSAGE_BROKER_SYNTHETICS_HEADER] = synthetics_header if synthetics_header
|
@@ -148,7 +148,7 @@ module NewRelic
|
|
148
148
|
if Agent.config[:cross_process_id] && Agent.config[:cross_process_id].length > 0
|
149
149
|
true
|
150
150
|
else
|
151
|
-
NewRelic::Agent.logger.debug
|
151
|
+
NewRelic::Agent.logger.debug("No cross_process_id configured")
|
152
152
|
false
|
153
153
|
end
|
154
154
|
end
|
@@ -157,7 +157,7 @@ module NewRelic
|
|
157
157
|
if Agent.config[:encoding_key] && Agent.config[:encoding_key].length > 0
|
158
158
|
true
|
159
159
|
else
|
160
|
-
NewRelic::Agent.logger.debug
|
160
|
+
NewRelic::Agent.logger.debug("No encoding_key set")
|
161
161
|
false
|
162
162
|
end
|
163
163
|
end
|
@@ -172,7 +172,7 @@ module NewRelic
|
|
172
172
|
@obfuscator ||= NewRelic::Agent::Obfuscator.new(Agent.config[:encoding_key])
|
173
173
|
end
|
174
174
|
|
175
|
-
def insert_request_headers
|
175
|
+
def insert_request_headers(request, txn_guid, trip_id, path_hash)
|
176
176
|
cross_app_id = NewRelic::Agent.config[:cross_process_id]
|
177
177
|
txn_data = ::JSON.dump([txn_guid, false, trip_id, path_hash])
|
178
178
|
|
@@ -184,7 +184,7 @@ module NewRelic
|
|
184
184
|
if !!response[NR_APPDATA_HEADER]
|
185
185
|
true
|
186
186
|
else
|
187
|
-
NewRelic::Agent.logger.debug
|
187
|
+
NewRelic::Agent.logger.debug("No #{NR_APPDATA_HEADER} header")
|
188
188
|
false
|
189
189
|
end
|
190
190
|
end
|
@@ -214,27 +214,27 @@ module NewRelic
|
|
214
214
|
!!(xp_id =~ /\A\d+#\d+\z/)
|
215
215
|
end
|
216
216
|
|
217
|
-
def message_has_crossapp_request_header?
|
217
|
+
def message_has_crossapp_request_header?(headers)
|
218
218
|
!!headers[NR_MESSAGE_BROKER_ID_HEADER]
|
219
219
|
end
|
220
220
|
|
221
|
-
def reject_messaging_cat_headers
|
221
|
+
def reject_messaging_cat_headers(headers)
|
222
222
|
headers.reject { |k, _| k == NR_MESSAGE_BROKER_ID_HEADER || k == NR_MESSAGE_BROKER_TXN_HEADER }
|
223
223
|
end
|
224
224
|
|
225
|
-
def trusts?
|
225
|
+
def trusts?(id)
|
226
226
|
split_id = id.match(/(\d+)#\d+/)
|
227
227
|
return false if split_id.nil?
|
228
228
|
|
229
|
-
NewRelic::Agent.config[:trusted_account_ids].include?
|
229
|
+
NewRelic::Agent.config[:trusted_account_ids].include?(split_id.captures.first.to_i)
|
230
230
|
end
|
231
231
|
|
232
|
-
def trusted_valid_cross_app_id?
|
232
|
+
def trusted_valid_cross_app_id?(id)
|
233
233
|
valid_cross_app_id?(id) && trusts?(id)
|
234
234
|
end
|
235
235
|
|
236
236
|
# From inbound request headers
|
237
|
-
def assign_intrinsic_transaction_attributes
|
237
|
+
def assign_intrinsic_transaction_attributes(state)
|
238
238
|
# We expect to get the before call to set the id (if we have it) before
|
239
239
|
# this, and then write our custom parameter when the transaction starts
|
240
240
|
return unless (txn = state.current_transaction)
|
@@ -24,7 +24,7 @@ module NewRelic
|
|
24
24
|
|
25
25
|
# This method extracts intrinsics from the transaction_payload and
|
26
26
|
# inserts them into the specified destination.
|
27
|
-
def copy_to_hash
|
27
|
+
def copy_to_hash(transaction_payload, destination)
|
28
28
|
return unless enabled?
|
29
29
|
INTRINSIC_KEYS.each do |key|
|
30
30
|
value = transaction_payload[key]
|
@@ -34,17 +34,17 @@ module NewRelic
|
|
34
34
|
|
35
35
|
# This method extracts intrinsics from the transaction_payload and
|
36
36
|
# inserts them as intrinsics in the specified transaction_attributes
|
37
|
-
def copy_to_attributes
|
37
|
+
def copy_to_attributes(transaction_payload, destination)
|
38
38
|
return unless enabled?
|
39
39
|
INTRINSIC_KEYS.each do |key|
|
40
|
-
next unless transaction_payload.key?
|
41
|
-
destination.add_intrinsic_attribute
|
40
|
+
next unless transaction_payload.key?(key)
|
41
|
+
destination.add_intrinsic_attribute(key, transaction_payload[key])
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
# This method takes all distributed tracing intrinsics from the transaction
|
46
46
|
# and the trace_payload, and populates them into the destination
|
47
|
-
def copy_from_transaction
|
47
|
+
def copy_from_transaction(transaction, trace_payload, destination)
|
48
48
|
destination[GUID_KEY] = transaction.guid
|
49
49
|
destination[SAMPLED_KEY] = transaction.sampled?
|
50
50
|
destination[TRACE_ID_KEY] = transaction.trace_id
|
@@ -53,18 +53,18 @@ module NewRelic
|
|
53
53
|
destination[PARENT_SPAN_ID_KEY] = transaction.parent_span_id
|
54
54
|
end
|
55
55
|
|
56
|
-
copy_parent_attributes
|
56
|
+
copy_parent_attributes(transaction, trace_payload, destination)
|
57
57
|
end
|
58
58
|
|
59
|
-
def copy_parent_attributes
|
59
|
+
def copy_parent_attributes(transaction, trace_payload, destination)
|
60
60
|
transport_type = transaction.distributed_tracer.caller_transport_type
|
61
|
-
destination[PARENT_TRANSPORT_TYPE_KEY] = DistributedTraceTransportType.from
|
61
|
+
destination[PARENT_TRANSPORT_TYPE_KEY] = DistributedTraceTransportType.from(transport_type)
|
62
62
|
|
63
63
|
if trace_payload
|
64
64
|
destination[PARENT_TYPE_KEY] = trace_payload.parent_type
|
65
65
|
destination[PARENT_APP_KEY] = trace_payload.parent_app_id
|
66
66
|
destination[PARENT_ACCOUNT_ID_KEY] = trace_payload.parent_account_id
|
67
|
-
destination[PARENT_TRANSPORT_DURATION_KEY] = transaction.calculate_transport_duration
|
67
|
+
destination[PARENT_TRANSPORT_DURATION_KEY] = transaction.calculate_transport_duration(trace_payload)
|
68
68
|
|
69
69
|
if parent_transaction_id = transaction.distributed_tracer.parent_transaction_id
|
70
70
|
destination[PARENT_TRANSACTION_ID_KEY] = parent_transaction_id
|
@@ -22,17 +22,17 @@ module NewRelic
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def record_metrics_for_transaction
|
25
|
+
def record_metrics_for_transaction(transaction)
|
26
26
|
return unless Agent.config[:'distributed_tracing.enabled']
|
27
27
|
dt = transaction.distributed_tracer
|
28
28
|
payload = dt.distributed_trace_payload || dt.trace_state_payload
|
29
29
|
|
30
|
-
record_caller_by_duration_metrics
|
31
|
-
record_transport_duration_metrics
|
32
|
-
record_errors_by_caller_metrics
|
30
|
+
record_caller_by_duration_metrics(transaction, payload)
|
31
|
+
record_transport_duration_metrics(transaction, payload)
|
32
|
+
record_errors_by_caller_metrics(transaction, payload)
|
33
33
|
end
|
34
34
|
|
35
|
-
def prefix_for_metric
|
35
|
+
def prefix_for_metric(name, transaction, payload)
|
36
36
|
if payload
|
37
37
|
"#{name}/" \
|
38
38
|
"#{payload.parent_type}/" \
|
@@ -44,31 +44,31 @@ module NewRelic
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def record_caller_by_duration_metrics
|
48
|
-
prefix = prefix_for_metric
|
49
|
-
record_unscoped_metric
|
47
|
+
def record_caller_by_duration_metrics(transaction, payload)
|
48
|
+
prefix = prefix_for_metric("DurationByCaller", transaction, payload)
|
49
|
+
record_unscoped_metric(transaction, prefix, transaction.duration)
|
50
50
|
end
|
51
51
|
|
52
|
-
def record_transport_duration_metrics
|
52
|
+
def record_transport_duration_metrics(transaction, payload)
|
53
53
|
return unless payload
|
54
54
|
|
55
|
-
prefix = prefix_for_metric
|
56
|
-
duration = transaction.calculate_transport_duration
|
57
|
-
record_unscoped_metric
|
55
|
+
prefix = prefix_for_metric("TransportDuration", transaction, payload)
|
56
|
+
duration = transaction.calculate_transport_duration(payload)
|
57
|
+
record_unscoped_metric(transaction, prefix, duration)
|
58
58
|
end
|
59
59
|
|
60
|
-
def record_errors_by_caller_metrics
|
60
|
+
def record_errors_by_caller_metrics(transaction, payload)
|
61
61
|
return unless transaction.exceptions.size > 0
|
62
62
|
|
63
|
-
prefix = prefix_for_metric
|
64
|
-
record_unscoped_metric
|
63
|
+
prefix = prefix_for_metric("ErrorsByCaller", transaction, payload)
|
64
|
+
record_unscoped_metric(transaction, prefix, 1)
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
|
-
def record_unscoped_metric
|
70
|
-
transaction.metrics.record_unscoped
|
71
|
-
transaction.metrics.record_unscoped
|
69
|
+
def record_unscoped_metric(transaction, prefix, duration)
|
70
|
+
transaction.metrics.record_unscoped("#{prefix}/#{ALL_SUFFIX}", duration)
|
71
|
+
transaction.metrics.record_unscoped("#{prefix}/#{transaction_type_suffix}", duration)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
PRIORITY_KEY = 'pr'
|
37
37
|
|
38
38
|
class << self
|
39
|
-
def for_transaction
|
39
|
+
def for_transaction(transaction)
|
40
40
|
return nil unless connected?
|
41
41
|
|
42
42
|
payload = new
|
@@ -57,8 +57,8 @@ module NewRelic
|
|
57
57
|
payload
|
58
58
|
end
|
59
59
|
|
60
|
-
def from_json
|
61
|
-
raw_payload = JSON.parse
|
60
|
+
def from_json(serialized_payload)
|
61
|
+
raw_payload = JSON.parse(serialized_payload)
|
62
62
|
return raw_payload if raw_payload.nil?
|
63
63
|
payload_data = raw_payload[DATA_KEY]
|
64
64
|
|
@@ -78,9 +78,9 @@ module NewRelic
|
|
78
78
|
payload
|
79
79
|
end
|
80
80
|
|
81
|
-
def from_http_safe
|
82
|
-
decoded_payload = Base64.strict_decode64
|
83
|
-
from_json
|
81
|
+
def from_http_safe(http_safe_payload)
|
82
|
+
decoded_payload = Base64.strict_decode64(http_safe_payload)
|
83
|
+
from_json(decoded_payload)
|
84
84
|
end
|
85
85
|
|
86
86
|
def major_version_matches?(payload)
|
@@ -89,7 +89,7 @@ module NewRelic
|
|
89
89
|
|
90
90
|
private
|
91
91
|
|
92
|
-
def assign_trusted_account_key
|
92
|
+
def assign_trusted_account_key(payload, account_id)
|
93
93
|
trusted_account_key = Agent.config[:trusted_account_key]
|
94
94
|
|
95
95
|
if account_id != trusted_account_key
|
@@ -157,7 +157,7 @@ module NewRelic
|
|
157
157
|
#
|
158
158
|
# @api public
|
159
159
|
def http_safe
|
160
|
-
Base64.strict_encode64
|
160
|
+
Base64.strict_encode64(text)
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -27,11 +27,11 @@ module NewRelic
|
|
27
27
|
|
28
28
|
RACK_URL_SCHEME = 'rack.url_scheme'
|
29
29
|
|
30
|
-
def from
|
30
|
+
def from(value)
|
31
31
|
ALLOWABLE_TRANSPORT_TYPES.include?(value) ? value : NewRelic::UNKNOWN
|
32
32
|
end
|
33
33
|
|
34
|
-
def for_rack_request
|
34
|
+
def for_rack_request(request)
|
35
35
|
URL_SCHEMES[request[RACK_URL_SCHEME]]
|
36
36
|
end
|
37
37
|
end
|