newrelic_rpm 8.7.0 → 8.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rubocop.yml +68 -189
- data/.rubocop_todo.yml +52 -0
- data/.simplecov +15 -0
- data/.snyk +11 -0
- data/.yardopts +1 -0
- data/Brewfile +1 -0
- data/CHANGELOG.md +181 -23
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +0 -1
- data/Guardfile +1 -0
- data/README.md +1 -1
- data/Rakefile +13 -20
- data/Thorfile +5 -0
- data/bin/newrelic +2 -1
- data/bin/newrelic_cmd +1 -0
- data/bin/nrdebug +66 -45
- data/config.dot +5 -5
- data/init.rb +4 -4
- data/install.rb +2 -2
- data/lib/new_relic/agent/adaptive_sampler.rb +4 -4
- data/lib/new_relic/agent/agent/shutdown.rb +34 -0
- data/lib/new_relic/agent/agent/special_startup.rb +70 -0
- data/lib/new_relic/agent/agent/start_worker_thread.rb +163 -0
- data/lib/new_relic/agent/agent/startup.rb +196 -0
- data/lib/new_relic/agent/agent.rb +134 -534
- data/lib/new_relic/agent/agent_logger.rb +8 -10
- data/lib/new_relic/agent/attribute_filter.rb +40 -21
- data/lib/new_relic/agent/attribute_processing.rb +7 -7
- data/lib/new_relic/agent/attributes.rb +2 -2
- data/lib/new_relic/agent/audit_logger.rb +3 -3
- data/lib/new_relic/agent/autostart.rb +2 -2
- data/lib/new_relic/agent/chained_call.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command_router.rb +8 -8
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +105 -41
- data/lib/new_relic/agent/configuration/dotted_hash.rb +2 -2
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -5
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +1 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -1
- data/lib/new_relic/agent/configuration/manager.rb +5 -5
- data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
- data/lib/new_relic/agent/configuration/mask_defaults.rb +3 -3
- data/lib/new_relic/agent/configuration/security_policy_source.rb +7 -4
- data/lib/new_relic/agent/configuration/server_source.rb +7 -7
- data/lib/new_relic/agent/configuration/yaml_source.rb +6 -4
- data/lib/new_relic/agent/configuration.rb +1 -1
- data/lib/new_relic/agent/connect/request_builder.rb +3 -3
- data/lib/new_relic/agent/connect/response_handler.rb +5 -5
- data/lib/new_relic/agent/custom_event_aggregator.rb +5 -5
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscator.rb +2 -2
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
- data/lib/new_relic/agent/database.rb +21 -21
- data/lib/new_relic/agent/database_adapter.rb +1 -1
- data/lib/new_relic/agent/datastores/metric_helper.rb +12 -13
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +4 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +2 -4
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +2 -2
- data/lib/new_relic/agent/datastores/mongo.rb +1 -1
- data/lib/new_relic/agent/datastores/redis.rb +3 -3
- data/lib/new_relic/agent/datastores.rb +4 -4
- data/lib/new_relic/agent/deprecator.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +16 -17
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +9 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +18 -19
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +8 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +2 -3
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +40 -40
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +16 -15
- data/lib/new_relic/agent/distributed_tracing.rb +17 -18
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +6 -5
- data/lib/new_relic/agent/error_event_aggregator.rb +3 -4
- data/lib/new_relic/agent/error_filter.rb +5 -5
- data/lib/new_relic/agent/error_trace_aggregator.rb +3 -3
- data/lib/new_relic/agent/event_aggregator.rb +20 -20
- data/lib/new_relic/agent/event_buffer.rb +1 -1
- data/lib/new_relic/agent/event_listener.rb +1 -1
- data/lib/new_relic/agent/event_loop.rb +9 -9
- data/lib/new_relic/agent/external.rb +10 -10
- data/lib/new_relic/agent/guid_generator.rb +2 -2
- data/lib/new_relic/agent/harvester.rb +1 -1
- data/lib/new_relic/agent/heap.rb +5 -5
- data/lib/new_relic/agent/hostname.rb +4 -3
- data/lib/new_relic/agent/http_clients/abstract.rb +1 -2
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +5 -6
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -5
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +2 -3
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +0 -1
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/uri_util.rb +1 -2
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -5
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +31 -23
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +7 -6
- data/lib/new_relic/agent/instrumentation/active_job.rb +11 -4
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +4 -3
- data/lib/new_relic/agent/instrumentation/active_record.rb +9 -9
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +37 -21
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +21 -11
- data/lib/new_relic/agent/instrumentation/active_storage.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +16 -15
- data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +2 -2
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +2 -2
- data/lib/new_relic/agent/instrumentation/authlogic.rb +2 -2
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +10 -10
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +10 -11
- data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/bunny.rb +1 -2
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +25 -17
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +21 -22
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +19 -16
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +2 -3
- data/lib/new_relic/agent/instrumentation/curb.rb +2 -2
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +44 -44
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +2 -3
- data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +1 -2
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -3
- data/lib/new_relic/agent/instrumentation/excon.rb +2 -2
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +6 -6
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/grape/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/grape.rb +1 -1
- data/lib/new_relic/agent/instrumentation/grpc/client/chain.rb +97 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb +89 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/prepend.rb +111 -0
- data/lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb +30 -0
- data/lib/new_relic/agent/instrumentation/grpc/helper.rb +32 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/chain.rb +69 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb +134 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_desc_prepend.rb +35 -0
- data/lib/new_relic/agent/instrumentation/grpc/server/rpc_server_prepend.rb +26 -0
- data/lib/new_relic/agent/instrumentation/grpc_client.rb +23 -0
- data/lib/new_relic/agent/instrumentation/grpc_server.rb +25 -0
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +6 -6
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httpclient.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/httprb.rb +2 -2
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -2
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +5 -1
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/logger.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +24 -17
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +8 -9
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +17 -15
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +21 -15
- data/lib/new_relic/agent/instrumentation/memcache.rb +5 -6
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +2 -2
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +0 -1
- data/lib/new_relic/agent/instrumentation/mongo.rb +2 -2
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +15 -14
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net_http.rb +2 -2
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +6 -6
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino.rb +2 -2
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -2
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +12 -12
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +7 -7
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +3 -2
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -2
- data/lib/new_relic/agent/instrumentation/rake/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +3 -3
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +3 -4
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +5 -6
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +3 -4
- data/lib/new_relic/agent/instrumentation/redis.rb +2 -2
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque.rb +3 -3
- data/lib/new_relic/agent/instrumentation/sequel.rb +8 -8
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +6 -5
- data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sinatra.rb +2 -2
- data/lib/new_relic/agent/instrumentation/sunspot.rb +4 -4
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/thread.rb +2 -2
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +8 -8
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +2 -2
- data/lib/new_relic/agent/instrumentation.rb +1 -1
- data/lib/new_relic/agent/internal_agent_error.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +8 -8
- data/lib/new_relic/agent/linking_metadata.rb +2 -3
- data/lib/new_relic/agent/local_log_decorator.rb +0 -1
- data/lib/new_relic/agent/log_event_aggregator.rb +7 -7
- data/lib/new_relic/agent/log_once.rb +1 -1
- data/lib/new_relic/agent/log_priority.rb +1 -1
- data/lib/new_relic/agent/logging.rb +13 -13
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +19 -20
- data/lib/new_relic/agent/method_tracer.rb +15 -10
- data/lib/new_relic/agent/method_tracer_helpers.rb +83 -1
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +4 -4
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +3 -3
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +1 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +2 -2
- data/lib/new_relic/agent/monitors.rb +5 -5
- data/lib/new_relic/agent/new_relic_service/encoders.rb +2 -2
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +4 -4
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +1 -1
- data/lib/new_relic/agent/new_relic_service.rb +214 -166
- data/lib/new_relic/agent/{noticible_error.rb → noticeable_error.rb} +2 -3
- data/lib/new_relic/agent/null_logger.rb +1 -1
- data/lib/new_relic/agent/obfuscator.rb +3 -3
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/payload_metric_mapping.rb +1 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +10 -5
- data/lib/new_relic/agent/pipe_service.rb +2 -2
- data/lib/new_relic/agent/prepend_supportability.rb +2 -2
- data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -4
- data/lib/new_relic/agent/range_extensions.rb +8 -28
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +2 -2
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine.rb +2 -2
- data/lib/new_relic/agent/sampler.rb +1 -1
- data/lib/new_relic/agent/sampler_collection.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +2 -2
- data/lib/new_relic/agent/samplers/memory_sampler.rb +10 -10
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/vm_sampler.rb +3 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -2
- data/lib/new_relic/agent/span_event_primitive.rb +24 -19
- data/lib/new_relic/agent/sql_sampler.rb +8 -8
- data/lib/new_relic/agent/stats.rb +15 -4
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +4 -4
- data/lib/new_relic/agent/stats_engine.rb +1 -1
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +6 -6
- data/lib/new_relic/agent/system_info.rb +68 -53
- data/lib/new_relic/agent/threading/agent_thread.rb +13 -9
- data/lib/new_relic/agent/threading/backtrace_node.rb +6 -4
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
- data/lib/new_relic/agent/threading/thread_profile.rb +4 -4
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +19 -17
- data/lib/new_relic/agent/transaction/abstract_segment.rb +93 -34
- data/lib/new_relic/agent/transaction/datastore_segment.rb +12 -12
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +52 -48
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
- data/lib/new_relic/agent/transaction/external_request_segment.rb +37 -29
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +6 -6
- data/lib/new_relic/agent/transaction/request_attributes.rb +29 -29
- data/lib/new_relic/agent/transaction/segment.rb +8 -8
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/trace.rb +3 -3
- data/lib/new_relic/agent/transaction/trace_builder.rb +10 -10
- data/lib/new_relic/agent/transaction/trace_context.rb +22 -20
- data/lib/new_relic/agent/transaction/trace_node.rb +9 -9
- data/lib/new_relic/agent/transaction/tracing.rb +7 -7
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
- data/lib/new_relic/agent/transaction.rb +35 -31
- data/lib/new_relic/agent/transaction_error_primitive.rb +9 -9
- data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -5
- data/lib/new_relic/agent/transaction_event_primitive.rb +3 -4
- data/lib/new_relic/agent/transaction_event_recorder.rb +15 -14
- data/lib/new_relic/agent/transaction_metrics.rb +4 -4
- data/lib/new_relic/agent/transaction_sampler.rb +5 -5
- data/lib/new_relic/agent/transaction_time_aggregator.rb +14 -14
- data/lib/new_relic/agent/utilization/aws.rb +4 -4
- data/lib/new_relic/agent/utilization/azure.rb +2 -2
- data/lib/new_relic/agent/utilization/gcp.rb +7 -7
- data/lib/new_relic/agent/utilization/pcf.rb +4 -4
- data/lib/new_relic/agent/utilization/vendor.rb +28 -28
- data/lib/new_relic/agent/utilization_data.rb +1 -1
- data/lib/new_relic/agent/vm/jruby_vm.rb +1 -1
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +36 -23
- data/lib/new_relic/agent/vm/snapshot.rb +2 -2
- data/lib/new_relic/agent/vm.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +2 -2
- data/lib/new_relic/agent.rb +27 -27
- data/lib/new_relic/cli/command.rb +6 -6
- data/lib/new_relic/cli/commands/deployments.rb +81 -29
- data/lib/new_relic/cli/commands/install.rb +6 -6
- data/lib/new_relic/coerce.rb +5 -6
- data/lib/new_relic/collection_helper.rb +4 -4
- data/lib/new_relic/constants.rb +0 -1
- data/lib/new_relic/control/class_methods.rb +1 -1
- data/lib/new_relic/control/frameworks/external.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +3 -3
- data/lib/new_relic/control/frameworks/rails3.rb +1 -1
- data/lib/new_relic/control/frameworks/rails4.rb +1 -1
- data/lib/new_relic/control/frameworks/rails_notifications.rb +1 -1
- data/lib/new_relic/control/frameworks/ruby.rb +1 -1
- data/lib/new_relic/control/frameworks/sinatra.rb +1 -1
- data/lib/new_relic/control/frameworks.rb +1 -1
- data/lib/new_relic/control/instance_methods.rb +20 -42
- data/lib/new_relic/control/instrumentation.rb +7 -7
- data/lib/new_relic/control/private_instance_methods.rb +48 -0
- data/lib/new_relic/control/server_methods.rb +2 -2
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +23 -22
- data/lib/new_relic/environment_report.rb +24 -14
- data/lib/new_relic/helper.rb +5 -5
- data/lib/new_relic/language_support.rb +8 -3
- data/lib/new_relic/latest_changes.rb +4 -4
- data/lib/new_relic/local_environment.rb +9 -11
- data/lib/new_relic/metric_data.rb +30 -24
- data/lib/new_relic/metric_spec.rb +3 -3
- data/lib/new_relic/noticed_error.rb +3 -6
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +1 -1
- data/lib/new_relic/rack/browser_monitoring.rb +132 -123
- data/lib/new_relic/rack.rb +1 -1
- data/lib/new_relic/recipes/capistrano3.rb +3 -59
- data/lib/new_relic/recipes/capistrano_legacy.rb +13 -13
- data/lib/new_relic/recipes/helpers/send_deployment.rb +69 -0
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/supportability_helper.rb +6 -6
- data/lib/new_relic/traced_thread.rb +5 -7
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +8 -8
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/config.rake +8 -112
- data/lib/tasks/coverage_report.rake +28 -0
- data/lib/tasks/{config.html.erb → helpers/config.html.erb} +0 -0
- data/lib/tasks/{config.text.erb → helpers/config.text.erb} +0 -0
- data/lib/tasks/helpers/format.rb +120 -0
- data/lib/tasks/helpers/matches.rb +12 -0
- data/lib/tasks/helpers/prompt.rb +24 -0
- data/lib/tasks/helpers/removers.rb +33 -0
- data/lib/tasks/install.rake +4 -0
- data/lib/tasks/instrumentation_generator/README.md +63 -0
- data/lib/tasks/instrumentation_generator/TODO.md +33 -0
- data/lib/tasks/instrumentation_generator/instrumentation.thor +102 -0
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +9 -0
- data/lib/tasks/instrumentation_generator/templates/chain.tt +21 -0
- data/lib/tasks/instrumentation_generator/templates/chain_method.tt +7 -0
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +29 -0
- data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +12 -0
- data/lib/tasks/instrumentation_generator/templates/instrumentation_method.tt +3 -0
- data/lib/tasks/instrumentation_generator/templates/newrelic.yml.tt +19 -0
- data/lib/tasks/instrumentation_generator/templates/prepend.tt +13 -0
- data/lib/tasks/instrumentation_generator/templates/prepend_method.tt +3 -0
- data/lib/tasks/instrumentation_generator/templates/test.tt +15 -0
- data/lib/tasks/multiverse.rake +4 -0
- data/lib/tasks/multiverse.rb +5 -30
- data/lib/tasks/newrelic.rb +1 -1
- data/lib/tasks/tests.rake +7 -8
- data/newrelic.yml +514 -483
- data/newrelic_rpm.gemspec +16 -21
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +125 -147
- metadata +82 -90
- data/bin/mongrel_rpm +0 -32
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'forwardable'
|
6
6
|
|
@@ -9,7 +9,7 @@ module NewRelic
|
|
9
9
|
module Configuration
|
10
10
|
# Helper since default Procs are evaluated in the context of this module
|
11
11
|
def self.value_of(key)
|
12
|
-
|
12
|
+
proc do
|
13
13
|
NewRelic::Agent.config[key]
|
14
14
|
end
|
15
15
|
end
|
@@ -27,7 +27,7 @@ module NewRelic
|
|
27
27
|
# - auto, when returned means, try to use prepend unless conflicting gems discovered
|
28
28
|
#
|
29
29
|
def self.instrumentation_value_of(disable_key, prepend_key = nil)
|
30
|
-
|
30
|
+
proc do
|
31
31
|
if NewRelic::Agent.config[disable_key]
|
32
32
|
"disabled"
|
33
33
|
elsif prepend_key && !NewRelic::Agent.config[prepend_key]
|
@@ -39,15 +39,15 @@ module NewRelic
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.instrumentation_value_from_boolean(key)
|
42
|
-
|
42
|
+
proc do
|
43
43
|
NewRelic::Agent.config[key] ? 'auto' : 'disabled'
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
# Marks the config option as deprecated in the documentation once generated.
|
48
48
|
# Does not appear in logs.
|
49
|
-
def self.deprecated_description
|
50
|
-
link_ref = new_setting.to_s.
|
49
|
+
def self.deprecated_description(new_setting, description)
|
50
|
+
link_ref = new_setting.to_s.tr(".", "-")
|
51
51
|
%{Please see: [#{new_setting}](docs/agents/ruby-agent/configuration/ruby-agent-configuration##{link_ref}). \n\n#{description}}
|
52
52
|
end
|
53
53
|
|
@@ -81,7 +81,7 @@ module NewRelic
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def self.config_search_paths
|
84
|
-
|
84
|
+
proc {
|
85
85
|
paths = [
|
86
86
|
File.join("config", "newrelic.yml"),
|
87
87
|
File.join("newrelic.yml"),
|
@@ -96,11 +96,11 @@ module NewRelic
|
|
96
96
|
paths << File.join(NewRelic::Control.instance.root, "newrelic.yml.erb")
|
97
97
|
end
|
98
98
|
|
99
|
-
if ENV[
|
100
|
-
paths << File.join(ENV[
|
101
|
-
paths << File.join(ENV[
|
102
|
-
paths << File.join(ENV[
|
103
|
-
paths << File.join(ENV[
|
99
|
+
if ENV['HOME']
|
100
|
+
paths << File.join(ENV['HOME'], ".newrelic", "newrelic.yml")
|
101
|
+
paths << File.join(ENV['HOME'], "newrelic.yml")
|
102
|
+
paths << File.join(ENV['HOME'], ".newrelic", "newrelic.yml.erb")
|
103
|
+
paths << File.join(ENV['HOME'], "newrelic.yml.erb")
|
104
104
|
end
|
105
105
|
|
106
106
|
# If we're packaged for warbler, we can tell from GEM_HOME
|
@@ -115,16 +115,16 @@ module NewRelic
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def self.config_path
|
118
|
-
|
118
|
+
proc {
|
119
119
|
found_path = NewRelic::Agent.config[:config_search_paths].detect do |file|
|
120
|
-
File.expand_path(file) if File.exist?
|
120
|
+
File.expand_path(file) if File.exist?(file)
|
121
121
|
end
|
122
|
-
found_path ||
|
122
|
+
found_path || NewRelic::EMPTY_STR
|
123
123
|
}
|
124
124
|
end
|
125
125
|
|
126
126
|
def self.framework
|
127
|
-
|
127
|
+
proc {
|
128
128
|
case
|
129
129
|
when defined?(::NewRelic::TEST) then :test
|
130
130
|
when defined?(::Rails::VERSION)
|
@@ -134,7 +134,7 @@ module NewRelic
|
|
134
134
|
when 4..7
|
135
135
|
:rails_notifications
|
136
136
|
else
|
137
|
-
::NewRelic::Agent.logger.warn
|
137
|
+
::NewRelic::Agent.logger.warn("Detected untested Rails version #{Rails::VERSION::STRING}")
|
138
138
|
:rails_notifications
|
139
139
|
end
|
140
140
|
when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra
|
@@ -145,7 +145,7 @@ module NewRelic
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def self.agent_enabled
|
148
|
-
|
148
|
+
proc {
|
149
149
|
NewRelic::Agent.config[:enabled] &&
|
150
150
|
(NewRelic::Agent.config[:test_mode] || NewRelic::Agent.config[:monitor_mode]) &&
|
151
151
|
NewRelic::Agent::Autostart.agent_should_start?
|
@@ -155,9 +155,9 @@ module NewRelic
|
|
155
155
|
DEFAULT_LOG_DIR = 'log/'.freeze
|
156
156
|
|
157
157
|
def self.audit_log_path
|
158
|
-
|
158
|
+
proc {
|
159
159
|
log_file_path = NewRelic::Agent.config[:log_file_path]
|
160
|
-
wants_stdout = (log_file_path.
|
160
|
+
wants_stdout = (log_file_path.casecmp('STDOUT').zero?)
|
161
161
|
audit_log_dir = wants_stdout ? DEFAULT_LOG_DIR : log_file_path
|
162
162
|
|
163
163
|
File.join(audit_log_dir, 'newrelic_audit.log')
|
@@ -165,30 +165,30 @@ module NewRelic
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def self.app_name
|
168
|
-
|
168
|
+
proc { NewRelic::Control.instance.env }
|
169
169
|
end
|
170
170
|
|
171
171
|
def self.dispatcher
|
172
|
-
|
172
|
+
proc { NewRelic::Control.instance.local_env.discovered_dispatcher }
|
173
173
|
end
|
174
174
|
|
175
175
|
def self.thread_profiler_enabled
|
176
|
-
|
176
|
+
proc { NewRelic::Agent::Threading::BacktraceService.is_supported? }
|
177
177
|
end
|
178
178
|
|
179
179
|
# This check supports the js_errors_beta key we've asked clients to
|
180
180
|
# set. Once JS errors are GA, browser_monitoring.loader can stop
|
181
181
|
# being dynamic.
|
182
182
|
def self.browser_monitoring_loader
|
183
|
-
|
183
|
+
proc { NewRelic::Agent.config[:js_errors_beta] ? "full" : "rum" }
|
184
184
|
end
|
185
185
|
|
186
186
|
def self.transaction_tracer_transaction_threshold
|
187
|
-
|
187
|
+
proc { NewRelic::Agent.config[:apdex_t] * 4 }
|
188
188
|
end
|
189
189
|
|
190
190
|
def self.profiling_available
|
191
|
-
|
191
|
+
proc {
|
192
192
|
begin
|
193
193
|
require 'ruby-prof'
|
194
194
|
true
|
@@ -199,7 +199,7 @@ module NewRelic
|
|
199
199
|
end
|
200
200
|
|
201
201
|
def self.host
|
202
|
-
|
202
|
+
proc do
|
203
203
|
regex = /\A(?<identifier>.+?)x/
|
204
204
|
if matches = regex.match(String(NewRelic::Agent.config[:license_key]))
|
205
205
|
"collector.#{matches['identifier']}.nr-data.net"
|
@@ -210,12 +210,16 @@ module NewRelic
|
|
210
210
|
end
|
211
211
|
|
212
212
|
def self.api_host
|
213
|
-
|
214
|
-
|
215
|
-
|
213
|
+
# only used for deployment task
|
214
|
+
proc do
|
215
|
+
api_version = if NewRelic::Agent.config[:api_key].nil? || NewRelic::Agent.config[:api_key].empty?
|
216
|
+
"rpm"
|
216
217
|
else
|
217
|
-
|
218
|
+
"api"
|
218
219
|
end
|
220
|
+
api_region = "eu." if String(NewRelic::Agent.config[:license_key]).start_with?('eu')
|
221
|
+
|
222
|
+
"#{api_version}.#{api_region}newrelic.com"
|
219
223
|
end
|
220
224
|
end
|
221
225
|
|
@@ -238,11 +242,11 @@ module NewRelic
|
|
238
242
|
end
|
239
243
|
|
240
244
|
SEMICOLON = ';'.freeze
|
241
|
-
def self.convert_to_list_on_semicolon
|
245
|
+
def self.convert_to_list_on_semicolon(value)
|
242
246
|
case value
|
243
247
|
when Array then value
|
244
248
|
when String then value.split(SEMICOLON)
|
245
|
-
else
|
249
|
+
else NewRelic::EMPTY_ARRAY
|
246
250
|
end
|
247
251
|
end
|
248
252
|
|
@@ -259,7 +263,7 @@ module NewRelic
|
|
259
263
|
end
|
260
264
|
|
261
265
|
def self.enforce_fallback(allowed_values: nil, fallback: nil)
|
262
|
-
|
266
|
+
proc do |configured_value|
|
263
267
|
if allowed_values.any? { |v| v =~ /#{configured_value}/i }
|
264
268
|
configured_value
|
265
269
|
else
|
@@ -329,6 +333,13 @@ module NewRelic
|
|
329
333
|
:allowed_from_server => false,
|
330
334
|
:description => 'Your New Relic [license key](/docs/apis/intro-apis/new-relic-api-keys/#ingest-license-key).'
|
331
335
|
},
|
336
|
+
:api_key => {
|
337
|
+
:default => '',
|
338
|
+
:public => true,
|
339
|
+
:type => String,
|
340
|
+
:allowed_from_server => false,
|
341
|
+
:description => 'Your New Relic API key. Required when using the New Relic REST API v2 to record deployments using the `newrelic deployments` command.'
|
342
|
+
},
|
332
343
|
:agent_enabled => {
|
333
344
|
:default => DefaultSource.agent_enabled,
|
334
345
|
:documentation_default => true,
|
@@ -517,9 +528,9 @@ When `true`, the agent captures HTTP request parameters and attaches them to tra
|
|
517
528
|
:allowed_from_server => false,
|
518
529
|
:transform => DefaultSource.method(:convert_to_regexp_list),
|
519
530
|
:description => 'Specify an Array of Rake tasks to automatically instrument. ' \
|
520
|
-
'This configuration option converts the Array to a RegEx list. If you\'d like '\
|
521
|
-
'to allow all tasks by default, use `rake.tasks: [.+]`. No rake tasks will be '\
|
522
|
-
'instrumented unless they\'re added to this list. For more information, '\
|
531
|
+
'This configuration option converts the Array to a RegEx list. If you\'d like ' \
|
532
|
+
'to allow all tasks by default, use `rake.tasks: [.+]`. No rake tasks will be ' \
|
533
|
+
'instrumented unless they\'re added to this list. For more information, ' \
|
523
534
|
'visit the (New Relic Rake Instrumentation docs)[/docs/apm/agents/ruby-agent/background-jobs/rake-instrumentation].'
|
524
535
|
},
|
525
536
|
:'rake.connect_timeout' => {
|
@@ -929,7 +940,7 @@ If `true`, disables agent middleware for Sinatra. This middleware is responsible
|
|
929
940
|
:type => String,
|
930
941
|
:dynamic_name => true,
|
931
942
|
:allowed_from_server => false,
|
932
|
-
:description => "Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an
|
943
|
+
:description => "Controls auto-instrumentation of the Thread class at start up to allow the agent to correctly nest spans inside of an asynchronous transaction. This does not enable the agent to automatically trace all threads created (see `instrumentation.thread.tracing`). May be one of [auto|prepend|chain|disabled]."
|
933
944
|
},
|
934
945
|
:'instrumentation.thread.tracing' => {
|
935
946
|
:default => false,
|
@@ -1085,6 +1096,32 @@ If `true`, disables agent middleware for Sinatra. This middleware is responsible
|
|
1085
1096
|
:allowed_from_server => false,
|
1086
1097
|
:description => 'Controls auto-instrumentation of the Tilt template rendering library at start up. May be one of [auto|prepend|chain|disabled].'
|
1087
1098
|
},
|
1099
|
+
:'instrumentation.grpc_client' => {
|
1100
|
+
:default => instrumentation_value_of(:disable_grpc_client),
|
1101
|
+
:documentation_default => 'auto',
|
1102
|
+
:public => true,
|
1103
|
+
:type => String,
|
1104
|
+
:dynamic_name => true,
|
1105
|
+
:allowed_from_server => false,
|
1106
|
+
:description => 'Controls auto-instrumentation of gRPC clients at start up. May be one of [auto|prepend|chain|disabled].'
|
1107
|
+
},
|
1108
|
+
:'instrumentation.grpc.host_denylist' => {
|
1109
|
+
:default => [],
|
1110
|
+
:public => true,
|
1111
|
+
:type => Array,
|
1112
|
+
:allowed_from_server => false,
|
1113
|
+
:transform => DefaultSource.method(:convert_to_regexp_list),
|
1114
|
+
:description => %Q(Specifies a list of hostname patterns separated by commas that will match gRPC hostnames that traffic is to be ignored by New Relic for. New Relic's gRPC client instrumentation will ignore traffic streamed to a host matching any of these patterns, and New Relic's gRPC server instrumentation will ignore traffic for a server running on a host whose hostname matches any of these patterns. By default, no traffic is ignored when gRPC instrumentation is itself enabled. For example, "private.com$,exception.*")
|
1115
|
+
},
|
1116
|
+
:'instrumentation.grpc_server' => {
|
1117
|
+
:default => instrumentation_value_of(:disable_grpc_server),
|
1118
|
+
:documentation_default => 'auto',
|
1119
|
+
:public => true,
|
1120
|
+
:type => String,
|
1121
|
+
:dynamic_name => true,
|
1122
|
+
:allowed_from_server => false,
|
1123
|
+
:description => 'Controls auto-instrumentation of gRPC servers at start up. May be one of [auto|prepend|chain|disabled].'
|
1124
|
+
},
|
1088
1125
|
:disable_data_mapper => {
|
1089
1126
|
:default => false,
|
1090
1127
|
:public => true,
|
@@ -1535,7 +1572,7 @@ A map of error classes to a list of messages. When an error of one of the classe
|
|
1535
1572
|
:public => false,
|
1536
1573
|
:type => String,
|
1537
1574
|
:allowed_from_server => true,
|
1538
|
-
:description => '
|
1575
|
+
:description => 'JavaScript agent file for real user monitoring.'
|
1539
1576
|
},
|
1540
1577
|
:'browser_monitoring.auto_instrument' => {
|
1541
1578
|
:default => value_of(:'rum.enabled'),
|
@@ -1894,7 +1931,7 @@ A map of error classes to a list of messages. When an error of one of the classe
|
|
1894
1931
|
:description => 'If `true`, the agent uses Heroku dyno names as the hostname.'
|
1895
1932
|
},
|
1896
1933
|
:'heroku.dyno_name_prefixes_to_shorten' => {
|
1897
|
-
:default => [
|
1934
|
+
:default => %w[scheduler run],
|
1898
1935
|
:public => true,
|
1899
1936
|
:type => Array,
|
1900
1937
|
:allowed_from_server => false,
|
@@ -1902,7 +1939,7 @@ A map of error classes to a list of messages. When an error of one of the classe
|
|
1902
1939
|
:description => 'Ordinarily the agent reports dyno names with a trailing dot and process ID (for example, <b>worker.3</b>). You can remove this trailing data by specifying the prefixes you want to report without trailing data (for example, <b>worker</b>).'
|
1903
1940
|
},
|
1904
1941
|
:'process_host.display_name' => {
|
1905
|
-
:default =>
|
1942
|
+
:default => proc { NewRelic::Agent::Hostname.get },
|
1906
1943
|
:public => true,
|
1907
1944
|
:type => String,
|
1908
1945
|
:allowed_from_server => false,
|
@@ -2010,6 +2047,14 @@ A map of error classes to a list of messages. When an error of one of the classe
|
|
2010
2047
|
:allowed_from_server => false,
|
2011
2048
|
:description => 'If `true`, the agent decorates logs with metadata to link to entities, hosts, traces, and spans.'
|
2012
2049
|
},
|
2050
|
+
:'code_level_metrics.enabled' => {
|
2051
|
+
:default => true,
|
2052
|
+
:public => true,
|
2053
|
+
:type => Boolean,
|
2054
|
+
:allowed_from_server => true,
|
2055
|
+
:description => "If `true`, the agent will report source code level metrics for traced methods.\nsee: " \
|
2056
|
+
'https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/ruby-codestream-integration/'
|
2057
|
+
},
|
2013
2058
|
:'instrumentation.active_support_logger' => {
|
2014
2059
|
:default => instrumentation_value_from_boolean(:'application_logging.enabled'),
|
2015
2060
|
:documentation_default => 'auto',
|
@@ -2401,6 +2446,25 @@ A map of error classes to a list of messages. When an error of one of the classe
|
|
2401
2446
|
:allowed_from_server => false,
|
2402
2447
|
:external => :infinite_tracing,
|
2403
2448
|
:description => "Configures the TCP/IP port for the Trace Observer Host"
|
2449
|
+
},
|
2450
|
+
:'infinite_tracing.compression_level' => {
|
2451
|
+
:default => :none,
|
2452
|
+
:public => false,
|
2453
|
+
:type => Symbol,
|
2454
|
+
:allowed_from_server => false,
|
2455
|
+
:external => :infinite_tracing,
|
2456
|
+
:description => "Configure the compression level for data sent to the Trace Observer\nMay be one of " \
|
2457
|
+
"[none|low|medium|high]\nBy default, compression is not used (level = none)"
|
2458
|
+
},
|
2459
|
+
:'infinite_tracing.batching' => {
|
2460
|
+
:default => false,
|
2461
|
+
:public => false,
|
2462
|
+
:type => Boolean,
|
2463
|
+
:allowed_from_server => false,
|
2464
|
+
:external => :infinite_tracing,
|
2465
|
+
:description => "If true, data sent to the Trace Observer will be batched instead of the default of each " \
|
2466
|
+
"span being sent individually"
|
2467
|
+
|
2404
2468
|
}
|
2405
2469
|
}.freeze
|
2406
2470
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
@@ -35,7 +35,7 @@ module NewRelic
|
|
35
35
|
# turns {'a' => {'b' => 'c'}} into {'a.b' => 'c'}
|
36
36
|
def dot_flattened(nested_hash, names = [], result = {})
|
37
37
|
nested_hash.each do |key, val|
|
38
|
-
next if val
|
38
|
+
next if val.nil?
|
39
39
|
if val.respond_to?(:has_key?)
|
40
40
|
dot_flattened(val, names + [key], result)
|
41
41
|
else
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
@@ -42,15 +42,15 @@ module NewRelic
|
|
42
42
|
def set_dotted_alias(original_config_setting)
|
43
43
|
config_setting = original_config_setting.to_s
|
44
44
|
|
45
|
-
if config_setting.include?
|
46
|
-
config_alias = config_setting.
|
45
|
+
if config_setting.include?('.')
|
46
|
+
config_alias = config_setting.tr('.', '_').to_sym
|
47
47
|
self.alias_map[config_alias] = original_config_setting
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
def set_log_file
|
52
52
|
if ENV['NEW_RELIC_LOG']
|
53
|
-
if ENV['NEW_RELIC_LOG'].
|
53
|
+
if ENV['NEW_RELIC_LOG'].casecmp('STDOUT').zero?
|
54
54
|
self[:log_file_path] = self[:log_file_name] = 'STDOUT'
|
55
55
|
else
|
56
56
|
self[:log_file_path] = File.dirname(ENV['NEW_RELIC_LOG'])
|
@@ -95,7 +95,7 @@ module NewRelic
|
|
95
95
|
elsif type == NewRelic::Agent::Configuration::Boolean
|
96
96
|
if value =~ /false|off|no/i
|
97
97
|
self[config_key] = false
|
98
|
-
elsif value
|
98
|
+
elsif !value.nil?
|
99
99
|
self[config_key] = true
|
100
100
|
end
|
101
101
|
else
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'forwardable'
|
6
6
|
require 'new_relic/agent/configuration/mask_defaults'
|
@@ -22,7 +22,7 @@ module NewRelic
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def has_key?(key)
|
25
|
-
@cache.has_key?
|
25
|
+
@cache.has_key?(key)
|
26
26
|
end
|
27
27
|
|
28
28
|
def keys
|
@@ -155,7 +155,7 @@ module NewRelic
|
|
155
155
|
|
156
156
|
def register_callback(key, &proc)
|
157
157
|
@callbacks[key] << proc
|
158
|
-
|
158
|
+
yield(@cache[key])
|
159
159
|
end
|
160
160
|
|
161
161
|
def invoke_callbacks(direction, source)
|
@@ -253,7 +253,7 @@ module NewRelic
|
|
253
253
|
end
|
254
254
|
rescue => e
|
255
255
|
NewRelic::Agent.logger.error(PARSING_LABELS_FAILURE, e)
|
256
|
-
|
256
|
+
NewRelic::EMPTY_ARRAY
|
257
257
|
end
|
258
258
|
|
259
259
|
def parse_labels_from_string
|
@@ -293,7 +293,7 @@ module NewRelic
|
|
293
293
|
|
294
294
|
unless valid_label_pairs?(pairs)
|
295
295
|
NewRelic::Agent.logger.warn("#{MALFORMED_LABELS_WARNING}: #{labels || pairs}")
|
296
|
-
return
|
296
|
+
return NewRelic::EMPTY_ARRAY
|
297
297
|
end
|
298
298
|
|
299
299
|
pairs = limit_number_of_labels(pairs)
|
@@ -1,13 +1,13 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
7
7
|
module Configuration
|
8
8
|
MASK_DEFAULTS = {
|
9
|
-
:'thread_profiler' =>
|
10
|
-
:'thread_profiler.enabled' =>
|
9
|
+
:'thread_profiler' => proc { !NewRelic::Agent::Threading::BacktraceService.is_supported? },
|
10
|
+
:'thread_profiler.enabled' => proc { !NewRelic::Agent::Threading::BacktraceService.is_supported? }
|
11
11
|
}
|
12
12
|
end
|
13
13
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/configuration/dotted_hash'
|
6
6
|
|
@@ -26,9 +26,10 @@ module NewRelic
|
|
26
26
|
def change_setting(policies, option, new_value)
|
27
27
|
current_value = Agent.config[option]
|
28
28
|
unless current_value == new_value
|
29
|
-
NewRelic::Agent.logger.info \
|
29
|
+
NewRelic::Agent.logger.info( \
|
30
30
|
"Setting changed: {#{option}: from #{current_value} " \
|
31
31
|
"to #{new_value}}. Source: SecurityPolicySource"
|
32
|
+
)
|
32
33
|
end
|
33
34
|
policies[option] = new_value
|
34
35
|
end
|
@@ -218,15 +219,17 @@ module NewRelic
|
|
218
219
|
end
|
219
220
|
else
|
220
221
|
config_source = Agent.config.source(policy[:option]).class.name.split(COLON_COLON).last
|
221
|
-
NewRelic::Agent.logger.info \
|
222
|
+
NewRelic::Agent.logger.info( \
|
222
223
|
"Setting applied: {#{policy[:option]}: #{policy[:disabled_value]}}. " \
|
223
224
|
"Source: #{config_source}"
|
225
|
+
)
|
224
226
|
end
|
225
227
|
else
|
226
228
|
settings[policy[:option]] = policy[:disabled_value]
|
227
|
-
NewRelic::Agent.logger.info \
|
229
|
+
NewRelic::Agent.logger.info( \
|
228
230
|
"Setting applied: {#{policy[:option]}: #{policy[:disabled_value]}}. " \
|
229
231
|
"Source: SecurityPolicySource"
|
232
|
+
)
|
230
233
|
end
|
231
234
|
end
|
232
235
|
settings
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
@@ -86,24 +86,24 @@ module NewRelic
|
|
86
86
|
}
|
87
87
|
|
88
88
|
def add_event_harvest_config(merged_settings, connect_reply)
|
89
|
-
return unless event_harvest_config_is_valid
|
89
|
+
return unless event_harvest_config_is_valid(connect_reply)
|
90
90
|
|
91
91
|
event_harvest_config = EventHarvestConfig.to_config_hash(connect_reply)
|
92
92
|
EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES.each do |config_key, metric_name|
|
93
|
-
NewRelic::Agent.record_metric
|
93
|
+
NewRelic::Agent.record_metric(metric_name, event_harvest_config[config_key])
|
94
94
|
end
|
95
95
|
|
96
|
-
merged_settings.merge!
|
96
|
+
merged_settings.merge!(event_harvest_config)
|
97
97
|
end
|
98
98
|
|
99
|
-
def event_harvest_config_is_valid
|
99
|
+
def event_harvest_config_is_valid(connect_reply)
|
100
100
|
event_harvest_config = connect_reply['event_harvest_config']
|
101
101
|
|
102
102
|
if event_harvest_config.nil? \
|
103
103
|
|| event_harvest_config['harvest_limits'].values.min < 0 \
|
104
104
|
|| (event_harvest_config['report_period_ms'] / 1000) <= 0
|
105
|
-
NewRelic::Agent.logger.warn
|
106
|
-
"in connect response; using default event report period."
|
105
|
+
NewRelic::Agent.logger.warn("Invalid event harvest config found " \
|
106
|
+
"in connect response; using default event report period.")
|
107
107
|
false
|
108
108
|
else
|
109
109
|
true
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/configuration/dotted_hash'
|
6
6
|
|
@@ -13,7 +13,7 @@ module NewRelic
|
|
13
13
|
|
14
14
|
# These are configuration options that have a value of a Hash
|
15
15
|
# This is used in YamlSource#dot_flattened prevent flattening these values
|
16
|
-
CONFIG_WITH_HASH_VALUE = [
|
16
|
+
CONFIG_WITH_HASH_VALUE = %w[expected_messages ignore_messages]
|
17
17
|
|
18
18
|
def initialize(path, env)
|
19
19
|
@path = path
|
@@ -124,6 +124,8 @@ module NewRelic
|
|
124
124
|
config['transaction_tracer']['transaction_threshold'].to_s =~ /apdex_f/i
|
125
125
|
# when value is "apdex_f" remove the config and defer to default
|
126
126
|
config['transaction_tracer'].delete('transaction_threshold')
|
127
|
+
elsif config['transaction_tracer.transaction_threshold'].to_s =~ /apdex_f/i
|
128
|
+
config.delete('transaction_tracer.transaction_threshold')
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
@@ -135,7 +137,7 @@ module NewRelic
|
|
135
137
|
elsif !config[option].nil? && !is_boolean?(config[option])
|
136
138
|
coerced_value = !!(config[option].to_s =~ /yes|on|true/i)
|
137
139
|
if !coerced_value
|
138
|
-
log_failure
|
140
|
+
log_failure("Unexpected value (#{config[option]}) for '#{option}' in #{@path}")
|
139
141
|
end
|
140
142
|
config[option] = coerced_value
|
141
143
|
end
|
@@ -153,7 +155,7 @@ module NewRelic
|
|
153
155
|
|
154
156
|
def dot_flattened(nested_hash, names = [], result = {})
|
155
157
|
nested_hash.each do |key, val|
|
156
|
-
next if val
|
158
|
+
next if val.nil?
|
157
159
|
if val.respond_to?(:has_key?) && !CONFIG_WITH_HASH_VALUE.include?(key)
|
158
160
|
dot_flattened(val, names + [key], result)
|
159
161
|
else
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/agent/configuration/manager'
|
6
6
|
require 'new_relic/agent/configuration/dotted_hash'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# This file is distributed under New Relic's license terms.
|
3
2
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
3
|
+
# frozen_string_literal: true
|
4
4
|
|
5
5
|
require 'new_relic/environment_report'
|
6
6
|
require 'new_relic/agent/configuration/event_harvest_config'
|
@@ -38,10 +38,10 @@ module NewRelic
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# We've seen objects in the environment report (Rails.env in
|
41
|
-
# particular) that can't
|
41
|
+
# particular) that can't serialize to JSON. Cope with that here and
|
42
42
|
# clear out so downstream code doesn't have to check again.
|
43
43
|
def sanitize_environment_report(environment_report)
|
44
|
-
return
|
44
|
+
return NewRelic::EMPTY_ARRAY unless @service.valid_to_marshal?(environment_report)
|
45
45
|
environment_report
|
46
46
|
end
|
47
47
|
|