newrelic_rpm 8.15.0 → 9.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.build_ignore +26 -0
- data/CHANGELOG.md +538 -44
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -1
- data/README.md +11 -6
- data/Rakefile +9 -9
- data/Thorfile +1 -1
- data/bin/newrelic +1 -0
- data/bin/newrelic_cmd +1 -0
- data/bin/nrdebug +36 -36
- data/init.rb +1 -1
- data/lib/new_relic/agent/agent.rb +3 -16
- data/lib/new_relic/agent/agent_helpers/connect.rb +5 -10
- data/lib/new_relic/agent/agent_helpers/harvest.rb +4 -4
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +5 -5
- data/lib/new_relic/agent/agent_helpers/special_startup.rb +3 -4
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +47 -39
- data/lib/new_relic/agent/agent_helpers/startup.rb +13 -13
- data/lib/new_relic/agent/agent_helpers/transmit.rb +6 -6
- data/lib/new_relic/agent/agent_logger.rb +9 -9
- data/lib/new_relic/agent/attribute_filter.rb +2 -4
- data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
- data/lib/new_relic/agent/attribute_processing.rb +2 -2
- data/lib/new_relic/agent/audit_logger.rb +5 -5
- data/lib/new_relic/agent/autostart.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command.rb +2 -2
- data/lib/new_relic/agent/commands/agent_command_router.rb +5 -4
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +8 -8
- data/lib/new_relic/agent/configuration/default_source.rb +428 -586
- data/lib/new_relic/agent/configuration/environment_source.rb +2 -2
- data/lib/new_relic/agent/configuration/high_security_source.rb +3 -5
- data/lib/new_relic/agent/configuration/manager.rb +16 -2
- data/lib/new_relic/agent/configuration/security_policy_source.rb +10 -26
- data/lib/new_relic/agent/configuration/server_source.rb +24 -24
- data/lib/new_relic/agent/configuration/yaml_source.rb +17 -4
- data/lib/new_relic/agent/connect/request_builder.rb +1 -1
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
- data/lib/new_relic/agent/database/obfuscator.rb +2 -2
- data/lib/new_relic/agent/database.rb +4 -18
- data/lib/new_relic/agent/datastores/metric_helper.rb +5 -5
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +11 -11
- data/lib/new_relic/agent/datastores/redis.rb +6 -6
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +8 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +7 -7
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +6 -6
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +7 -7
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +4 -4
- data/lib/new_relic/agent/distributed_tracing.rb +6 -6
- data/lib/new_relic/agent/error_collector.rb +36 -8
- data/lib/new_relic/agent/error_filter.rb +5 -5
- data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
- data/lib/new_relic/agent/event_loop.rb +3 -3
- data/lib/new_relic/agent/external.rb +1 -1
- data/lib/new_relic/agent/harvester.rb +1 -3
- data/lib/new_relic/agent/heap.rb +2 -1
- data/lib/new_relic/agent/hostname.rb +1 -1
- data/lib/new_relic/agent/http_clients/abstract.rb +9 -21
- data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +83 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +7 -3
- data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +111 -0
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +7 -5
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +4 -0
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +6 -2
- data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +93 -0
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +5 -1
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +8 -5
- data/lib/new_relic/agent/http_clients/uri_util.rb +2 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -19
- data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +42 -0
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +3 -2
- data/lib/new_relic/agent/instrumentation/action_dispatch.rb +31 -0
- data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +64 -0
- data/lib/new_relic/agent/instrumentation/action_mailbox.rb +30 -0
- data/lib/new_relic/agent/instrumentation/action_mailbox_subscriber.rb +33 -0
- data/lib/new_relic/agent/instrumentation/action_mailer.rb +30 -0
- data/lib/new_relic/agent/instrumentation/action_mailer_subscriber.rb +85 -0
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +10 -10
- data/lib/new_relic/agent/instrumentation/active_job.rb +16 -3
- data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +41 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record.rb +4 -3
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +38 -36
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +5 -4
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +3 -2
- data/lib/new_relic/agent/instrumentation/active_storage.rb +4 -0
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +2 -30
- data/lib/new_relic/agent/instrumentation/active_support.rb +21 -6
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/chain.rb +69 -0
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/instrumentation.rb +13 -0
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger/prepend.rb +37 -0
- data/lib/new_relic/agent/instrumentation/active_support_broadcast_logger.rb +23 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +3 -1
- data/lib/new_relic/agent/instrumentation/active_support_subscriber.rb +41 -0
- data/lib/new_relic/agent/instrumentation/async_http/chain.rb +23 -0
- data/lib/new_relic/agent/instrumentation/async_http/instrumentation.rb +37 -0
- data/lib/new_relic/agent/instrumentation/async_http/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/async_http.rb +26 -0
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +12 -3
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -1
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/instrumentation.rb +3 -4
- data/lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +7 -6
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +9 -5
- data/lib/new_relic/agent/instrumentation/curb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/custom_events.rb +12 -0
- data/lib/new_relic/agent/instrumentation/custom_events_subscriber.rb +2 -1
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +4 -1
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -1
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +8 -4
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +2 -2
- data/lib/new_relic/agent/instrumentation/ethon/chain.rb +39 -0
- data/lib/new_relic/agent/instrumentation/ethon/instrumentation.rb +105 -0
- data/lib/new_relic/agent/instrumentation/ethon/prepend.rb +35 -0
- data/lib/new_relic/agent/instrumentation/ethon.rb +39 -0
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +5 -1
- data/lib/new_relic/agent/instrumentation/excon.rb +3 -3
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +27 -0
- data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +23 -0
- data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +25 -0
- data/lib/new_relic/agent/instrumentation/fiber.rb +25 -0
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +8 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +7 -2
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +8 -4
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +2 -2
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/httprb.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpx/chain.rb +20 -0
- data/lib/new_relic/agent/instrumentation/httpx/instrumentation.rb +51 -0
- data/lib/new_relic/agent/instrumentation/httpx/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/httpx.rb +27 -0
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +3 -1
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +14 -5
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +3 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +12 -12
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +3 -3
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +1 -1
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +6 -8
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -1
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +46 -1
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +7 -3
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +7 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +7 -2
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +14 -1
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +12 -15
- data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +6 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
- data/lib/new_relic/agent/instrumentation/roda/chain.rb +43 -0
- data/lib/new_relic/agent/instrumentation/roda/ignorer.rb +45 -0
- data/lib/new_relic/agent/instrumentation/roda/instrumentation.rb +68 -0
- data/lib/new_relic/agent/instrumentation/roda/prepend.rb +24 -0
- data/lib/new_relic/agent/instrumentation/roda/roda_transaction_namer.rb +29 -0
- data/lib/new_relic/agent/instrumentation/roda.rb +36 -0
- data/lib/new_relic/agent/instrumentation/sequel.rb +8 -9
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +10 -10
- data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +4 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -3
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +10 -5
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -4
- data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
- data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +77 -0
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +3 -8
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +6 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +10 -6
- data/lib/new_relic/agent/javascript_instrumentor.rb +29 -24
- data/lib/new_relic/agent/linking_metadata.rb +2 -2
- data/lib/new_relic/agent/log_event_aggregator.rb +64 -17
- data/lib/new_relic/agent/log_event_attributes.rb +115 -0
- data/lib/new_relic/agent/logging.rb +77 -37
- data/lib/new_relic/agent/messaging.rb +9 -7
- data/lib/new_relic/agent/method_tracer.rb +7 -7
- data/lib/new_relic/agent/method_tracer_helpers.rb +27 -6
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -5
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +1 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +12 -1
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +0 -1
- data/lib/new_relic/agent/new_relic_service.rb +47 -32
- data/lib/new_relic/agent/obfuscator.rb +1 -1
- data/lib/new_relic/agent/parameter_filtering.rb +6 -6
- data/lib/new_relic/agent/pipe_channel_manager.rb +7 -6
- data/lib/new_relic/agent/pipe_service.rb +5 -3
- data/lib/new_relic/agent/priority_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +0 -1
- data/lib/new_relic/agent/rules_engine.rb +1 -1
- data/lib/new_relic/agent/sampler.rb +2 -1
- data/lib/new_relic/agent/sampler_collection.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +5 -5
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +9 -9
- data/lib/new_relic/agent/samplers/memory_sampler.rb +9 -9
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/span_event_primitive.rb +18 -6
- data/lib/new_relic/agent/sql_sampler.rb +2 -2
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/system_info.rb +36 -10
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_node.rb +3 -3
- data/lib/new_relic/agent/threading/backtrace_service.rb +3 -7
- data/lib/new_relic/agent/threading/thread_profile.rb +5 -5
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +25 -16
- data/lib/new_relic/agent/transaction/abstract_segment.rb +109 -48
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -6
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +13 -14
- data/lib/new_relic/agent/transaction/external_request_segment.rb +16 -13
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +2 -3
- data/lib/new_relic/agent/transaction/request_attributes.rb +47 -11
- data/lib/new_relic/agent/transaction/segment.rb +1 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/trace.rb +1 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +4 -4
- data/lib/new_relic/agent/transaction/trace_node.rb +8 -7
- data/lib/new_relic/agent/transaction/tracing.rb +10 -4
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +90 -58
- data/lib/new_relic/agent/transaction_error_primitive.rb +21 -5
- data/lib/new_relic/agent/transaction_event_aggregator.rb +4 -4
- data/lib/new_relic/agent/transaction_event_primitive.rb +22 -3
- data/lib/new_relic/agent/transaction_sampler.rb +3 -3
- data/lib/new_relic/agent/transaction_time_aggregator.rb +7 -3
- data/lib/new_relic/agent/utilization/aws.rb +1 -1
- data/lib/new_relic/agent/utilization/azure.rb +3 -3
- data/lib/new_relic/agent/utilization/gcp.rb +4 -6
- data/lib/new_relic/agent/utilization/pcf.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +6 -8
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +9 -8
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +133 -36
- data/lib/new_relic/cli/command.rb +4 -3
- data/lib/new_relic/cli/commands/deployments.rb +26 -25
- data/lib/new_relic/cli/commands/install.rb +23 -23
- data/lib/new_relic/collection_helper.rb +2 -2
- data/lib/new_relic/constants.rb +10 -8
- data/lib/new_relic/control/class_methods.rb +4 -10
- data/lib/new_relic/control/frameworks/rails.rb +44 -20
- data/lib/new_relic/control/frameworks/roda.rb +20 -0
- data/lib/new_relic/control/instance_methods.rb +6 -6
- data/lib/new_relic/control/instrumentation.rb +1 -15
- data/lib/new_relic/control/private_instance_methods.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +20 -18
- data/lib/new_relic/environment_report.rb +4 -4
- data/lib/new_relic/helper.rb +2 -1
- data/lib/new_relic/language_support.rb +10 -1
- data/lib/new_relic/latest_changes.rb +6 -6
- data/lib/new_relic/local_environment.rb +0 -10
- data/lib/new_relic/noticed_error.rb +25 -20
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +0 -16
- data/lib/new_relic/rack/browser_monitoring.rb +21 -17
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/recipes/capistrano_legacy.rb +6 -6
- data/lib/new_relic/recipes/helpers/send_deployment.rb +5 -5
- data/lib/new_relic/supportability_helper.rb +4 -1
- data/lib/new_relic/traced_thread.rb +2 -3
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +4 -4
- data/lib/sequel/extensions/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +6 -6
- data/lib/sequel/plugins/{newrelic_instrumentation.rb → new_relic_instrumentation.rb} +4 -4
- data/lib/tasks/bump_version.rake +21 -0
- data/lib/tasks/config.rake +13 -12
- data/lib/tasks/coverage_report.rake +4 -4
- data/lib/tasks/helpers/config.html.erb +93 -0
- data/lib/tasks/helpers/format.rb +19 -15
- data/lib/tasks/helpers/newrelicyml.rb +144 -0
- data/lib/tasks/helpers/version_bump.rb +62 -0
- data/lib/tasks/install.rake +4 -4
- data/lib/tasks/instrumentation_generator/instrumentation.thor +16 -19
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +1 -1
- data/lib/tasks/instrumentation_generator/templates/chain.tt +1 -1
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +1 -1
- data/lib/tasks/newrelic.rb +1 -0
- data/lib/tasks/newrelicyml.rake +13 -0
- data/lib/tasks/tests.rake +77 -6
- data/newrelic.yml +393 -274
- data/newrelic_rpm.gemspec +41 -30
- data/test/agent_helper.rb +25 -24
- metadata +172 -35
- data/.gitignore +0 -42
- data/.project +0 -23
- data/.rubocop.yml +0 -1946
- data/.rubocop_todo.yml +0 -62
- data/.simplecov +0 -15
- data/.snyk +0 -11
- data/.yardopts +0 -27
- data/Brewfile +0 -12
- data/DOCKER.md +0 -167
- data/Dockerfile +0 -10
- data/Guardfile +0 -26
- data/config/database.yml +0 -5
- data/config.dot +0 -278
- data/docker-compose.yml +0 -107
- data/lefthook.yml +0 -9
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +0 -83
- data/lib/new_relic/agent/instrumentation/authlogic.rb +0 -33
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +0 -215
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +0 -36
- data/lib/new_relic/agent/instrumentation/sunspot.rb +0 -41
- data/lib/new_relic/agent/range_extensions.rb +0 -27
- data/lib/tasks/helpers/removers.rb +0 -33
- data/lib/tasks/multiverse.rake +0 -6
- data/lib/tasks/multiverse.rb +0 -77
@@ -23,38 +23,36 @@ module NewRelic
|
|
23
23
|
include Tracing
|
24
24
|
|
25
25
|
# for nested transactions
|
26
|
-
NESTED_TRANSACTION_PREFIX =
|
27
|
-
CONTROLLER_PREFIX =
|
28
|
-
MIDDLEWARE_PREFIX =
|
29
|
-
OTHER_TRANSACTION_PREFIX =
|
26
|
+
NESTED_TRANSACTION_PREFIX = 'Nested/'
|
27
|
+
CONTROLLER_PREFIX = 'Controller/'
|
28
|
+
MIDDLEWARE_PREFIX = 'Middleware/Rack/'
|
29
|
+
OTHER_TRANSACTION_PREFIX = 'OtherTransaction/'
|
30
30
|
TASK_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Background/"
|
31
31
|
RAKE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Rake/"
|
32
32
|
MESSAGE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Message/"
|
33
33
|
RACK_PREFIX = "#{CONTROLLER_PREFIX}Rack/"
|
34
|
+
RODA_PREFIX = "#{CONTROLLER_PREFIX}Roda/"
|
34
35
|
SINATRA_PREFIX = "#{CONTROLLER_PREFIX}Sinatra/"
|
35
36
|
GRAPE_PREFIX = "#{CONTROLLER_PREFIX}Grape/"
|
36
37
|
ACTION_CABLE_PREFIX = "#{CONTROLLER_PREFIX}ActionCable/"
|
37
38
|
|
38
|
-
WEB_TRANSACTION_CATEGORIES = [
|
39
|
+
WEB_TRANSACTION_CATEGORIES = %i[action_cable controller grape middleware rack roda sinatra web uri].freeze
|
39
40
|
|
40
|
-
MIDDLEWARE_SUMMARY_METRICS = [
|
41
|
-
WEB_SUMMARY_METRIC =
|
41
|
+
MIDDLEWARE_SUMMARY_METRICS = ['Middleware/all'].freeze
|
42
|
+
WEB_SUMMARY_METRIC = 'HttpDispatcher'
|
42
43
|
OTHER_SUMMARY_METRIC = "#{OTHER_TRANSACTION_PREFIX}all"
|
43
|
-
QUEUE_TIME_METRIC =
|
44
|
+
QUEUE_TIME_METRIC = 'WebFrontend/QueueTime'
|
44
45
|
|
45
|
-
APDEX_S =
|
46
|
-
APDEX_T =
|
47
|
-
APDEX_F =
|
48
|
-
APDEX_ALL_METRIC =
|
49
|
-
APDEX_METRIC =
|
50
|
-
APDEX_OTHER_METRIC =
|
51
|
-
APDEX_TXN_METRIC_PREFIX =
|
52
|
-
APDEX_OTHER_TXN_METRIC_PREFIX =
|
46
|
+
APDEX_S = 'S'
|
47
|
+
APDEX_T = 'T'
|
48
|
+
APDEX_F = 'F'
|
49
|
+
APDEX_ALL_METRIC = 'ApdexAll'
|
50
|
+
APDEX_METRIC = 'Apdex'
|
51
|
+
APDEX_OTHER_METRIC = 'ApdexOther'
|
52
|
+
APDEX_TXN_METRIC_PREFIX = 'Apdex/'
|
53
|
+
APDEX_OTHER_TXN_METRIC_PREFIX = 'ApdexOther/Transaction/'
|
53
54
|
|
54
|
-
JRUBY_CPU_TIME_ERROR =
|
55
|
-
|
56
|
-
# reference to the transaction state managing this transaction
|
57
|
-
attr_accessor :state
|
55
|
+
JRUBY_CPU_TIME_ERROR = 'Error calculating JRuby CPU Time'
|
58
56
|
|
59
57
|
# A Time instance for the start time, never nil
|
60
58
|
attr_accessor :start_time
|
@@ -92,7 +90,7 @@ module NewRelic
|
|
92
90
|
attr_reader :transaction_trace
|
93
91
|
|
94
92
|
# Fields for tracking synthetics requests
|
95
|
-
attr_accessor :raw_synthetics_header, :synthetics_payload
|
93
|
+
attr_accessor :raw_synthetics_header, :synthetics_payload, :synthetics_info_payload, :raw_synthetics_info_header
|
96
94
|
|
97
95
|
# Return the currently active transaction, or nil.
|
98
96
|
def self.tl_current
|
@@ -121,7 +119,6 @@ module NewRelic
|
|
121
119
|
def self.start_new_transaction(state, category, options)
|
122
120
|
txn = Transaction.new(category, options)
|
123
121
|
state.reset(txn)
|
124
|
-
txn.state = state
|
125
122
|
txn.start(options)
|
126
123
|
txn
|
127
124
|
end
|
@@ -159,7 +156,7 @@ module NewRelic
|
|
159
156
|
NewRelic::Agent.record_api_supportability_metric(:recording_web_transaction?)
|
160
157
|
|
161
158
|
txn = tl_current
|
162
|
-
txn
|
159
|
+
txn&.recording_web_transaction?
|
163
160
|
end
|
164
161
|
|
165
162
|
def self.apdex_bucket(duration, failed, apdex_t)
|
@@ -185,20 +182,21 @@ module NewRelic
|
|
185
182
|
|
186
183
|
def add_agent_attribute(key, value, default_destinations)
|
187
184
|
@attributes.add_agent_attribute(key, value, default_destinations)
|
188
|
-
|
185
|
+
# the following line needs else branch coverage
|
186
|
+
current_segment.add_agent_attribute(key, value) if current_segment # rubocop:disable Style/SafeNavigation
|
189
187
|
end
|
190
188
|
|
191
189
|
def self.merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
192
190
|
if txn = tl_current
|
193
191
|
txn.merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
194
192
|
else
|
195
|
-
NewRelic::Agent.logger.debug(
|
193
|
+
NewRelic::Agent.logger.debug('Attempted to merge untrusted attributes without transaction')
|
196
194
|
end
|
197
195
|
end
|
198
196
|
|
199
197
|
def merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
200
198
|
@attributes.merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
201
|
-
current_segment
|
199
|
+
current_segment&.merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
202
200
|
end
|
203
201
|
|
204
202
|
@@java_classes_loaded = false
|
@@ -213,7 +211,7 @@ module NewRelic
|
|
213
211
|
end
|
214
212
|
end
|
215
213
|
|
216
|
-
def initialize(category, options)
|
214
|
+
def initialize(category, options) # rubocop:disable Metrics/AbcSize
|
217
215
|
@nesting_max_depth = 0
|
218
216
|
@current_segment_by_thread = {}
|
219
217
|
@current_segment_lock = Mutex.new
|
@@ -248,6 +246,7 @@ module NewRelic
|
|
248
246
|
@priority = nil
|
249
247
|
|
250
248
|
@starting_thread_id = Thread.current.object_id
|
249
|
+
@starting_segment_key = current_segment_key
|
251
250
|
|
252
251
|
@attributes = Attributes.new(NewRelic::Agent.instance.attribute_filter)
|
253
252
|
|
@@ -260,20 +259,26 @@ module NewRelic
|
|
260
259
|
end
|
261
260
|
end
|
262
261
|
|
263
|
-
def
|
264
|
-
::
|
262
|
+
def state
|
263
|
+
NewRelic::Agent::Tracer.state
|
265
264
|
end
|
266
265
|
|
267
|
-
def
|
268
|
-
|
269
|
-
|
270
|
-
return current_segment_by_thread[parent_thread_id] if current_segment_by_thread[parent_thread_id]
|
266
|
+
def current_segment_key
|
267
|
+
Tracer.current_segment_key
|
268
|
+
end
|
271
269
|
|
272
|
-
|
270
|
+
def parent_segment_key
|
271
|
+
(::Fiber.current.nr_parent_key if ::Fiber.current.respond_to?(:nr_parent_key)) || (::Thread.current.nr_parent_key if ::Thread.current.respond_to?(:nr_parent_key))
|
272
|
+
end
|
273
|
+
|
274
|
+
def current_segment
|
275
|
+
current_segment_by_thread[current_segment_key] ||
|
276
|
+
current_segment_by_thread[parent_segment_key] ||
|
277
|
+
current_segment_by_thread[@starting_segment_key]
|
273
278
|
end
|
274
279
|
|
275
280
|
def set_current_segment(new_segment)
|
276
|
-
@current_segment_lock.synchronize { current_segment_by_thread[
|
281
|
+
@current_segment_lock.synchronize { current_segment_by_thread[current_segment_key] = new_segment }
|
277
282
|
end
|
278
283
|
|
279
284
|
def remove_current_segment_by_thread_id(id)
|
@@ -285,7 +290,7 @@ module NewRelic
|
|
285
290
|
end
|
286
291
|
|
287
292
|
def sampled?
|
288
|
-
return unless Agent.config[:'distributed_tracing.enabled']
|
293
|
+
return false unless Agent.config[:'distributed_tracing.enabled']
|
289
294
|
|
290
295
|
if @sampled.nil?
|
291
296
|
@sampled = NewRelic::Agent.instance.adaptive_sampler.sampled?
|
@@ -306,15 +311,15 @@ module NewRelic
|
|
306
311
|
end
|
307
312
|
|
308
313
|
def referer
|
309
|
-
@request_attributes
|
314
|
+
@request_attributes&.referer
|
310
315
|
end
|
311
316
|
|
312
317
|
def request_path
|
313
|
-
@request_attributes
|
318
|
+
@request_attributes&.request_path
|
314
319
|
end
|
315
320
|
|
316
321
|
def request_port
|
317
|
-
@request_attributes
|
322
|
+
@request_attributes&.port
|
318
323
|
end
|
319
324
|
|
320
325
|
# This transaction-local hash may be used as temporary storage by
|
@@ -359,10 +364,8 @@ module NewRelic
|
|
359
364
|
def set_overriding_transaction_name(name, category)
|
360
365
|
return log_frozen_name(name) if name_frozen?
|
361
366
|
|
362
|
-
|
363
|
-
|
364
|
-
@category = category if category
|
365
|
-
end
|
367
|
+
self.overridden_name = name
|
368
|
+
@category = category if category
|
366
369
|
end
|
367
370
|
|
368
371
|
def log_frozen_name(name)
|
@@ -437,6 +440,10 @@ module NewRelic
|
|
437
440
|
segments.first
|
438
441
|
end
|
439
442
|
|
443
|
+
def finished?
|
444
|
+
initial_segment&.finished?
|
445
|
+
end
|
446
|
+
|
440
447
|
def create_initial_segment(options = {})
|
441
448
|
segment = create_segment(@default_name, options)
|
442
449
|
segment.record_scoped_metric = false
|
@@ -513,7 +520,7 @@ module NewRelic
|
|
513
520
|
end
|
514
521
|
|
515
522
|
def finish
|
516
|
-
return unless state.is_execution_traced?
|
523
|
+
return unless state.is_execution_traced? && initial_segment
|
517
524
|
|
518
525
|
@end_time = Process.clock_gettime(Process::CLOCK_REALTIME)
|
519
526
|
@duration = @end_time - @start_time
|
@@ -532,15 +539,15 @@ module NewRelic
|
|
532
539
|
|
533
540
|
commit!(initial_segment.name) unless @ignore_this_transaction
|
534
541
|
rescue => e
|
535
|
-
NewRelic::Agent.logger.error(
|
542
|
+
NewRelic::Agent.logger.error('Exception during Transaction#finish', e)
|
536
543
|
nil
|
537
544
|
ensure
|
538
545
|
state.reset
|
539
546
|
end
|
540
547
|
|
541
548
|
def user_defined_rules_ignore?
|
542
|
-
return unless request_path
|
543
|
-
return if (rules = NewRelic::Agent.config[:"rules.ignore_url_regexes"]).empty?
|
549
|
+
return false unless request_path
|
550
|
+
return false if (rules = NewRelic::Agent.config[:"rules.ignore_url_regexes"]).empty?
|
544
551
|
|
545
552
|
rules.any? do |rule|
|
546
553
|
request_path.match(rule)
|
@@ -593,9 +600,7 @@ module NewRelic
|
|
593
600
|
add_agent_attribute(:'response.headers.contentType', response_content_type, default_destinations)
|
594
601
|
end
|
595
602
|
|
596
|
-
|
597
|
-
@request_attributes.assign_agent_attributes(self)
|
598
|
-
end
|
603
|
+
@request_attributes&.assign_agent_attributes(self)
|
599
604
|
|
600
605
|
display_host = Agent.config[:'process_host.display_name']
|
601
606
|
unless display_host == NewRelic::Agent::Hostname.get
|
@@ -618,11 +623,24 @@ module NewRelic
|
|
618
623
|
attributes.add_intrinsic_attribute(:synthetics_resource_id, synthetics_resource_id)
|
619
624
|
attributes.add_intrinsic_attribute(:synthetics_job_id, synthetics_job_id)
|
620
625
|
attributes.add_intrinsic_attribute(:synthetics_monitor_id, synthetics_monitor_id)
|
626
|
+
attributes.add_intrinsic_attribute(:synthetics_type, synthetics_info('type'))
|
627
|
+
attributes.add_intrinsic_attribute(:synthetics_initiator, synthetics_info('initiator'))
|
628
|
+
|
629
|
+
synthetics_additional_attributes do |key, value|
|
630
|
+
attributes.add_intrinsic_attribute(key, value)
|
631
|
+
end
|
621
632
|
end
|
622
633
|
|
623
634
|
distributed_tracer.assign_intrinsics
|
624
635
|
end
|
625
636
|
|
637
|
+
def synthetics_additional_attributes(&block)
|
638
|
+
synthetics_info('attributes')&.each do |k, v|
|
639
|
+
new_key = "synthetics_#{NewRelic::LanguageSupport.snakeize(k.to_s)}".to_sym
|
640
|
+
yield(new_key, v.to_s)
|
641
|
+
end
|
642
|
+
end
|
643
|
+
|
626
644
|
def calculate_gc_time
|
627
645
|
gc_stop_snapshot = NewRelic::Agent::StatsEngine::GCProfiler.take_snapshot
|
628
646
|
NewRelic::Agent::StatsEngine::GCProfiler.record_delta(gc_start_snapshot, gc_stop_snapshot)
|
@@ -702,6 +720,10 @@ module NewRelic
|
|
702
720
|
info[4]
|
703
721
|
end
|
704
722
|
|
723
|
+
def synthetics_info(key)
|
724
|
+
synthetics_info_payload[key] if synthetics_info_payload
|
725
|
+
end
|
726
|
+
|
705
727
|
def append_apdex_perf_zone(payload)
|
706
728
|
if recording_web_transaction?
|
707
729
|
bucket = apdex_bucket(duration, apdex_t)
|
@@ -725,6 +747,12 @@ module NewRelic
|
|
725
747
|
payload[:synthetics_resource_id] = synthetics_resource_id
|
726
748
|
payload[:synthetics_job_id] = synthetics_job_id
|
727
749
|
payload[:synthetics_monitor_id] = synthetics_monitor_id
|
750
|
+
payload[:synthetics_type] = synthetics_info('type')
|
751
|
+
payload[:synthetics_initiator] = synthetics_info('initiator')
|
752
|
+
|
753
|
+
synthetics_additional_attributes do |key, value|
|
754
|
+
payload[key] = value
|
755
|
+
end
|
728
756
|
end
|
729
757
|
|
730
758
|
def merge_metrics
|
@@ -734,15 +762,19 @@ module NewRelic
|
|
734
762
|
def record_exceptions
|
735
763
|
error_recorded = false
|
736
764
|
@exceptions.each do |exception, options|
|
737
|
-
|
738
|
-
options[:port] = request_port if request_port
|
739
|
-
options[:metric] = best_name
|
740
|
-
options[:attributes] = @attributes
|
741
|
-
|
742
|
-
span_id = options.delete(:span_id)
|
743
|
-
error_recorded = !!agent.error_collector.notice_error(exception, options, span_id) || error_recorded
|
765
|
+
error_recorded = record_exception(exception, options, error_recorded)
|
744
766
|
end
|
745
|
-
payload[:error
|
767
|
+
payload&.[]=(:error, error_recorded)
|
768
|
+
end
|
769
|
+
|
770
|
+
def record_exception(exception, options, error_recorded)
|
771
|
+
options[:uri] ||= request_path if request_path
|
772
|
+
options[:port] = request_port if request_port
|
773
|
+
options[:metric] = best_name
|
774
|
+
options[:attributes] = @attributes
|
775
|
+
|
776
|
+
span_id = options.delete(:span_id)
|
777
|
+
!!agent.error_collector.notice_error(exception, options, span_id) || error_recorded
|
746
778
|
end
|
747
779
|
|
748
780
|
# Do not call this. Invoke the class method instead.
|
@@ -28,11 +28,16 @@ module NewRelic
|
|
28
28
|
SAMPLED_KEY = 'sampled'.freeze
|
29
29
|
GUID_KEY = 'nr.transactionGuid'.freeze
|
30
30
|
REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'.freeze
|
31
|
-
SYNTHETICS_RESOURCE_ID_KEY =
|
32
|
-
SYNTHETICS_JOB_ID_KEY =
|
33
|
-
SYNTHETICS_MONITOR_ID_KEY =
|
34
|
-
|
35
|
-
|
31
|
+
SYNTHETICS_RESOURCE_ID_KEY = 'nr.syntheticsResourceId'.freeze
|
32
|
+
SYNTHETICS_JOB_ID_KEY = 'nr.syntheticsJobId'.freeze
|
33
|
+
SYNTHETICS_MONITOR_ID_KEY = 'nr.syntheticsMonitorId'.freeze
|
34
|
+
SYNTHETICS_TYPE_KEY = 'nr.syntheticsType'
|
35
|
+
SYNTHETICS_INITIATOR_KEY = 'nr.syntheticsInitiator'
|
36
|
+
SYNTHETICS_KEY_PREFIX = 'nr.synthetics'
|
37
|
+
PRIORITY_KEY = 'priority'.freeze
|
38
|
+
SPAN_ID_KEY = 'spanId'.freeze
|
39
|
+
|
40
|
+
SYNTHETICS_PAYLOAD_EXPECTED = [:synthetics_resource_id, :synthetics_job_id, :synthetics_monitor_id, :synthetics_type, :synthetics_initiator]
|
36
41
|
|
37
42
|
def create(noticed_error, payload, span_id)
|
38
43
|
[
|
@@ -71,9 +76,20 @@ module NewRelic
|
|
71
76
|
end
|
72
77
|
|
73
78
|
def append_synthetics(payload, sample)
|
79
|
+
return unless payload[:synthetics_job_id]
|
80
|
+
|
74
81
|
sample[SYNTHETICS_RESOURCE_ID_KEY] = payload[:synthetics_resource_id] if payload[:synthetics_resource_id]
|
75
82
|
sample[SYNTHETICS_JOB_ID_KEY] = payload[:synthetics_job_id] if payload[:synthetics_job_id]
|
76
83
|
sample[SYNTHETICS_MONITOR_ID_KEY] = payload[:synthetics_monitor_id] if payload[:synthetics_monitor_id]
|
84
|
+
sample[SYNTHETICS_TYPE_KEY] = payload[:synthetics_type] if payload[:synthetics_type]
|
85
|
+
sample[SYNTHETICS_INITIATOR_KEY] = payload[:synthetics_initiator] if payload[:synthetics_initiator]
|
86
|
+
|
87
|
+
payload.each do |k, v|
|
88
|
+
next unless k.to_s.start_with?('synthetics_') && !SYNTHETICS_PAYLOAD_EXPECTED.include?(k)
|
89
|
+
|
90
|
+
new_key = SYNTHETICS_KEY_PREFIX + NewRelic::LanguageSupport.camelize(k.to_s.gsub('synthetics_', ''))
|
91
|
+
sample[new_key] = v
|
92
|
+
end
|
77
93
|
end
|
78
94
|
|
79
95
|
def append_cat(payload, sample)
|
@@ -18,7 +18,7 @@ module NewRelic
|
|
18
18
|
|
19
19
|
def record(priority: nil, event: nil, &blk)
|
20
20
|
unless event || priority && blk
|
21
|
-
raise ArgumentError,
|
21
|
+
raise ArgumentError, 'Expected priority and block, or event'
|
22
22
|
end
|
23
23
|
|
24
24
|
return unless enabled?
|
@@ -38,7 +38,7 @@ module NewRelic
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def record_sampling_rate(metadata) # THREAD_LOCAL_ACCESS
|
41
|
-
NewRelic::Agent.logger.debug(
|
41
|
+
NewRelic::Agent.logger.debug('Sampled %d / %d (%.1f %%) requests this cycle, %d / %d (%.1f %%) since startup' % [
|
42
42
|
metadata[:captured],
|
43
43
|
metadata[:seen],
|
44
44
|
(metadata[:captured].to_f / metadata[:seen] * 100.0),
|
@@ -48,8 +48,8 @@ module NewRelic
|
|
48
48
|
])
|
49
49
|
|
50
50
|
engine = NewRelic::Agent.instance.stats_engine
|
51
|
-
engine.tl_record_supportability_metric_count(
|
52
|
-
engine.tl_record_supportability_metric_count(
|
51
|
+
engine.tl_record_supportability_metric_count('TransactionEventAggregator/requests', metadata[:seen])
|
52
|
+
engine.tl_record_supportability_metric_count('TransactionEventAggregator/samples', metadata[:captured])
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -35,9 +35,14 @@ module NewRelic
|
|
35
35
|
CAT_REFERRING_PATH_HASH_KEY = 'nr.referringPathHash'
|
36
36
|
CAT_ALTERNATE_PATH_HASHES_KEY = 'nr.alternatePathHashes'
|
37
37
|
APDEX_PERF_ZONE_KEY = 'nr.apdexPerfZone'
|
38
|
-
SYNTHETICS_RESOURCE_ID_KEY =
|
39
|
-
SYNTHETICS_JOB_ID_KEY =
|
40
|
-
SYNTHETICS_MONITOR_ID_KEY =
|
38
|
+
SYNTHETICS_RESOURCE_ID_KEY = 'nr.syntheticsResourceId'
|
39
|
+
SYNTHETICS_JOB_ID_KEY = 'nr.syntheticsJobId'
|
40
|
+
SYNTHETICS_MONITOR_ID_KEY = 'nr.syntheticsMonitorId'
|
41
|
+
SYNTHETICS_TYPE_KEY = 'nr.syntheticsType'
|
42
|
+
SYNTHETICS_INITIATOR_KEY = 'nr.syntheticsInitiator'
|
43
|
+
SYNTHETICS_KEY_PREFIX = 'nr.synthetics'
|
44
|
+
|
45
|
+
SYNTHETICS_PAYLOAD_EXPECTED = [:synthetics_resource_id, :synthetics_job_id, :synthetics_monitor_id, :synthetics_type, :synthetics_initiator]
|
41
46
|
|
42
47
|
def create(payload)
|
43
48
|
intrinsics = {
|
@@ -71,9 +76,23 @@ module NewRelic
|
|
71
76
|
optionally_append(SYNTHETICS_RESOURCE_ID_KEY, :synthetics_resource_id, sample, payload)
|
72
77
|
optionally_append(SYNTHETICS_JOB_ID_KEY, :synthetics_job_id, sample, payload)
|
73
78
|
optionally_append(SYNTHETICS_MONITOR_ID_KEY, :synthetics_monitor_id, sample, payload)
|
79
|
+
optionally_append(SYNTHETICS_TYPE_KEY, :synthetics_type, sample, payload)
|
80
|
+
optionally_append(SYNTHETICS_INITIATOR_KEY, :synthetics_initiator, sample, payload)
|
81
|
+
append_synthetics_info_attributes(sample, payload)
|
74
82
|
append_cat_alternate_path_hashes(sample, payload)
|
75
83
|
end
|
76
84
|
|
85
|
+
def append_synthetics_info_attributes(sample, payload)
|
86
|
+
return unless payload.include?(:synthetics_job_id)
|
87
|
+
|
88
|
+
payload.each do |k, v|
|
89
|
+
next unless k.to_s.start_with?('synthetics_') && !SYNTHETICS_PAYLOAD_EXPECTED.include?(k)
|
90
|
+
|
91
|
+
new_key = SYNTHETICS_KEY_PREFIX + NewRelic::LanguageSupport.camelize(k.to_s.gsub('synthetics_', ''))
|
92
|
+
sample[new_key] = v.to_s
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
77
96
|
def append_cat_alternate_path_hashes(sample, payload)
|
78
97
|
if payload.include?(:cat_alternate_path_hashes)
|
79
98
|
sample[CAT_ALTERNATE_PATH_HASHES_KEY] = payload[:cat_alternate_path_hashes].sort.join(COMMA)
|
@@ -34,13 +34,13 @@ module NewRelic
|
|
34
34
|
threshold = Agent.config[:'transaction_tracer.transaction_threshold']
|
35
35
|
::NewRelic::Agent.logger.debug("Transaction tracing threshold is #{threshold} seconds.")
|
36
36
|
else
|
37
|
-
::NewRelic::Agent.logger.debug(
|
37
|
+
::NewRelic::Agent.logger.debug('Transaction traces will not be sent to the New Relic service.')
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
Agent.config.register_callback(:'transaction_tracer.record_sql') do |config|
|
42
42
|
if config == 'raw'
|
43
|
-
::NewRelic::Agent.logger.warn(
|
43
|
+
::NewRelic::Agent.logger.warn('Agent is configured to send raw SQL to the service')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -81,7 +81,7 @@ module NewRelic
|
|
81
81
|
begin
|
82
82
|
sample.prepare_to_send!
|
83
83
|
rescue => e
|
84
|
-
NewRelic::Agent.logger.error(
|
84
|
+
NewRelic::Agent.logger.error('Failed to prepare transaction trace. Error: ', e)
|
85
85
|
false
|
86
86
|
else
|
87
87
|
true
|
@@ -101,7 +101,8 @@ module NewRelic
|
|
101
101
|
|
102
102
|
def thread_is_alive?(thread_id)
|
103
103
|
thread = thread_by_id(thread_id)
|
104
|
-
|
104
|
+
# needs else branch coverage
|
105
|
+
thread && thread.alive? # rubocop:disable Style/SafeNavigation
|
105
106
|
rescue StandardError
|
106
107
|
false
|
107
108
|
end
|
@@ -144,10 +145,13 @@ module NewRelic
|
|
144
145
|
elapsed
|
145
146
|
end
|
146
147
|
|
148
|
+
# this method has no test coverage
|
147
149
|
def log_missing_elapsed_transaction_time
|
148
|
-
|
150
|
+
# rubocop:disable Style/SafeNavigation
|
151
|
+
transaction_name = transaction_name = Tracer.current_transaction &&
|
149
152
|
Tracer.current_transaction.best_name ||
|
150
|
-
|
153
|
+
'unknown'
|
154
|
+
# rubocop:enable Style/SafeNavigation
|
151
155
|
NewRelic::Agent.logger.warn("Unable to calculate elapsed transaction time for #{transaction_name}")
|
152
156
|
end
|
153
157
|
end
|
@@ -6,9 +6,9 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
module Utilization
|
8
8
|
class Azure < Vendor
|
9
|
-
vendor_name
|
10
|
-
endpoint
|
11
|
-
headers
|
9
|
+
vendor_name 'azure'
|
10
|
+
endpoint 'http://169.254.169.254/metadata/instance/compute?api-version=2017-03-01'
|
11
|
+
headers 'Metadata' => 'true'
|
12
12
|
keys %w[vmId name vmSize location]
|
13
13
|
key_transforms :to_sym
|
14
14
|
end
|
@@ -8,9 +8,9 @@ module NewRelic
|
|
8
8
|
module Agent
|
9
9
|
module Utilization
|
10
10
|
class GCP < Vendor
|
11
|
-
vendor_name
|
12
|
-
endpoint
|
13
|
-
headers
|
11
|
+
vendor_name 'gcp'
|
12
|
+
endpoint 'http://metadata.google.internal/computeMetadata/v1/instance/?recursive=true'
|
13
|
+
headers 'Metadata-Flavor' => 'Google'
|
14
14
|
keys %w[id machineType name zone]
|
15
15
|
key_transforms :to_sym
|
16
16
|
|
@@ -24,10 +24,8 @@ module NewRelic
|
|
24
24
|
body
|
25
25
|
end
|
26
26
|
|
27
|
-
SLASH = '/'.freeze
|
28
|
-
|
29
27
|
def trim_leading(value)
|
30
|
-
value.split(SLASH).last
|
28
|
+
value.split(NewRelic::SLASH).last
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
@@ -75,14 +75,12 @@ module NewRelic
|
|
75
75
|
processed_headers = headers
|
76
76
|
raise if processed_headers.value?(:error)
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
Net::HTTP.
|
81
|
-
|
82
|
-
response = http.request(req)
|
83
|
-
end
|
84
|
-
response
|
78
|
+
response = nil
|
79
|
+
Net::HTTP.start(endpoint.host, endpoint.port, open_timeout: 1, read_timeout: 1) do |http|
|
80
|
+
req = Net::HTTP::Get.new(endpoint, processed_headers)
|
81
|
+
response = http.request(req)
|
85
82
|
end
|
83
|
+
response
|
86
84
|
rescue
|
87
85
|
NewRelic::Agent.logger.debug("#{vendor_name} environment not detected")
|
88
86
|
end
|
@@ -133,7 +131,7 @@ module NewRelic
|
|
133
131
|
|
134
132
|
def valid_chars?(value)
|
135
133
|
value.each_char do |ch|
|
136
|
-
next if ch
|
134
|
+
next if VALID_CHARS.match?(ch)
|
137
135
|
|
138
136
|
code_point = ch[0].ord # this works in Ruby 1.8.7 - 2.1.2
|
139
137
|
next if code_point >= 0x80
|
@@ -82,18 +82,19 @@ module NewRelic
|
|
82
82
|
|
83
83
|
def supports?(key)
|
84
84
|
case key
|
85
|
-
when :gc_runs,
|
85
|
+
when :gc_runs,
|
86
|
+
:total_allocated_object,
|
87
|
+
:heap_live,
|
88
|
+
:heap_free,
|
89
|
+
:thread_count,
|
90
|
+
:major_gc_count,
|
91
|
+
:minor_gc_count,
|
92
|
+
:constant_cache_invalidations
|
86
93
|
true
|
87
94
|
when :gc_total_time
|
88
95
|
NewRelic::LanguageSupport.gc_profiler_enabled?
|
89
|
-
when :major_gc_count
|
90
|
-
RUBY_VERSION >= '2.1.0'
|
91
|
-
when :minor_gc_count
|
92
|
-
RUBY_VERSION >= '2.1.0'
|
93
96
|
when :method_cache_invalidations
|
94
|
-
RUBY_VERSION
|
95
|
-
when :constant_cache_invalidations
|
96
|
-
RUBY_VERSION >= '2.1.0'
|
97
|
+
RUBY_VERSION < '3.0.0'
|
97
98
|
when :constant_cache_misses
|
98
99
|
RUBY_VERSION >= '3.2.0'
|
99
100
|
else
|
@@ -88,7 +88,7 @@ module NewRelic
|
|
88
88
|
raise
|
89
89
|
rescue => e
|
90
90
|
# Don't blow out the stack for anything that hasn't already propagated
|
91
|
-
::NewRelic::Agent.logger.error(
|
91
|
+
::NewRelic::Agent.logger.error('Error running task in Agent Worker Loop:', e)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|