newrelic_rpm 9.1.0 → 9.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.build_ignore +27 -0
- data/CHANGELOG.md +841 -7
- data/CONTRIBUTING.md +2 -9
- data/README.md +25 -22
- data/Rakefile +2 -2
- data/bin/newrelic +3 -9
- data/bin/newrelic_rpm +15 -0
- data/init.rb +2 -2
- data/lib/boot/strap.rb +102 -0
- data/lib/new_relic/agent/agent.rb +11 -2
- data/lib/new_relic/agent/agent_helpers/connect.rb +13 -8
- data/lib/new_relic/agent/agent_helpers/harvest.rb +3 -0
- data/lib/new_relic/agent/agent_helpers/shutdown.rb +4 -1
- data/lib/new_relic/agent/agent_helpers/special_startup.rb +1 -1
- data/lib/new_relic/agent/agent_helpers/start_worker_thread.rb +4 -3
- data/lib/new_relic/agent/agent_helpers/startup.rb +11 -3
- data/lib/new_relic/agent/agent_logger.rb +3 -1
- data/lib/new_relic/agent/attribute_filter.rb +3 -3
- data/lib/new_relic/agent/attribute_pre_filtering.rb +109 -0
- data/lib/new_relic/agent/aws.rb +68 -0
- data/lib/new_relic/agent/configuration/default_source.rb +918 -166
- data/lib/new_relic/agent/configuration/environment_source.rb +15 -3
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -0
- data/lib/new_relic/agent/configuration/manager.rb +72 -11
- data/lib/new_relic/agent/configuration/security_policy_source.rb +11 -0
- data/lib/new_relic/agent/configuration/yaml_source.rb +22 -2
- data/lib/new_relic/agent/connect/request_builder.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +27 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +11 -11
- data/lib/new_relic/agent/database/obfuscator.rb +1 -0
- data/lib/new_relic/agent/database.rb +41 -1
- data/lib/new_relic/agent/database_adapter.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +4 -8
- data/lib/new_relic/agent/distributed_tracing.rb +5 -3
- data/lib/new_relic/agent/error_collector.rb +40 -11
- data/lib/new_relic/agent/event_loop.rb +1 -1
- data/lib/new_relic/agent/external.rb +2 -0
- data/lib/new_relic/agent/harvester.rb +1 -1
- data/lib/new_relic/agent/health_check.rb +136 -0
- data/lib/new_relic/agent/http_clients/abstract.rb +4 -0
- data/lib/new_relic/agent/http_clients/async_http_wrappers.rb +80 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -3
- data/lib/new_relic/agent/http_clients/ethon_wrappers.rb +109 -0
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +0 -3
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +1 -3
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +0 -3
- data/lib/new_relic/agent/http_clients/httpx_wrappers.rb +91 -0
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +1 -4
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +0 -3
- data/lib/new_relic/agent/http_clients/uri_util.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_dispatch.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_dispatch_subscriber.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_mailbox.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_mailer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_job_subscriber.rb +6 -2
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +3 -16
- data/lib/new_relic/agent/instrumentation/active_record.rb +8 -13
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +8 -5
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +13 -10
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +9 -16
- 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 +17 -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 +21 -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 -3
- 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 +27 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_firehose.rb +22 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/instrumentation.rb +91 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_kinesis.rb +22 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/chain.rb +33 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/instrumentation.rb +93 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda/prepend.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sdk_lambda.rb +23 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/chain.rb +37 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs/prepend.rb +21 -0
- data/lib/new_relic/agent/instrumentation/aws_sqs.rb +23 -0
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +23 -0
- data/lib/new_relic/agent/instrumentation/bunny.rb +4 -5
- 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/concurrent_ruby.rb +2 -3
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +5 -2
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/curb.rb +4 -5
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +3 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +0 -23
- data/lib/new_relic/agent/instrumentation/dynamodb/chain.rb +27 -0
- data/lib/new_relic/agent/instrumentation/dynamodb/instrumentation.rb +64 -0
- data/lib/new_relic/agent/instrumentation/dynamodb/prepend.rb +19 -0
- data/lib/new_relic/agent/instrumentation/dynamodb.rb +23 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +65 -10
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +2 -4
- 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 +35 -0
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -0
- data/lib/new_relic/agent/instrumentation/excon.rb +1 -17
- data/lib/new_relic/agent/instrumentation/fiber/chain.rb +11 -4
- data/lib/new_relic/agent/instrumentation/fiber/instrumentation.rb +2 -6
- data/lib/new_relic/agent/instrumentation/fiber/prepend.rb +10 -3
- data/lib/new_relic/agent/instrumentation/fiber.rb +1 -3
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +4 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +5 -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 +5 -1
- 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/httpclient.rb +1 -5
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/httprb.rb +0 -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 +23 -0
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +3 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -3
- data/lib/new_relic/agent/instrumentation/logstasher/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/logstasher/instrumentation.rb +24 -0
- data/lib/new_relic/agent/instrumentation/logstasher/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/logstasher.rb +25 -0
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +4 -2
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +13 -4
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +4 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +4 -5
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +3 -5
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +13 -3
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +4 -2
- data/lib/new_relic/agent/instrumentation/opensearch/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/opensearch/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/opensearch/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/opensearch.rb +23 -0
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -3
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +9 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +4 -0
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +10 -5
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -2
- data/lib/new_relic/agent/instrumentation/rdkafka/chain.rb +72 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/instrumentation.rb +70 -0
- data/lib/new_relic/agent/instrumentation/rdkafka/prepend.rb +67 -0
- data/lib/new_relic/agent/instrumentation/rdkafka.rb +25 -0
- data/lib/new_relic/agent/instrumentation/redis/cluster_middleware.rb +26 -0
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +2 -2
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +18 -11
- data/lib/new_relic/agent/instrumentation/redis/middleware.rb +3 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +11 -5
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +8 -6
- 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/ruby_kafka/chain.rb +55 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/instrumentation.rb +67 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb +60 -0
- data/lib/new_relic/agent/instrumentation/ruby_kafka.rb +25 -0
- data/lib/new_relic/agent/instrumentation/ruby_openai/chain.rb +36 -0
- data/lib/new_relic/agent/instrumentation/ruby_openai/instrumentation.rb +196 -0
- data/lib/new_relic/agent/instrumentation/ruby_openai/prepend.rb +20 -0
- data/lib/new_relic/agent/instrumentation/ruby_openai.rb +35 -0
- data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +4 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delay_extensions.rb +24 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +26 -3
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +13 -16
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -3
- data/lib/new_relic/agent/instrumentation/sinatra.rb +3 -19
- data/lib/new_relic/agent/instrumentation/stripe.rb +28 -0
- data/lib/new_relic/agent/instrumentation/stripe_subscriber.rb +98 -0
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -5
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread.rb +0 -2
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +4 -0
- data/lib/new_relic/agent/instrumentation/tilt.rb +0 -4
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +7 -3
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +0 -1
- data/lib/new_relic/agent/instrumentation/view_component/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/view_component/instrumentation.rb +45 -0
- data/lib/{tasks/instrumentation_generator/templates/instrumentation.tt → new_relic/agent/instrumentation/view_component/prepend.rb} +4 -4
- data/lib/new_relic/agent/instrumentation/view_component.rb +24 -0
- data/lib/new_relic/agent/javascript_instrumentor.rb +2 -4
- data/lib/new_relic/agent/llm/chat_completion_message.rb +25 -0
- data/lib/new_relic/agent/llm/chat_completion_summary.rb +66 -0
- data/lib/new_relic/agent/llm/embedding.rb +60 -0
- data/lib/new_relic/agent/llm/llm_event.rb +95 -0
- data/lib/new_relic/agent/llm/response_headers.rb +80 -0
- data/lib/new_relic/agent/llm.rb +49 -0
- data/lib/new_relic/agent/local_log_decorator.rb +20 -3
- data/lib/new_relic/agent/log_event_aggregator.rb +149 -26
- data/lib/new_relic/agent/log_event_attributes.rb +115 -0
- data/lib/new_relic/agent/logging.rb +5 -5
- data/lib/new_relic/agent/messaging.rb +18 -7
- data/lib/new_relic/agent/method_tracer.rb +4 -1
- data/lib/new_relic/agent/method_tracer_helpers.rb +26 -5
- data/lib/new_relic/agent/monitors/inbound_request_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 +2 -2
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +2 -2
- data/lib/new_relic/agent/new_relic_service.rb +61 -28
- data/lib/new_relic/agent/obfuscator.rb +0 -2
- data/lib/new_relic/agent/opentelemetry/context/propagation/trace_propagator.rb +66 -0
- data/lib/new_relic/agent/opentelemetry/context/propagation.rb +15 -0
- data/lib/{tasks/instrumentation_generator/templates/Envfile.tt → new_relic/agent/opentelemetry/context.rb} +9 -5
- data/lib/new_relic/agent/opentelemetry/trace/span.rb +31 -0
- data/lib/new_relic/agent/opentelemetry/trace/tracer.rb +129 -0
- data/lib/new_relic/agent/opentelemetry/trace/tracer_provider.rb +18 -0
- data/lib/new_relic/agent/opentelemetry/trace.rb +15 -0
- data/lib/new_relic/agent/opentelemetry/transaction_patch.rb +69 -0
- data/lib/new_relic/agent/opentelemetry_bridge.rb +32 -0
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +2 -2
- data/lib/new_relic/agent/pipe_service.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -2
- data/lib/new_relic/agent/rules_engine.rb +1 -1
- data/lib/new_relic/agent/sampler.rb +1 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +1 -1
- data/lib/new_relic/agent/serverless_handler.rb +406 -0
- data/lib/new_relic/agent/serverless_handler_event_sources.json +155 -0
- data/lib/new_relic/agent/serverless_handler_event_sources.rb +49 -0
- data/lib/new_relic/agent/span_event_primitive.rb +32 -15
- data/lib/new_relic/agent/sql_sampler.rb +0 -1
- data/lib/new_relic/agent/system_info.rb +40 -0
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -2
- data/lib/new_relic/agent/threading/backtrace_node.rb +10 -1
- data/lib/new_relic/agent/tracer.rb +16 -16
- data/lib/new_relic/agent/transaction/abstract_segment.rb +103 -41
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +3 -3
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +7 -8
- data/lib/new_relic/agent/transaction/external_request_segment.rb +5 -12
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -3
- data/lib/new_relic/agent/transaction/request_attributes.rb +54 -11
- data/lib/new_relic/agent/transaction/trace_context.rb +34 -5
- data/lib/new_relic/agent/transaction/tracing.rb +20 -4
- data/lib/new_relic/agent/transaction.rb +38 -13
- data/lib/new_relic/agent/transaction_error_primitive.rb +39 -19
- data/lib/new_relic/agent/transaction_event_primitive.rb +19 -0
- data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
- data/lib/new_relic/agent/utilization/ecs.rb +22 -0
- data/lib/new_relic/agent/utilization/ecs_v4.rb +22 -0
- data/lib/new_relic/agent/utilization/gcp.rb +1 -3
- data/lib/new_relic/agent/utilization/vendor.rb +5 -7
- data/lib/new_relic/agent/utilization_data.rb +40 -5
- data/lib/new_relic/agent/vm/{mri_vm.rb → c_ruby_vm.rb} +10 -18
- data/lib/new_relic/agent/vm.rb +2 -2
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +286 -17
- data/lib/new_relic/base64.rb +25 -0
- data/lib/new_relic/cli/command.rb +6 -3
- data/lib/new_relic/constants.rb +8 -0
- data/lib/new_relic/control/class_methods.rb +1 -7
- data/lib/new_relic/control/frameworks/grape.rb +14 -0
- data/lib/new_relic/control/frameworks/padrino.rb +14 -0
- data/lib/new_relic/control/frameworks/rails.rb +17 -5
- data/lib/new_relic/control/frameworks/rails4.rb +1 -3
- data/lib/new_relic/control/frameworks/roda.rb +20 -0
- data/lib/new_relic/control/instance_methods.rb +13 -0
- data/lib/new_relic/control/instrumentation.rb +2 -16
- data/lib/new_relic/control/private_instance_methods.rb +4 -0
- data/lib/new_relic/control/security_interface.rb +57 -0
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +25 -13
- data/lib/new_relic/environment_report.rb +2 -2
- data/lib/new_relic/helper.rb +22 -0
- data/lib/new_relic/language_support.rb +12 -1
- data/lib/new_relic/latest_changes.rb +1 -1
- data/lib/new_relic/local_environment.rb +31 -18
- data/lib/new_relic/noticed_error.rb +5 -2
- 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 +29 -13
- data/lib/new_relic/supportability_helper.rb +5 -1
- data/lib/new_relic/thread_local_storage.rb +31 -0
- data/lib/new_relic/traced_thread.rb +2 -3
- data/lib/new_relic/version.rb +1 -1
- data/lib/sequel/extensions/new_relic_instrumentation.rb +4 -3
- data/lib/tasks/bump_version.rake +21 -0
- data/lib/tasks/config.rake +11 -5
- data/lib/tasks/coverage_report.rake +1 -1
- data/lib/tasks/gha.rake +31 -0
- data/lib/tasks/helpers/config.html.erb +94 -0
- data/lib/tasks/helpers/format.rb +11 -7
- data/lib/tasks/helpers/newrelicyml.rb +211 -0
- data/lib/tasks/helpers/version_bump.rb +62 -0
- data/lib/tasks/newrelic.rb +1 -0
- data/lib/tasks/newrelicyml.rake +13 -0
- data/lib/tasks/tests.rake +71 -0
- data/newrelic.yml +657 -251
- data/newrelic_rpm.gemspec +17 -10
- data/test/agent_helper.rb +38 -4
- metadata +230 -44
- data/.gitignore +0 -43
- data/.project +0 -23
- data/.rubocop.yml +0 -1909
- data/.rubocop_todo.yml +0 -61
- 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/bin/newrelic_cmd +0 -6
- 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/range_extensions.rb +0 -27
- data/lib/tasks/helpers/removers.rb +0 -33
- data/lib/tasks/instrumentation_generator/README.md +0 -63
- data/lib/tasks/instrumentation_generator/TODO.md +0 -33
- data/lib/tasks/instrumentation_generator/instrumentation.thor +0 -121
- data/lib/tasks/instrumentation_generator/templates/chain.tt +0 -22
- data/lib/tasks/instrumentation_generator/templates/chain_method.tt +0 -8
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +0 -29
- data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +0 -3
- data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +0 -19
- data/lib/tasks/instrumentation_generator/templates/prepend.tt +0 -13
- data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +0 -3
- data/lib/tasks/instrumentation_generator/templates/test.tt +0 -15
- data/lib/tasks/multiverse.rake +0 -6
- data/lib/tasks/multiverse.rb +0 -83
|
@@ -60,10 +60,13 @@ module NewRelic
|
|
|
60
60
|
extra = []
|
|
61
61
|
options = ARGV.options do |opts|
|
|
62
62
|
script_name = File.basename($0)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
# TODO: MAJOR VERSION - remove newrelic, deprecated since version x.xx
|
|
65
|
+
if /newrelic$/.match?(script_name)
|
|
66
|
+
$stdout.puts "warning: the 'newrelic' script has been renamed 'newrelic_rpm'"
|
|
67
|
+
script_name = 'newrelic_rpm'
|
|
66
68
|
end
|
|
69
|
+
|
|
67
70
|
opts.banner = "Usage: #{script_name} [ #{@command_names.join(' | ')} ] [options]"
|
|
68
71
|
opts.separator("use '#{script_name} <command> -h' to see detailed command options")
|
|
69
72
|
opts
|
data/lib/new_relic/constants.rb
CHANGED
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
# frozen_string_literal: true
|
|
4
4
|
|
|
5
5
|
module NewRelic
|
|
6
|
+
ASTERISK = '*'
|
|
7
|
+
|
|
6
8
|
PRIORITY_PRECISION = 6
|
|
7
9
|
|
|
8
10
|
EMPTY_ARRAY = [].freeze
|
|
9
11
|
EMPTY_HASH = {}.freeze
|
|
10
12
|
EMPTY_STR = ''
|
|
11
13
|
|
|
14
|
+
LANGUAGE = 'ruby'
|
|
15
|
+
|
|
12
16
|
HTTP = 'HTTP'
|
|
13
17
|
HTTPS = 'HTTPS'
|
|
14
18
|
UNKNOWN = 'Unknown'
|
|
19
|
+
UNKNOWN_LOWER = 'unknown'
|
|
15
20
|
|
|
16
21
|
FORMAT_NON_RACK = 0
|
|
17
22
|
FORMAT_RACK = 1
|
|
@@ -35,4 +40,7 @@ module NewRelic
|
|
|
35
40
|
|
|
36
41
|
CONNECT_RETRY_PERIODS = [15, 15, 30, 60, 120, 300]
|
|
37
42
|
MAX_RETRY_PERIOD = 300
|
|
43
|
+
|
|
44
|
+
SLASH = '/'
|
|
45
|
+
ROOT = SLASH
|
|
38
46
|
end
|
|
@@ -49,19 +49,13 @@ module NewRelic
|
|
|
49
49
|
# maybe it is already loaded by some external system
|
|
50
50
|
# i.e. rpm_contrib or user extensions?
|
|
51
51
|
end
|
|
52
|
-
NewRelic::Control::Frameworks.const_get(camelize(framework.to_s))
|
|
52
|
+
NewRelic::Control::Frameworks.const_get(NewRelic::LanguageSupport.camelize(framework.to_s))
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
# The root directory for the plugin or gem
|
|
56
56
|
def newrelic_root
|
|
57
57
|
File.expand_path(File.join('..', '..', '..', '..'), __FILE__)
|
|
58
58
|
end
|
|
59
|
-
|
|
60
|
-
def camelize(snake_case_name)
|
|
61
|
-
snake_case_name.gsub(/(\_|^)[a-z]/) do |substring|
|
|
62
|
-
substring[-1].capitalize!
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
59
|
end
|
|
66
60
|
extend ClassMethods
|
|
67
61
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require 'new_relic/control/frameworks/ruby'
|
|
6
|
+
module NewRelic
|
|
7
|
+
class Control
|
|
8
|
+
module Frameworks
|
|
9
|
+
# Contains basic control logic for Grape
|
|
10
|
+
class Grape < NewRelic::Control::Frameworks::Ruby
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require 'new_relic/control/frameworks/sinatra'
|
|
6
|
+
module NewRelic
|
|
7
|
+
class Control
|
|
8
|
+
module Frameworks
|
|
9
|
+
# Contains basic control logic for Padrino
|
|
10
|
+
class Padrino < NewRelic::Control::Frameworks::Sinatra
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -10,6 +10,9 @@ module NewRelic
|
|
|
10
10
|
# Rails specific configuration, instrumentation, environment values,
|
|
11
11
|
# etc.
|
|
12
12
|
class Rails < NewRelic::Control::Frameworks::Ruby
|
|
13
|
+
BROWSER_MONITORING_INSTALLED_SINGLETON = NewRelic::Agent.config
|
|
14
|
+
BROWSER_MONITORING_INSTALLED_VARIABLE = :@browser_monitoring_installed
|
|
15
|
+
|
|
13
16
|
def env
|
|
14
17
|
@env ||= (ENV['NEW_RELIC_ENV'] || RAILS_ENV.dup)
|
|
15
18
|
end
|
|
@@ -71,7 +74,7 @@ module NewRelic
|
|
|
71
74
|
# Might not be running if it does not think mongrel, thin,
|
|
72
75
|
# passenger, etc. is running, if it thinks it's a rake task, or
|
|
73
76
|
# if the agent_enabled is false.
|
|
74
|
-
::NewRelic::Agent.logger.info('New Relic
|
|
77
|
+
::NewRelic::Agent.logger.info('New Relic agent not running. Skipping browser monitoring and agent hooks.')
|
|
75
78
|
else
|
|
76
79
|
install_browser_monitoring(rails_config)
|
|
77
80
|
install_agent_hooks(rails_config)
|
|
@@ -89,17 +92,17 @@ module NewRelic
|
|
|
89
92
|
return unless NewRelic::Rack::AgentHooks.needed?
|
|
90
93
|
|
|
91
94
|
config.middleware.use(NewRelic::Rack::AgentHooks)
|
|
92
|
-
::NewRelic::Agent.logger.debug('Installed New Relic
|
|
95
|
+
::NewRelic::Agent.logger.debug('Installed New Relic agent hooks middleware')
|
|
93
96
|
rescue => e
|
|
94
|
-
::NewRelic::Agent.logger.warn('Error installing New Relic
|
|
97
|
+
::NewRelic::Agent.logger.warn('Error installing New Relic agent hooks middleware', e)
|
|
95
98
|
end
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
def install_browser_monitoring(config)
|
|
99
102
|
@install_lock.synchronize do
|
|
100
|
-
return if
|
|
103
|
+
return if browser_agent_already_installed?
|
|
101
104
|
|
|
102
|
-
|
|
105
|
+
mark_browser_agent_as_installed
|
|
103
106
|
return if config.nil? || !config.respond_to?(:middleware) || !Agent.config[:'browser_monitoring.auto_instrument']
|
|
104
107
|
|
|
105
108
|
begin
|
|
@@ -112,6 +115,15 @@ module NewRelic
|
|
|
112
115
|
end
|
|
113
116
|
end
|
|
114
117
|
|
|
118
|
+
def browser_agent_already_installed?
|
|
119
|
+
BROWSER_MONITORING_INSTALLED_SINGLETON.instance_variable_defined?(BROWSER_MONITORING_INSTALLED_VARIABLE) &&
|
|
120
|
+
BROWSER_MONITORING_INSTALLED_SINGLETON.instance_variable_get(BROWSER_MONITORING_INSTALLED_VARIABLE)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def mark_browser_agent_as_installed
|
|
124
|
+
BROWSER_MONITORING_INSTALLED_SINGLETON.instance_variable_set(BROWSER_MONITORING_INSTALLED_VARIABLE, true)
|
|
125
|
+
end
|
|
126
|
+
|
|
115
127
|
def rails_version
|
|
116
128
|
@rails_version ||= Gem::Version.new(::Rails::VERSION::STRING)
|
|
117
129
|
end
|
|
@@ -9,9 +9,7 @@ module NewRelic
|
|
|
9
9
|
module Frameworks
|
|
10
10
|
class Rails4 < NewRelic::Control::Frameworks::Rails3
|
|
11
11
|
def rails_gem_list
|
|
12
|
-
|
|
13
|
-
"#{gem.name} (#{gem.version})"
|
|
14
|
-
end
|
|
12
|
+
NewRelic::Helper.rubygems_specs.map { |gem| "#{gem.name} (#{gem.version})" }
|
|
15
13
|
end
|
|
16
14
|
|
|
17
15
|
def append_plugin_list
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require 'new_relic/control/frameworks/ruby'
|
|
6
|
+
module NewRelic
|
|
7
|
+
class Control
|
|
8
|
+
module Frameworks
|
|
9
|
+
# Contains basic control logic for Roda
|
|
10
|
+
class Roda < NewRelic::Control::Frameworks::Ruby
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
def install_shim
|
|
14
|
+
super
|
|
15
|
+
::Roda.class_eval { include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -73,9 +73,12 @@ module NewRelic
|
|
|
73
73
|
init_config(options)
|
|
74
74
|
NewRelic::Agent.agent = NewRelic::Agent::Agent.instance
|
|
75
75
|
init_instrumentation
|
|
76
|
+
init_security_agent
|
|
77
|
+
report_agent_version_metric
|
|
76
78
|
end
|
|
77
79
|
|
|
78
80
|
def determine_env(options)
|
|
81
|
+
options[:env] = :serverless if local_env.discovered_dispatcher == :serverless
|
|
79
82
|
env = options[:env] || self.env
|
|
80
83
|
env = env.to_s
|
|
81
84
|
|
|
@@ -95,6 +98,12 @@ module NewRelic
|
|
|
95
98
|
def configure_agent(env, options)
|
|
96
99
|
manual = Agent::Configuration::ManualSource.new(options)
|
|
97
100
|
Agent.config.replace_or_add_config(manual)
|
|
101
|
+
|
|
102
|
+
# if manual config sees serverless mode enabled, then the proc
|
|
103
|
+
# must have returned 'true'. don't bother with YAML and high security
|
|
104
|
+
# in a serverless context
|
|
105
|
+
return if Agent.config[:'serverless_mode.enabled']
|
|
106
|
+
|
|
98
107
|
yaml_source = Agent::Configuration::YamlSource.new(config_file_path, env)
|
|
99
108
|
log_yaml_source_failures(yaml_source) if yaml_source.failed?
|
|
100
109
|
Agent.config.replace_or_add_config(yaml_source)
|
|
@@ -163,6 +172,10 @@ module NewRelic
|
|
|
163
172
|
def stdout
|
|
164
173
|
STDOUT
|
|
165
174
|
end
|
|
175
|
+
|
|
176
|
+
def report_agent_version_metric
|
|
177
|
+
NewRelic::Agent.record_metric_once("Supportability/AgentVersion/newrelic_rpm/#{NewRelic::VERSION::STRING}")
|
|
178
|
+
end
|
|
166
179
|
end
|
|
167
180
|
include InstanceMethods
|
|
168
181
|
end
|
|
@@ -62,16 +62,15 @@ module NewRelic
|
|
|
62
62
|
File.join(instrumentation_path, app.to_s, '*.rb')
|
|
63
63
|
@instrumentation_files.each { |pattern| load_instrumentation_files(pattern) }
|
|
64
64
|
DependencyDetection.detect!
|
|
65
|
-
ruby_deprecation
|
|
66
65
|
rails_32_deprecation
|
|
67
66
|
::NewRelic::Agent.logger.info('Finished instrumentation')
|
|
68
67
|
end
|
|
69
68
|
end
|
|
70
69
|
|
|
71
70
|
def rails_32_deprecation
|
|
72
|
-
return unless defined?(Rails::VERSION) &&
|
|
71
|
+
return unless defined?(Rails::VERSION) && NewRelic::Helper.version_satisfied?(Rails::VERSION::STRING, '<=', '3.2')
|
|
73
72
|
|
|
74
|
-
deprecation_msg = 'The Ruby
|
|
73
|
+
deprecation_msg = 'The Ruby agent is dropping support for Rails 3.2 ' \
|
|
75
74
|
'in a future major release. Please upgrade your Rails version to continue receiving support. ' \
|
|
76
75
|
|
|
77
76
|
Agent.logger.log_once(
|
|
@@ -81,19 +80,6 @@ module NewRelic
|
|
|
81
80
|
)
|
|
82
81
|
end
|
|
83
82
|
|
|
84
|
-
def ruby_deprecation
|
|
85
|
-
return unless RUBY_VERSION < '2.4.0'
|
|
86
|
-
|
|
87
|
-
deprecation_msg = 'The Ruby Agent is dropping support for Rubies below 2.4 ' \
|
|
88
|
-
'in version 9.0.0. Please upgrade your Ruby version to continue receiving support. ' \
|
|
89
|
-
|
|
90
|
-
::NewRelic::Agent.logger.log_once(
|
|
91
|
-
:warn,
|
|
92
|
-
:deprecated_ruby_version,
|
|
93
|
-
deprecation_msg
|
|
94
|
-
)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
83
|
include Instrumentation
|
|
98
84
|
end
|
|
99
85
|
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# This file is distributed under New Relic's license terms.
|
|
2
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require 'singleton'
|
|
6
|
+
|
|
7
|
+
module NewRelic
|
|
8
|
+
class Control
|
|
9
|
+
class SecurityInterface
|
|
10
|
+
include Singleton
|
|
11
|
+
|
|
12
|
+
attr_accessor :wait
|
|
13
|
+
|
|
14
|
+
SUPPORTABILITY_PREFIX_SECURITY = 'Supportability/Ruby/SecurityAgent/Enabled/'
|
|
15
|
+
SUPPORTABILITY_PREFIX_SECURITY_AGENT = 'Supportability/Ruby/SecurityAgent/Agent/Enabled/'
|
|
16
|
+
ENABLED = 'enabled'
|
|
17
|
+
DISABLED = 'disabled'
|
|
18
|
+
|
|
19
|
+
def agent_started?
|
|
20
|
+
(@agent_started ||= false) == true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def waiting?
|
|
24
|
+
(@wait ||= false) == true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def init_agent
|
|
28
|
+
return if agent_started? || waiting?
|
|
29
|
+
|
|
30
|
+
record_supportability_metrics
|
|
31
|
+
|
|
32
|
+
if Agent.config[:'security.agent.enabled'] && !Agent.config[:high_security]
|
|
33
|
+
Agent.logger.info('Invoking New Relic security module')
|
|
34
|
+
require 'newrelic_security'
|
|
35
|
+
|
|
36
|
+
@agent_started = true
|
|
37
|
+
else
|
|
38
|
+
Agent.logger.info('New Relic Security is completely disabled by one of the user-provided configurations: `security.agent.enabled` or `high_security`. Not loading security capabilities.')
|
|
39
|
+
Agent.logger.info("high_security = #{Agent.config[:high_security]}")
|
|
40
|
+
Agent.logger.info("security.agent.enabled = #{Agent.config[:'security.agent.enabled']}")
|
|
41
|
+
end
|
|
42
|
+
rescue LoadError
|
|
43
|
+
Agent.logger.info('New Relic security agent not found - skipping')
|
|
44
|
+
rescue StandardError => exception
|
|
45
|
+
Agent.logger.error("Exception in New Relic security module loading: #{exception} #{exception.backtrace}")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def record_supportability_metrics
|
|
49
|
+
Agent.config[:'security.agent.enabled'] ? security_agent_metric(ENABLED) : security_agent_metric(DISABLED)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def security_agent_metric(setting)
|
|
53
|
+
NewRelic::Agent.record_metric_once(SUPPORTABILITY_PREFIX_SECURITY_AGENT + setting)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/new_relic/control.rb
CHANGED
|
@@ -8,7 +8,6 @@ require 'new_relic/local_environment'
|
|
|
8
8
|
require 'new_relic/language_support'
|
|
9
9
|
require 'new_relic/helper'
|
|
10
10
|
|
|
11
|
-
require 'singleton'
|
|
12
11
|
require 'erb'
|
|
13
12
|
require 'socket'
|
|
14
13
|
require 'net/https'
|
|
@@ -18,6 +17,7 @@ require 'new_relic/control/server_methods'
|
|
|
18
17
|
require 'new_relic/control/instrumentation'
|
|
19
18
|
require 'new_relic/control/class_methods'
|
|
20
19
|
require 'new_relic/control/instance_methods'
|
|
20
|
+
require 'new_relic/control/security_interface'
|
|
21
21
|
|
|
22
22
|
require 'new_relic/agent'
|
|
23
23
|
require 'new_relic/delayed_job_injection'
|
|
@@ -25,9 +25,9 @@ module DependencyDetection
|
|
|
25
25
|
|
|
26
26
|
def detect!
|
|
27
27
|
@items.each do |item|
|
|
28
|
-
if item.
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
next if item.executed || item.disabled_configured?
|
|
29
|
+
|
|
30
|
+
item.dependencies_satisfied? ? item.execute : item.configure_as_unsatisfied
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -62,6 +62,17 @@ module DependencyDetection
|
|
|
62
62
|
!executed and check_dependencies
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
def configure_as_unsatisfied
|
|
66
|
+
# TODO: currently using :unsatisfied for Padrino will clobber the value
|
|
67
|
+
# already set for Sinatra, so skip Padrino and circle back with a
|
|
68
|
+
# new Padrino specific solution in the future.
|
|
69
|
+
#
|
|
70
|
+
# https://github.com/newrelic/newrelic-ruby-agent/issues/2912
|
|
71
|
+
return if name == :padrino
|
|
72
|
+
|
|
73
|
+
NewRelic::Agent.config.instance_variable_get(:@cache)[config_key] = :unsatisfied
|
|
74
|
+
end
|
|
75
|
+
|
|
65
76
|
def source_location_for(klass, method_name)
|
|
66
77
|
Object.instance_method(:method).bind(klass.allocate).call(method_name).source_location.to_s
|
|
67
78
|
end
|
|
@@ -133,8 +144,6 @@ module DependencyDetection
|
|
|
133
144
|
!(disabled_configured? || deprecated_disabled_configured?)
|
|
134
145
|
end
|
|
135
146
|
|
|
136
|
-
# TODO: MAJOR VERSION
|
|
137
|
-
# will only return true if a disabled key is found and is truthy
|
|
138
147
|
def deprecated_disabled_configured?
|
|
139
148
|
return false if self.name.nil?
|
|
140
149
|
|
|
@@ -142,12 +151,7 @@ module DependencyDetection
|
|
|
142
151
|
return false unless ::NewRelic::Agent.config[key] == true
|
|
143
152
|
|
|
144
153
|
::NewRelic::Agent.logger.debug("Not installing #{self.name} instrumentation because of configuration #{key}")
|
|
145
|
-
|
|
146
|
-
"[DEPRECATED] configuration #{key} for #{self.name} will be removed in the next major release. " \
|
|
147
|
-
"Use `#{config_key}` with one of `#{VALID_CONFIG_VALUES.map(&:to_s).inspect}`"
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
return true
|
|
154
|
+
true
|
|
151
155
|
end
|
|
152
156
|
|
|
153
157
|
def config_key
|
|
@@ -175,10 +179,18 @@ module DependencyDetection
|
|
|
175
179
|
# logs the resolved value during debug mode.
|
|
176
180
|
def fetch_config_value(key)
|
|
177
181
|
valid_value = valid_config_value(::NewRelic::Agent.config[key].to_s.to_sym)
|
|
178
|
-
::NewRelic::Agent.logger.debug("Using #{valid_value} configuration value for #{self.name} to configure instrumentation")
|
|
179
182
|
return valid_value
|
|
180
183
|
end
|
|
181
184
|
|
|
185
|
+
# update any :auto config value to be either :prepend or :chain after auto
|
|
186
|
+
# determination has selected one of those to use
|
|
187
|
+
def update_config_value(use_prepend)
|
|
188
|
+
if config_key && auto_configured?
|
|
189
|
+
NewRelic::Agent.config.instance_variable_get(:@cache)[config_key] = use_prepend ? :prepend : :chain
|
|
190
|
+
end
|
|
191
|
+
use_prepend
|
|
192
|
+
end
|
|
193
|
+
|
|
182
194
|
def config_value
|
|
183
195
|
return AUTO_CONFIG_VALUE unless config_key
|
|
184
196
|
|
|
@@ -202,7 +214,7 @@ module DependencyDetection
|
|
|
202
214
|
end
|
|
203
215
|
|
|
204
216
|
def use_prepend?
|
|
205
|
-
prepend_configured? || (auto_configured? && !prepend_conflicts?)
|
|
217
|
+
update_config_value(prepend_configured? || (auto_configured? && !prepend_conflicts?))
|
|
206
218
|
end
|
|
207
219
|
|
|
208
220
|
def prepend_conflicts?
|
|
@@ -44,7 +44,7 @@ module NewRelic
|
|
|
44
44
|
####################################
|
|
45
45
|
report_on('Gems') do
|
|
46
46
|
begin
|
|
47
|
-
|
|
47
|
+
NewRelic::Helper.rubygems_specs.map { |gem| "#{gem.name}(#{gem.version})" }
|
|
48
48
|
rescue
|
|
49
49
|
# There are certain rubygem, bundler, rails combinations (e.g. gem
|
|
50
50
|
# 1.6.2, rails 2.3, bundler 1.2.3) where the code above throws an error
|
|
@@ -67,7 +67,7 @@ module NewRelic
|
|
|
67
67
|
report_on('Physical Cores') { ::NewRelic::Agent::SystemInfo.num_physical_cores }
|
|
68
68
|
report_on('Arch') { ::NewRelic::Agent::SystemInfo.processor_arch }
|
|
69
69
|
report_on('OS version') { ::NewRelic::Agent::SystemInfo.os_version }
|
|
70
|
-
report_on('OS') { ::NewRelic::Agent::SystemInfo.
|
|
70
|
+
report_on('OS') { ::NewRelic::Agent::SystemInfo.os_distribution }
|
|
71
71
|
report_on('Database adapter') { ::NewRelic::Agent::DatabaseAdapter.value }
|
|
72
72
|
report_on('Framework') { Agent.config[:framework].to_s }
|
|
73
73
|
report_on('Dispatcher') { Agent.config[:dispatcher].to_s }
|
data/lib/new_relic/helper.rb
CHANGED
|
@@ -82,5 +82,27 @@ module NewRelic
|
|
|
82
82
|
File.exist?(executable_path) && File.file?(executable_path) && File.executable?(executable_path)
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
|
+
|
|
86
|
+
def version_satisfied?(left, operator, right)
|
|
87
|
+
left = Gem::Version.new(left) unless left.is_a?(Gem::Version)
|
|
88
|
+
right = Gem::Version.new(right) unless right.is_a?(Gem::Version)
|
|
89
|
+
|
|
90
|
+
left.public_send(operator, right)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Bundler version 2.5.12 deprecated all_specs and added installed_specs.
|
|
94
|
+
# To support newer Bundler versions, try to use installed_specs first,
|
|
95
|
+
# then fall back to all_specs.
|
|
96
|
+
# All callers expect this to be an array, so return an array if Bundler isn't defined
|
|
97
|
+
# @api private
|
|
98
|
+
def rubygems_specs
|
|
99
|
+
return [] unless defined?(Bundler)
|
|
100
|
+
|
|
101
|
+
if Bundler.rubygems.respond_to?(:installed_specs)
|
|
102
|
+
Bundler.rubygems.installed_specs
|
|
103
|
+
else
|
|
104
|
+
Bundler.rubygems.all_specs
|
|
105
|
+
end
|
|
106
|
+
end
|
|
85
107
|
end
|
|
86
108
|
end
|
|
@@ -78,8 +78,19 @@ module NewRelic
|
|
|
78
78
|
camelized.split(/\-|\_/).map(&:capitalize).join
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
+
def camelize_with_first_letter_downcased(string)
|
|
82
|
+
camelized = camelize(string)
|
|
83
|
+
camelized[0].downcase.concat(camelized[1..-1])
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def snakeize(string)
|
|
87
|
+
string.gsub(/(.)([A-Z])/, '\1_\2').downcase
|
|
88
|
+
end
|
|
89
|
+
|
|
81
90
|
def bundled_gem?(gem_name)
|
|
82
|
-
defined?(Bundler)
|
|
91
|
+
return false unless defined?(Bundler)
|
|
92
|
+
|
|
93
|
+
NewRelic::Helper.rubygems_specs.map(&:name).include?(gem_name)
|
|
83
94
|
rescue => e
|
|
84
95
|
::NewRelic::Agent.logger.info("Could not determine if third party #{gem_name} gem is installed", e)
|
|
85
96
|
false
|
|
@@ -60,18 +60,20 @@ module NewRelic
|
|
|
60
60
|
|
|
61
61
|
def discover_dispatcher
|
|
62
62
|
dispatchers = %w[
|
|
63
|
+
serverless
|
|
64
|
+
puma
|
|
65
|
+
sidekiq
|
|
66
|
+
falcon
|
|
67
|
+
delayed_job
|
|
68
|
+
unicorn
|
|
63
69
|
passenger
|
|
70
|
+
resque
|
|
64
71
|
torquebox
|
|
65
72
|
trinidad
|
|
66
73
|
glassfish
|
|
67
|
-
resque
|
|
68
|
-
sidekiq
|
|
69
|
-
delayed_job
|
|
70
|
-
puma
|
|
71
74
|
thin
|
|
72
75
|
mongrel
|
|
73
76
|
litespeed
|
|
74
|
-
unicorn
|
|
75
77
|
webrick
|
|
76
78
|
fastcgi
|
|
77
79
|
]
|
|
@@ -126,16 +128,21 @@ module NewRelic
|
|
|
126
128
|
end
|
|
127
129
|
|
|
128
130
|
def check_for_unicorn
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
return unless (defined?(::Unicorn) && defined?(::Unicorn::HttpServer)) &&
|
|
132
|
+
NewRelic::LanguageSupport.object_space_usable?
|
|
133
|
+
|
|
134
|
+
v = find_class_in_object_space(::Unicorn::HttpServer)
|
|
135
|
+
@discovered_dispatcher = :unicorn if v
|
|
133
136
|
end
|
|
134
137
|
|
|
135
138
|
def check_for_puma
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
return unless defined?(::Puma) && File.basename($0) == 'puma'
|
|
140
|
+
|
|
141
|
+
@discovered_dispatcher = :puma
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def check_for_falcon
|
|
145
|
+
@discovered_dispatcher = :falcon if defined?(::Falcon::Server) && File.basename($PROGRAM_NAME) == 'falcon'
|
|
139
146
|
end
|
|
140
147
|
|
|
141
148
|
def check_for_delayed_job
|
|
@@ -178,15 +185,21 @@ module NewRelic
|
|
|
178
185
|
end
|
|
179
186
|
|
|
180
187
|
def check_for_litespeed
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
return unless caller.pop.include?('fcgi-bin/RailsRunner.rb')
|
|
189
|
+
|
|
190
|
+
@discovered_dispatcher = :litespeed
|
|
184
191
|
end
|
|
185
192
|
|
|
186
193
|
def check_for_passenger
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
194
|
+
return unless defined?(::PhusionPassenger)
|
|
195
|
+
|
|
196
|
+
@discovered_dispatcher = :passenger
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def check_for_serverless
|
|
200
|
+
return unless NewRelic::Agent.config[:'serverless_mode.enabled']
|
|
201
|
+
|
|
202
|
+
@discovered_dispatcher = :serverless
|
|
190
203
|
end
|
|
191
204
|
|
|
192
205
|
public
|
|
@@ -13,7 +13,7 @@ class NewRelic::NoticedError
|
|
|
13
13
|
attr_accessor :path, :timestamp, :message, :exception_class_name,
|
|
14
14
|
:request_uri, :request_port, :file_name, :line_number,
|
|
15
15
|
:stack_trace, :attributes_from_notice_error, :attributes,
|
|
16
|
-
:expected
|
|
16
|
+
:expected, :transaction_id
|
|
17
17
|
|
|
18
18
|
attr_reader :error_group, :exception_id, :is_internal
|
|
19
19
|
|
|
@@ -45,6 +45,7 @@ class NewRelic::NoticedError
|
|
|
45
45
|
@is_internal = (exception.class < NewRelic::Agent::InternalAgentError)
|
|
46
46
|
|
|
47
47
|
extract_class_name_and_message_from(exception)
|
|
48
|
+
@transaction_id = NewRelic::Agent::Tracer&.current_transaction&.guid
|
|
48
49
|
|
|
49
50
|
# clamp long messages to 4k so that we don't send a lot of
|
|
50
51
|
# overhead across the wire
|
|
@@ -79,11 +80,13 @@ class NewRelic::NoticedError
|
|
|
79
80
|
include NewRelic::Coerce
|
|
80
81
|
|
|
81
82
|
def to_collector_array(encoder = nil)
|
|
82
|
-
[NewRelic::Helper.time_to_millis(timestamp),
|
|
83
|
+
arr = [NewRelic::Helper.time_to_millis(timestamp),
|
|
83
84
|
string(path),
|
|
84
85
|
string(message),
|
|
85
86
|
string(exception_class_name),
|
|
86
87
|
processed_attributes]
|
|
88
|
+
arr << @transaction_id if @transaction_id
|
|
89
|
+
arr
|
|
87
90
|
end
|
|
88
91
|
|
|
89
92
|
# Note that we process attributes lazily and store the result. This is because
|
|
@@ -26,22 +26,6 @@ module NewRelic
|
|
|
26
26
|
prefix = ::NewRelic::Agent::Instrumentation::ControllerInstrumentation::TransactionNamer.prefix_for_category(nil, @category)
|
|
27
27
|
"#{prefix}#{self.class.name}/call"
|
|
28
28
|
end
|
|
29
|
-
|
|
30
|
-
# If middleware tracing is disabled, we'll still inject our agent-specific
|
|
31
|
-
# middlewares, and still trace those, but we don't want to capture HTTP
|
|
32
|
-
# response codes, since middleware that's outside of ours might change the
|
|
33
|
-
# response code before it goes back to the client.
|
|
34
|
-
def capture_http_response_code(state, result)
|
|
35
|
-
return if NewRelic::Agent.config[:disable_middleware_instrumentation]
|
|
36
|
-
|
|
37
|
-
super
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def capture_response_content_type(state, result)
|
|
41
|
-
return if NewRelic::Agent.config[:disable_middleware_instrumentation]
|
|
42
|
-
|
|
43
|
-
super
|
|
44
|
-
end
|
|
45
29
|
end
|
|
46
30
|
end
|
|
47
31
|
end
|