newrelic_rpm 6.8.0.360 → 8.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -1
- data/.rubocop.yml +1817 -0
- data/.rubocop_todo.yml +59 -0
- data/.simplecov +15 -0
- data/.snyk +11 -0
- data/.yardopts +1 -0
- data/Brewfile +12 -0
- data/CHANGELOG.md +1142 -15
- data/CONTRIBUTING.md +133 -19
- data/DOCKER.md +167 -0
- data/Dockerfile +10 -0
- data/Gemfile +5 -2
- data/Guardfile +18 -6
- data/LICENSE +202 -38
- data/README.md +84 -87
- data/Rakefile +27 -27
- data/THIRD_PARTY_NOTICES.md +28 -0
- data/Thorfile +5 -0
- data/bin/newrelic +3 -2
- data/bin/newrelic_cmd +1 -0
- data/bin/nrdebug +77 -54
- data/config.dot +5 -5
- data/docker-compose.yml +107 -0
- data/init.rb +5 -7
- data/install.rb +3 -3
- data/lefthook.yml +9 -0
- data/lib/new_relic/agent/adaptive_sampler.rb +14 -10
- data/lib/new_relic/agent/agent/shutdown.rb +35 -0
- data/lib/new_relic/agent/agent/special_startup.rb +72 -0
- data/lib/new_relic/agent/agent/start_worker_thread.rb +163 -0
- data/lib/new_relic/agent/agent/startup.rb +197 -0
- data/lib/new_relic/agent/agent.rb +199 -562
- data/lib/new_relic/agent/agent_logger.rb +24 -20
- data/lib/new_relic/agent/attribute_filter.rb +67 -48
- data/lib/new_relic/agent/attribute_processing.rb +8 -8
- data/lib/new_relic/agent/attributes.rb +9 -8
- data/lib/new_relic/agent/audit_logger.rb +19 -4
- data/lib/new_relic/agent/autostart.rb +21 -20
- data/lib/new_relic/agent/chained_call.rb +2 -2
- data/lib/new_relic/agent/commands/agent_command.rb +4 -4
- data/lib/new_relic/agent/commands/agent_command_router.rb +13 -12
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +10 -8
- data/lib/new_relic/agent/configuration/default_source.rb +1731 -1143
- data/lib/new_relic/agent/configuration/dotted_hash.rb +7 -6
- data/lib/new_relic/agent/configuration/environment_source.rb +12 -10
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +41 -18
- data/lib/new_relic/agent/configuration/high_security_source.rb +10 -9
- data/lib/new_relic/agent/configuration/manager.rb +83 -70
- data/lib/new_relic/agent/configuration/manual_source.rb +2 -2
- data/lib/new_relic/agent/configuration/mask_defaults.rb +4 -4
- data/lib/new_relic/agent/configuration/security_policy_source.rb +91 -78
- data/lib/new_relic/agent/configuration/server_source.rb +23 -21
- data/lib/new_relic/agent/configuration/yaml_source.rb +33 -9
- data/lib/new_relic/agent/configuration.rb +2 -2
- data/lib/new_relic/agent/connect/request_builder.rb +19 -19
- data/lib/new_relic/agent/connect/response_handler.rb +6 -9
- data/lib/new_relic/agent/custom_event_aggregator.rb +15 -15
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +5 -6
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +16 -15
- data/lib/new_relic/agent/database/obfuscator.rb +3 -3
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +4 -4
- data/lib/new_relic/agent/database.rb +55 -50
- data/lib/new_relic/agent/database_adapter.rb +35 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +18 -19
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +8 -7
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +7 -11
- data/lib/new_relic/agent/datastores/mongo.rb +7 -12
- data/lib/new_relic/agent/datastores/nosql_obfuscator.rb +41 -0
- data/lib/new_relic/agent/datastores/redis.rb +6 -12
- data/lib/new_relic/agent/datastores.rb +12 -14
- data/lib/new_relic/agent/deprecator.rb +2 -2
- data/lib/new_relic/agent/{cross_app_payload.rb → distributed_tracing/cross_app_payload.rb} +13 -12
- data/lib/new_relic/agent/{cross_app_tracing.rb → distributed_tracing/cross_app_tracing.rb} +86 -64
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +84 -0
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +75 -0
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +163 -0
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +38 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +245 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +127 -0
- data/lib/new_relic/agent/distributed_tracing.rb +113 -32
- data/lib/new_relic/agent/encoding_normalizer.rb +5 -3
- data/lib/new_relic/agent/error_collector.rb +98 -62
- data/lib/new_relic/agent/error_event_aggregator.rb +9 -8
- data/lib/new_relic/agent/error_filter.rb +174 -0
- data/lib/new_relic/agent/error_trace_aggregator.rb +5 -4
- data/lib/new_relic/agent/event_aggregator.rb +23 -22
- data/lib/new_relic/agent/event_buffer.rb +8 -9
- data/lib/new_relic/agent/event_listener.rb +2 -3
- data/lib/new_relic/agent/event_loop.rb +26 -24
- data/lib/new_relic/agent/external.rb +19 -52
- data/lib/new_relic/agent/guid_generator.rb +5 -12
- data/lib/new_relic/agent/harvester.rb +5 -6
- data/lib/new_relic/agent/heap.rb +7 -9
- data/lib/new_relic/agent/hostname.rb +21 -8
- data/lib/new_relic/agent/http_clients/abstract.rb +81 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +26 -26
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +31 -17
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +18 -23
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +12 -15
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +24 -8
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +9 -12
- data/lib/new_relic/agent/http_clients/uri_util.rb +12 -13
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +12 -14
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +43 -32
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +21 -14
- data/lib/new_relic/agent/instrumentation/active_job.rb +15 -8
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +21 -7
- data/lib/new_relic/agent/instrumentation/active_record.rb +89 -40
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +82 -61
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +32 -45
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +36 -12
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +34 -22
- data/lib/new_relic/agent/instrumentation/active_storage.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +25 -18
- data/lib/new_relic/agent/instrumentation/active_support_logger/chain.rb +23 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/instrumentation.rb +20 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger/prepend.rb +12 -0
- data/lib/new_relic/agent/instrumentation/active_support_logger.rb +24 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +12 -3
- data/lib/new_relic/agent/instrumentation/authlogic.rb +11 -3
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +45 -0
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +150 -0
- data/lib/new_relic/agent/instrumentation/bunny/prepend.rb +35 -0
- data/lib/new_relic/agent/instrumentation/bunny.rb +14 -138
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +69 -59
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +91 -0
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +221 -0
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +61 -0
- data/lib/new_relic/agent/instrumentation/curb.rb +13 -198
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +68 -55
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +35 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +48 -0
- data/lib/new_relic/agent/instrumentation/delayed_job/prepend.rb +33 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +30 -52
- data/lib/new_relic/agent/instrumentation/elasticsearch/chain.rb +29 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/elasticsearch.rb +31 -0
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +7 -6
- data/lib/new_relic/agent/instrumentation/excon.rb +24 -26
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +100 -0
- data/lib/new_relic/agent/instrumentation/grape/prepend.rb +17 -0
- data/lib/new_relic/agent/instrumentation/grape.rb +12 -118
- 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 +24 -0
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +37 -0
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/httpclient.rb +12 -32
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +22 -0
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +30 -0
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/httprb.rb +29 -0
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +5 -6
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +66 -0
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +26 -0
- data/lib/new_relic/agent/instrumentation/memcache/chain.rb +15 -0
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +58 -125
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +59 -0
- data/lib/new_relic/agent/instrumentation/memcache/instrumentation.rb +90 -0
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +101 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +57 -71
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +14 -13
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +10 -10
- data/lib/new_relic/agent/instrumentation/mongo.rb +6 -131
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +49 -13
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +40 -0
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +21 -0
- data/lib/new_relic/agent/instrumentation/net_http.rb +44 -0
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +34 -9
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +38 -0
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +28 -0
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +20 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +22 -58
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/queue_time.rb +9 -10
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +66 -0
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +33 -0
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +75 -0
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +43 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +31 -139
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +17 -53
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +6 -5
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +4 -3
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +14 -4
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +20 -0
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +149 -0
- data/lib/new_relic/agent/instrumentation/rake/prepend.rb +14 -0
- data/lib/new_relic/agent/instrumentation/rake.rb +17 -157
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +45 -0
- data/lib/new_relic/agent/instrumentation/redis/constants.rb +17 -0
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +72 -0
- data/lib/new_relic/agent/instrumentation/redis/middleware.rb +16 -0
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +29 -0
- data/lib/new_relic/agent/instrumentation/redis.rb +19 -102
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +19 -0
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +34 -0
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +15 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +29 -37
- data/lib/new_relic/agent/instrumentation/sequel.rb +15 -17
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +3 -3
- data/lib/new_relic/agent/instrumentation/sidekiq/client.rb +20 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/extensions/delayed_class.rb +30 -0
- data/lib/new_relic/agent/instrumentation/sidekiq/server.rb +37 -0
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +28 -45
- data/lib/new_relic/agent/instrumentation/sinatra/chain.rb +55 -0
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +31 -37
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +125 -0
- data/lib/new_relic/agent/instrumentation/sinatra/prepend.rb +33 -0
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +3 -3
- data/lib/new_relic/agent/instrumentation/sinatra.rb +35 -165
- data/lib/new_relic/agent/instrumentation/sunspot.rb +12 -4
- data/lib/new_relic/agent/instrumentation/thread/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/thread/instrumentation.rb +28 -0
- data/lib/new_relic/agent/instrumentation/thread/prepend.rb +22 -0
- data/lib/new_relic/agent/instrumentation/thread.rb +20 -0
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +41 -0
- data/lib/new_relic/agent/instrumentation/tilt/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/tilt.rb +25 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/chain.rb +22 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +80 -0
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +14 -0
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +14 -76
- data/lib/new_relic/agent/instrumentation.rb +2 -2
- data/lib/new_relic/agent/internal_agent_error.rb +3 -3
- data/lib/new_relic/agent/javascript_instrumentor.rb +48 -42
- data/lib/new_relic/agent/linking_metadata.rb +44 -0
- data/lib/new_relic/agent/local_log_decorator.rb +37 -0
- data/lib/new_relic/agent/log_event_aggregator.rb +235 -0
- data/lib/new_relic/agent/log_once.rb +2 -2
- data/lib/new_relic/agent/log_priority.rb +20 -0
- data/lib/new_relic/agent/logging.rb +39 -26
- data/lib/new_relic/agent/memory_logger.rb +3 -3
- data/lib/new_relic/agent/messaging.rb +70 -154
- data/lib/new_relic/agent/method_tracer.rb +152 -145
- data/lib/new_relic/agent/method_tracer_helpers.rb +87 -5
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +118 -0
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +28 -0
- data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +3 -4
- data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +8 -13
- data/lib/new_relic/agent/monitors.rb +26 -0
- data/lib/new_relic/agent/new_relic_service/encoders.rb +7 -7
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +6 -6
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +3 -3
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +6 -5
- data/lib/new_relic/agent/new_relic_service.rb +258 -184
- data/lib/new_relic/agent/noticeable_error.rb +19 -0
- data/lib/new_relic/agent/null_logger.rb +8 -4
- data/lib/new_relic/agent/obfuscator.rb +9 -11
- data/lib/new_relic/agent/parameter_filtering.rb +25 -11
- data/lib/new_relic/agent/payload_metric_mapping.rb +10 -11
- data/lib/new_relic/agent/pipe_channel_manager.rb +28 -18
- data/lib/new_relic/agent/pipe_service.rb +9 -6
- data/lib/new_relic/agent/prepend_supportability.rb +3 -3
- data/lib/new_relic/agent/priority_sampled_buffer.rb +15 -15
- data/lib/new_relic/agent/range_extensions.rb +9 -29
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +12 -12
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +14 -14
- data/lib/new_relic/agent/rules_engine.rb +6 -5
- data/lib/new_relic/agent/sampler.rb +4 -5
- data/lib/new_relic/agent/sampler_collection.rb +4 -5
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +4 -3
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +13 -10
- data/lib/new_relic/agent/samplers/memory_sampler.rb +26 -15
- data/lib/new_relic/agent/samplers/object_sampler.rb +2 -2
- data/lib/new_relic/agent/samplers/vm_sampler.rb +22 -20
- data/lib/new_relic/agent/span_event_aggregator.rb +13 -13
- data/lib/new_relic/agent/span_event_primitive.rb +106 -68
- data/lib/new_relic/agent/sql_sampler.rb +22 -22
- data/lib/new_relic/agent/stats.rb +79 -42
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +11 -13
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +13 -14
- data/lib/new_relic/agent/stats_engine.rb +9 -9
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +8 -9
- data/lib/new_relic/agent/system_info.rb +95 -66
- data/lib/new_relic/agent/threading/agent_thread.rb +19 -15
- data/lib/new_relic/agent/threading/backtrace_node.rb +13 -14
- data/lib/new_relic/agent/threading/backtrace_service.rb +15 -15
- data/lib/new_relic/agent/threading/thread_profile.rb +24 -24
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +2 -2
- data/lib/new_relic/agent/tracer.rb +107 -101
- data/lib/new_relic/agent/transaction/abstract_segment.rb +128 -38
- data/lib/new_relic/agent/transaction/datastore_segment.rb +22 -18
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +184 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +75 -84
- data/lib/new_relic/agent/transaction/external_request_segment.rb +66 -76
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +34 -46
- data/lib/new_relic/agent/transaction/request_attributes.rb +36 -36
- data/lib/new_relic/agent/transaction/segment.rb +35 -11
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +2 -4
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +2 -2
- data/lib/new_relic/agent/transaction/trace.rb +18 -16
- data/lib/new_relic/agent/transaction/trace_builder.rb +11 -11
- data/lib/new_relic/agent/transaction/trace_context.rb +102 -93
- data/lib/new_relic/agent/transaction/trace_node.rb +26 -28
- data/lib/new_relic/agent/transaction/tracing.rb +15 -12
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +5 -5
- data/lib/new_relic/agent/transaction.rb +210 -177
- data/lib/new_relic/agent/transaction_error_primitive.rb +32 -28
- data/lib/new_relic/agent/transaction_event_aggregator.rb +13 -13
- data/lib/new_relic/agent/transaction_event_primitive.rb +43 -47
- data/lib/new_relic/agent/transaction_event_recorder.rb +17 -16
- data/lib/new_relic/agent/transaction_metrics.rb +11 -10
- data/lib/new_relic/agent/transaction_sampler.rb +6 -7
- data/lib/new_relic/agent/transaction_time_aggregator.rb +27 -26
- data/lib/new_relic/agent/utilization/aws.rb +34 -4
- data/lib/new_relic/agent/utilization/azure.rb +4 -4
- data/lib/new_relic/agent/utilization/gcp.rb +8 -8
- data/lib/new_relic/agent/utilization/pcf.rb +6 -5
- data/lib/new_relic/agent/utilization/vendor.rb +44 -29
- data/lib/new_relic/agent/utilization_data.rb +8 -6
- data/lib/new_relic/agent/vm/jruby_vm.rb +2 -2
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +3 -3
- data/lib/new_relic/agent/vm/mri_vm.rb +46 -19
- data/lib/new_relic/agent/vm/snapshot.rb +6 -6
- data/lib/new_relic/agent/vm.rb +2 -2
- data/lib/new_relic/agent/worker_loop.rb +11 -13
- data/lib/new_relic/agent.rb +78 -79
- data/lib/new_relic/cli/command.rb +21 -23
- data/lib/new_relic/cli/commands/deployments.rb +93 -44
- data/lib/new_relic/cli/commands/install.rb +15 -17
- data/lib/new_relic/coerce.rb +19 -15
- data/lib/new_relic/collection_helper.rb +51 -49
- data/lib/new_relic/constants.rb +39 -0
- data/lib/new_relic/control/class_methods.rb +4 -4
- data/lib/new_relic/control/frameworks/external.rb +3 -3
- data/lib/new_relic/control/frameworks/rails.rb +24 -18
- data/lib/new_relic/control/frameworks/rails3.rb +4 -5
- data/lib/new_relic/control/frameworks/rails4.rb +2 -2
- data/lib/new_relic/control/frameworks/rails_notifications.rb +2 -2
- data/lib/new_relic/control/frameworks/ruby.rb +4 -4
- data/lib/new_relic/control/frameworks/sinatra.rb +8 -2
- data/lib/new_relic/control/frameworks.rb +2 -2
- data/lib/new_relic/control/instance_methods.rb +24 -46
- data/lib/new_relic/control/instrumentation.rb +40 -12
- data/lib/new_relic/control/private_instance_methods.rb +48 -0
- data/lib/new_relic/control/server_methods.rb +4 -5
- data/lib/new_relic/control.rb +2 -3
- data/lib/new_relic/delayed_job_injection.rb +2 -2
- data/lib/new_relic/dependency_detection.rb +129 -18
- data/lib/new_relic/environment_report.rb +41 -35
- data/lib/new_relic/helper.rb +49 -8
- data/lib/new_relic/language_support.rb +30 -6
- data/lib/new_relic/latest_changes.rb +9 -8
- data/lib/new_relic/local_environment.rb +25 -19
- data/lib/new_relic/metric_data.rb +32 -27
- data/lib/new_relic/metric_spec.rb +9 -7
- data/lib/new_relic/noticed_error.rb +44 -35
- data/lib/new_relic/rack/agent_hooks.rb +2 -2
- data/lib/new_relic/rack/agent_middleware.rb +6 -4
- data/lib/new_relic/rack/browser_monitoring.rb +134 -119
- data/lib/new_relic/rack.rb +2 -2
- data/lib/new_relic/recipes/capistrano3.rb +4 -62
- data/lib/new_relic/recipes/capistrano_legacy.rb +24 -27
- data/lib/new_relic/recipes/helpers/send_deployment.rb +69 -0
- data/lib/new_relic/recipes.rb +2 -2
- data/lib/new_relic/supportability_helper.rb +21 -6
- data/lib/new_relic/traced_thread.rb +35 -0
- data/lib/new_relic/version.rb +7 -18
- data/lib/newrelic_rpm.rb +12 -36
- data/lib/sequel/extensions/newrelic_instrumentation.rb +13 -16
- data/lib/sequel/plugins/newrelic_instrumentation.rb +5 -11
- data/lib/tasks/all.rb +4 -4
- data/lib/tasks/config.rake +22 -117
- data/lib/tasks/coverage_report.rake +28 -0
- data/lib/tasks/helpers/config.html.erb +21 -0
- data/lib/tasks/{config.text.erb → helpers/config.text.erb} +0 -0
- data/lib/tasks/helpers/format.rb +123 -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 +124 -0
- data/lib/tasks/instrumentation_generator/templates/Envfile.tt +9 -0
- data/lib/tasks/instrumentation_generator/templates/chain.tt +22 -0
- data/lib/tasks/instrumentation_generator/templates/chain_method.tt +8 -0
- data/lib/tasks/instrumentation_generator/templates/dependency_detection.tt +29 -0
- data/lib/tasks/instrumentation_generator/templates/instrumentation.tt +13 -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 +12 -5
- data/lib/tasks/newrelic.rb +2 -2
- data/lib/tasks/tests.rake +14 -14
- data/newrelic.yml +648 -3
- data/newrelic_rpm.gemspec +28 -25
- data/recipes/newrelic.rb +3 -3
- data/test/agent_helper.rb +332 -103
- metadata +192 -119
- data/.travis.yml +0 -210
- data/bin/mongrel_rpm +0 -33
- data/cert/cacert.pem +0 -1177
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -110
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +0 -44
- data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
- data/lib/new_relic/agent/distributed_trace_intrinsics.rb +0 -90
- data/lib/new_relic/agent/distributed_trace_metrics.rb +0 -74
- data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -30
- data/lib/new_relic/agent/distributed_trace_payload.rb +0 -175
- data/lib/new_relic/agent/distributed_trace_transport_type.rb +0 -43
- data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -46
- data/lib/new_relic/agent/instrumentation/http.rb +0 -46
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
- data/lib/new_relic/agent/instrumentation/net.rb +0 -50
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
- data/lib/new_relic/agent/supported_versions.rb +0 -275
- data/lib/new_relic/agent/trace_context.rb +0 -244
- data/lib/new_relic/agent/trace_context_payload.rb +0 -134
- data/lib/new_relic/agent/trace_context_request_monitor.rb +0 -42
- data/lib/new_relic/build.rb +0 -2
- data/lib/new_relic/control/frameworks/merb.rb +0 -29
- data/lib/new_relic/metrics.rb +0 -13
- data/lib/tasks/config.html.erb +0 -32
- data/true +0 -0
data/CONTRIBUTING.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
# Guidelines for Contributing Code
|
2
2
|
|
3
|
-
|
4
|
-
taken effort to make this process easy for both contributors and our
|
5
|
-
team.
|
3
|
+
New Relic welcomes code contributions by the Ruby community, and
|
4
|
+
have taken effort to make this process easy for both contributors and our
|
5
|
+
development team.
|
6
6
|
|
7
7
|
When contributing, keep in mind that the agent runs in a wide variety of Ruby
|
8
8
|
language implementations (e.g. 2.x.x, jruby, etc.) as well as a wide variety of
|
9
|
-
application environments (e.g. Rails, Sinatra, roll-your-own, etc.) See
|
10
|
-
https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks
|
9
|
+
application environments (e.g. Rails, Sinatra, roll-your-own, etc.) See [Ruby agent requirements and supported frameworks](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks)
|
11
10
|
for the current full list.
|
12
11
|
|
13
12
|
Because of this, we need to be more defensive in our coding practices than most
|
@@ -15,14 +14,100 @@ projects. Syntax must be compatible with all supported Ruby implementations and
|
|
15
14
|
we can't assume the presence of any specific libraries, including `ActiveSupport`,
|
16
15
|
`ActiveRecord`, etc.
|
17
16
|
|
17
|
+
## Process
|
18
|
+
|
19
|
+
### Version Support
|
20
|
+
|
21
|
+
When contributing, keep in mind that New Relic customers (that's you!) are
|
22
|
+
running many different versions of Ruby, some of them pretty old. Changes that
|
23
|
+
depend on the newest version of Ruby will probably be rejected, especially if
|
24
|
+
they replace something backwards compatible.
|
25
|
+
|
26
|
+
Be aware that the instrumentation needs to work with a wide range of versions of
|
27
|
+
the instrumented modules, and that code that looks nonsensical or
|
28
|
+
overcomplicated may be that way for compatibility-related reasons. Read all the
|
29
|
+
comments and check the related tests before deciding whether existing code is
|
30
|
+
incorrect.
|
31
|
+
|
32
|
+
If you are planning on contributing a new feature or an otherwise complex
|
33
|
+
contribution, we kindly ask you to start a conversation with the maintainer team
|
34
|
+
by opening up a GitHub issue first.
|
35
|
+
|
36
|
+
|
37
|
+
### General Guidelines
|
38
|
+
The Ruby agent avoids requiring any dependencies in the main agent code base.
|
39
|
+
Instrumentations and features that would otherwise require a dependency (such as
|
40
|
+
Infinite Tracing, which require gRPC and protobuf) are built as separate gems.
|
41
|
+
If you have a feature or instrumentation request that would require a
|
42
|
+
dependency, please open an Issue to discuss with the maintainers before
|
43
|
+
proceeding.
|
44
|
+
|
45
|
+
Your code will be evaluated for completeness and accuracy in
|
46
|
+
implementation and must be accompanied with appropriate unit tests. New
|
47
|
+
additions that do not break existing tests are the easiest and quickest to be
|
48
|
+
accepted and merged. New features and improvements that break existing
|
49
|
+
functionality are slower to be accepted and merged as they require agreement
|
50
|
+
with maintainers across a majority of the languages New Relic supports. Any
|
51
|
+
such breaking changes will require a major version bump whereas non-breaking
|
52
|
+
additions only lead to minor version bumps.
|
53
|
+
|
54
|
+
Please be aware that the maintainers of New Relic’s agents aim to have as much
|
55
|
+
commonality of functionality across all language agents as makes sense, so we are
|
56
|
+
always working to reconcile language-specific changes against the cross-language
|
57
|
+
community set of agreements.
|
58
|
+
|
59
|
+
### Feature Requests
|
60
|
+
|
61
|
+
Feature requests should be submitted in the [Issue tracker](../../issues), with
|
62
|
+
a description of the expected behavior & use case. Before submitting an Issue,
|
63
|
+
please search for similar ones in the [closed
|
64
|
+
issues](../../issues?q=is%3Aissue+is%3Aclosed).
|
65
|
+
|
66
|
+
### Pull Requests
|
67
|
+
|
68
|
+
We can only accept PRs for version v6.12.0 or greater due to open source
|
69
|
+
licensing restrictions. Please set the merge branch to `dev` unless the issue
|
70
|
+
states otherwise.
|
71
|
+
|
72
|
+
### Code of Conduct
|
73
|
+
|
74
|
+
Before contributing please read the [code of conduct](https://github.com/newrelic/.github/blob/master/CODE_OF_CONDUCT.md)
|
75
|
+
|
76
|
+
Note that our [code of conduct](https://github.com/newrelic/.github/blob/master/CODE_OF_CONDUCT.md) applies to all platforms
|
77
|
+
and venues related to this project; please follow it in all your interactions
|
78
|
+
with the project and its participants.
|
79
|
+
|
18
80
|
## Branches
|
19
81
|
|
20
|
-
The head of
|
21
|
-
New Relic reserves the ability to push an edge to the
|
82
|
+
The head of `main` will generally have New Relic's latest release. However,
|
83
|
+
New Relic reserves the ability to push an edge to the `main`. If you download a
|
22
84
|
release from this repo, use the appropriate tag. New Relic usually pushes beta
|
23
85
|
versions of a release to a working branch before tagging them for General
|
24
86
|
Availability.
|
25
87
|
|
88
|
+
The `main` branch houses the code from the latest release. The `dev` branch
|
89
|
+
includes unreleased work. Please create all new branches off of `dev`.
|
90
|
+
|
91
|
+
## Development Environment Setup
|
92
|
+
|
93
|
+
1. Fork and clone the repo locally
|
94
|
+
- Fork the repository inside GitHub
|
95
|
+
- `git clone git@github.com:<gh username>/newrelic-ruby-agent.git`
|
96
|
+
1. Pick a Ruby version
|
97
|
+
- Use rbenv, rvm, chruby, asdf, etc. to install any version of Ruby between 2.2 up to the latest stable version
|
98
|
+
1. Install development dependencies
|
99
|
+
- `bundle install`
|
100
|
+
1. Check that your env is setup correctly
|
101
|
+
- `bundle exec rake`
|
102
|
+
|
103
|
+
**Optional:** Install [lefthook](https://github.com/evilmartians/lefthook) to
|
104
|
+
integrate our team's git hooks, such as [rubocop](https://github.com/rubocop/rubocop)
|
105
|
+
linting into your workflow.
|
106
|
+
|
107
|
+
**Note:** These setup instructions will not allow you to run the entire test
|
108
|
+
suite. Some of our suites require services such as MySQL, Postgres, Redis, and
|
109
|
+
others to run.
|
110
|
+
|
26
111
|
## Testing
|
27
112
|
|
28
113
|
The agent includes a suite of unit and functional tests which should be used to
|
@@ -39,13 +124,16 @@ Running the test suite is simple. Just invoke:
|
|
39
124
|
bundle
|
40
125
|
bundle exec rake
|
41
126
|
|
42
|
-
This will run the unit tests in standalone mode
|
43
|
-
|
127
|
+
This will run the unit tests in standalone mode. You can run against a specific Rails version
|
128
|
+
by passing the version name (which should match the name of a subdirectory in test/environments)
|
129
|
+
as an argument to the test:env rake task, like this:
|
130
|
+
|
131
|
+
bundle exec rake 'test:env[rails60]'
|
44
132
|
|
45
133
|
These tests are setup to run automatically in
|
46
|
-
[
|
47
|
-
When you've pushed your changes to GitHub, you can confirm that
|
48
|
-
|
134
|
+
[GitHub Actions](https://github.com/newrelic/newrelic-ruby-agent/actions) under several
|
135
|
+
Ruby implementations. When you've pushed your changes to GitHub, you can confirm that
|
136
|
+
the GitHub Actions test matrix passes for your fork.
|
49
137
|
|
50
138
|
Additionally, our own CI jobs runs these tests under multiple versions of Rails
|
51
139
|
to verify compatibility.
|
@@ -74,15 +162,41 @@ These tests can be run by invoking:
|
|
74
162
|
bundle exec rake test:multiverse
|
75
163
|
|
76
164
|
More details are available in
|
77
|
-
[test/multiverse/README.md](https://github.com/newrelic/
|
165
|
+
[test/multiverse/README.md](https://github.com/newrelic/newrelic-ruby-agent/blob/main/test/multiverse/README.md).
|
166
|
+
|
167
|
+
### Leveraging Docker for Development and/or Testing
|
168
|
+
|
169
|
+
See [DOCKER.md](DOCKER.md).
|
170
|
+
|
171
|
+
## Contributor License Agreement
|
172
|
+
|
173
|
+
Keep in mind that when you submit your Pull Request, you'll need to sign the CLA
|
174
|
+
via the click-through using CLA-Assistant. If you'd like to execute our
|
175
|
+
corporate CLA, or if you have any questions, please drop us an email at
|
176
|
+
opensource@newrelic.com.
|
177
|
+
|
178
|
+
For more information about CLAs, please check out Alex Russell’s excellent post,
|
179
|
+
[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
|
180
|
+
|
181
|
+
## Slack
|
182
|
+
|
183
|
+
We host a public Slack with a dedicated channel for contributors and maintainers
|
184
|
+
of open source projects hosted by New Relic. If you are contributing to this
|
185
|
+
project, you're welcome to request access to the #oss-contributors channel in
|
186
|
+
the newrelicusers.slack.com workspace. To request access, see
|
187
|
+
https://newrelicusers-signup.herokuapp.com/.
|
188
|
+
|
189
|
+
## Explorer's Hub
|
190
|
+
|
191
|
+
New Relic hosts and moderates an online forum where customers can interact with
|
192
|
+
New Relic employees as well as other customers to get help and share best
|
193
|
+
practices. Like all official New Relic open source projects, there's a related
|
194
|
+
Community topic in the New Relic Explorers Hub. You can find this project's
|
195
|
+
topic/threads here:
|
78
196
|
|
79
|
-
|
197
|
+
[Explorer's Hub](https://discuss.newrelic.com/tags/rubyagent)
|
80
198
|
|
81
|
-
|
82
|
-
that you are granting New Relic a non-exclusive, non-revokable, no-cost license
|
83
|
-
to use the code, algorithms, patents, and ideas in that code in our products if
|
84
|
-
we so choose. Fortunately, you also agree the code is provided as-is and you provide no
|
85
|
-
warranties as to its fitness or correctness for any purpose.
|
199
|
+
## And Finally...
|
86
200
|
|
87
201
|
If you have any feedback on how we can make contributing easier, please get in
|
88
202
|
touch at [support.newrelic.com](http://support.newrelic.com) and let us know!
|
data/DOCKER.md
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
# Using Docker with the New Relic Ruby Agent
|
2
|
+
|
3
|
+
These instructions will guide you through the process of setting up Docker for
|
4
|
+
use with developing the New Relic Ruby Agent. The use of Docker containers can
|
5
|
+
provide for a consistent experience free from machine specific issues.
|
6
|
+
|
7
|
+
## Quick Start
|
8
|
+
|
9
|
+
```shell
|
10
|
+
# unit tests (Ruby only)
|
11
|
+
$ docker build -t newrelic_rpm .
|
12
|
+
$ docker run --rm newrelic_rpm
|
13
|
+
|
14
|
+
# or
|
15
|
+
|
16
|
+
# functional tests (MySQL, PostgreSQL, Redis, etc.)
|
17
|
+
$ docker-compose up
|
18
|
+
$ docker-compose exec app bundle exec rake test:all
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
## Install Docker
|
23
|
+
|
24
|
+
You will need to have [Docker Desktop](https://www.docker.com/) installed and
|
25
|
+
running on your machine.
|
26
|
+
|
27
|
+
If you are using on macOS and using [Homebrew](https://brew.sh/), Docker can be
|
28
|
+
installed as a cask via:
|
29
|
+
|
30
|
+
```shell
|
31
|
+
$ brew install --cask docker
|
32
|
+
```
|
33
|
+
|
34
|
+
and then launched via the `/Applications/Docker.app` launcher that is installed.
|
35
|
+
|
36
|
+
For alternatives to using macOS with Homebrew, see Docker's
|
37
|
+
[Get Started Guide](https://www.docker.com/get-started).
|
38
|
+
|
39
|
+
|
40
|
+
## Clone the project
|
41
|
+
|
42
|
+
Use git to clone the [newrelic/newrelic-ruby-agent](https://github.com/newrelic/newrelic-ruby-agent)
|
43
|
+
project.
|
44
|
+
|
45
|
+
The [Dockerfile](Dockerfile) and [docker-compose.yml](docker-compose.yml)
|
46
|
+
files are located in the root of the project, where this `DOCKER.md`
|
47
|
+
document resides.
|
48
|
+
|
49
|
+
|
50
|
+
## Using just the Dockerfile (unit tests and standalone dev only)
|
51
|
+
|
52
|
+
The project `Dockerfile` can be used by itself to run the project unit tests.
|
53
|
+
Docker Compose and the project `docker-compose.yml` file will be needed to
|
54
|
+
run functional tests which involve communicating with data systems such as
|
55
|
+
PostgreSQL and Redis.
|
56
|
+
|
57
|
+
To run the unit tests using `Dockerfile` by itself, first change
|
58
|
+
directories to the root of the project, then build an image, and
|
59
|
+
finally run a container from the image:
|
60
|
+
|
61
|
+
```shell
|
62
|
+
$ cd /path/to/project/git/clone
|
63
|
+
$ docker build -t newrelic_rpm .
|
64
|
+
$ docker run --rm newrelic_rpm
|
65
|
+
```
|
66
|
+
|
67
|
+
The `Dockerfile` specifies a default Ruby version to test with. To override this
|
68
|
+
version, pass the `ruby_version` build arg like so when building the image:
|
69
|
+
|
70
|
+
```shell
|
71
|
+
docker build --build-arg ruby_version=2.7 .
|
72
|
+
```
|
73
|
+
|
74
|
+
**Legend:**
|
75
|
+
* `build -t <TAG>` applies a tag to the image during building.
|
76
|
+
* `.` indicates "here" and tells Docker that the `Dockerfile` file can be found
|
77
|
+
in the current directory
|
78
|
+
* `run --rm` tells Docker to remove the container after the tests complete.
|
79
|
+
* `--build-arg ruby_version=<RUBY VERSION>` specifies that a given Ruby version should be used (use MAJOR.MINOR or optionally MAJOR.MINOR.PATCH)
|
80
|
+
|
81
|
+
|
82
|
+
## Using Docker Compose (for functional tests and developing with services)
|
83
|
+
|
84
|
+
Docker Compose launches multiple containers simultaneously to support the
|
85
|
+
running of the functional tests that require a variety of data handling
|
86
|
+
server applications such as PostgreSQL, Redis, memcached, etc. Each one of
|
87
|
+
these server applications uses its own container and then there's a Ruby
|
88
|
+
container (referred to as the "app" container) that runs the Minitest tests
|
89
|
+
while connecting to the other containers.
|
90
|
+
|
91
|
+
In one shell session, change to the root of the project and then bring up all
|
92
|
+
containers with Docker Compose:
|
93
|
+
|
94
|
+
```shell
|
95
|
+
$ docker-compose up
|
96
|
+
```
|
97
|
+
|
98
|
+
By default, `docker-compose` will use the default Ruby version specified in the
|
99
|
+
`Dockerfile` file. To override this version with a custom desired version, set
|
100
|
+
the `RUBY_VERSION` environment variable before calling `docker-compose`,
|
101
|
+
like so:
|
102
|
+
|
103
|
+
```shell
|
104
|
+
RUBY_VERSION=3.0 docker-compose up
|
105
|
+
```
|
106
|
+
|
107
|
+
In a separate shell session (probably in a separate terminal split, tab, or
|
108
|
+
window), execute the 'test:all' rake task to test all standard, environment,
|
109
|
+
and multiverse tests:
|
110
|
+
|
111
|
+
```shell
|
112
|
+
$ docker-compose exec app bundle exec rake test:all
|
113
|
+
```
|
114
|
+
|
115
|
+
In lieu of running the tests, an interactive Bash shell can be
|
116
|
+
launched against the running Ruby app container for development and/or
|
117
|
+
debugging. While the `docker-compose up` shell session is still running,
|
118
|
+
bring up an additional local shell session and run the following:
|
119
|
+
|
120
|
+
```shell
|
121
|
+
$ docker-compose exec app bash
|
122
|
+
```
|
123
|
+
|
124
|
+
You will be dropped at a Bash prompt as the "relic" user, with "ruby" and
|
125
|
+
"bundle" in your PATH.
|
126
|
+
|
127
|
+
|
128
|
+
## Output
|
129
|
+
|
130
|
+
When using Docker Compose, one shell session will produce STDOUT output that
|
131
|
+
pertains to all of the services (MySQL, MongoDB, etc.) and the other shell
|
132
|
+
session will produce STDOUT output related to the Ruby based functional tests.
|
133
|
+
Both streams of output may provide information about any errors or warnings
|
134
|
+
that take place.
|
135
|
+
|
136
|
+
|
137
|
+
## Cleanup
|
138
|
+
|
139
|
+
If the project `Dockerfile` is being used without Docker Compose, then use
|
140
|
+
`docker ps` to show information about containers and `docker images`
|
141
|
+
for information about images. The `docker stop`, `docker kill`, `docker rm`
|
142
|
+
and `docker rmi` commands can be used with the appropriate container and image
|
143
|
+
ids. Run `docker --help` or read through the hosted [CLI documentation](https://docs.docker.com/engine/reference/commandline/docker/).
|
144
|
+
|
145
|
+
When Docker Compose is used, invoking `ctrl-c` in the shell session that is
|
146
|
+
running the `docker-compose up` command should suffice to prompt Docker Compose
|
147
|
+
to shut down all running containers. Otherwise, `docker-compose down` can be
|
148
|
+
ran after the `docker-compose up` process has been stopped. All relevant
|
149
|
+
containers and images can then be optionally discarded using the `docker` CLI
|
150
|
+
commands described in the previous paragraph.
|
151
|
+
|
152
|
+
Use `docker ps -a` to show a list of all containers. Pass a container id to
|
153
|
+
`docker rm` (ex: `docker rm 5c15ee2f1c4f`) to remove it.
|
154
|
+
|
155
|
+
Use `docker images` to show a list of all images. Typically, you'll want to
|
156
|
+
keep these images if you plan on running Docker with them again in the future.
|
157
|
+
If you are done with them, you can pass an image id to `docker rmi` to remove
|
158
|
+
an image (ex: `docker rmi 4253856b2570`).
|
159
|
+
|
160
|
+
## Questions, Feature Requests, Contributions, etc.
|
161
|
+
|
162
|
+
The maintainers of New Relic's Ruby agent project are hopeful that the use of
|
163
|
+
containers and these instructions can provide consistency and a lowered barrier
|
164
|
+
of entry when it comes to providing contributions to the agent project itself.
|
165
|
+
|
166
|
+
For questions, feature requests, proposals to support Podman, PRs to improve
|
167
|
+
behavior or documentation, etc., please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
data/Dockerfile
ADDED
data/Gemfile
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
-
|
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
|
2
4
|
|
3
|
-
|
5
|
+
source 'https://rubygems.org'
|
6
|
+
gemspec name: "newrelic_rpm"
|
data/Guardfile
CHANGED
@@ -1,14 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require './test/multiverse/lib/multiverse/bundler_patch'
|
3
|
+
|
4
|
+
test_folders = Dir.glob("test/new_relic/*").select { |f| File.directory?(f) }
|
5
|
+
test_folders += Dir.glob("test/new_relic/**/*").select { |f| File.directory?(f) }
|
6
|
+
|
7
|
+
rake_lib_path = Bundler.with_unbundled_env { `bundle exec gem which rake`.chomp.gsub("lib/rake.rb", "lib") }
|
8
|
+
ruby_options = %(-w -I"#{rake_lib_path}" "#{rake_lib_path}/rake/rake_test_loader.rb")
|
9
|
+
|
1
10
|
guard_options = {
|
2
|
-
spring: "bundle exec ruby",
|
3
|
-
test_folders: ['test/new_relic'
|
4
|
-
all_after_pass: false
|
11
|
+
spring: "bundle exec ruby #{ruby_options} ",
|
12
|
+
test_folders: ['test/new_relic'] + test_folders,
|
13
|
+
all_after_pass: false,
|
14
|
+
all_on_start: false
|
5
15
|
}
|
6
16
|
|
7
17
|
guard :minitest, guard_options do
|
8
|
-
watch(%r{^lib/(.+)\.rb$})
|
18
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
9
19
|
watch(%r{^test/.+_test\.rb$})
|
10
|
-
watch(%r{^test/rum/.*})
|
11
|
-
watch(
|
20
|
+
watch(%r{^test/rum/.*}) { "test/new_relic/rack/browser_monitoring_test.rb" }
|
21
|
+
watch(%r{^test/fixtures/cross_agent_tests/distributed_tracing/(.+).json}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
|
22
|
+
watch('test/test_helper.rb') { "test/new_relic" }
|
12
23
|
watch('test/agent_helper.rb') { "test/new_relic" }
|
13
24
|
watch('lib/new_relic/agent/configuration/default_source.rb') { "test/new_relic/agent/configuration/orphan_configuration_test.rb" }
|
25
|
+
watch(%r{^lib/new_relic/agent/transaction/(.+).rb}) { |m| "test/new_relic/agent/distributed_tracing/#{m[1]}_cross_agent_test.rb" }
|
14
26
|
end
|
data/LICENSE
CHANGED
@@ -1,38 +1,202 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
202
|
+
|