newrelic_rpm 6.7.0.359 → 6.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/CHANGELOG.md +493 -4
- data/CONTRIBUTING.md +106 -19
- data/Gemfile +6 -2
- data/Guardfile +18 -1
- data/LICENSE +208 -38
- data/README.md +81 -85
- data/ROADMAP.md +24 -0
- data/Rakefile +2 -0
- data/THIRD_PARTY_NOTICES.md +213 -0
- data/bin/nrdebug +1 -1
- data/init.rb +1 -1
- data/install.rb +1 -1
- data/lib/new_relic/agent/adaptive_sampler.rb +1 -1
- data/lib/new_relic/agent/agent.rb +63 -44
- data/lib/new_relic/agent/agent_logger.rb +5 -1
- data/lib/new_relic/agent/attribute_filter.rb +8 -8
- data/lib/new_relic/agent/attribute_processing.rb +1 -1
- data/lib/new_relic/agent/attributes.rb +152 -0
- data/lib/new_relic/agent/audit_logger.rb +11 -1
- data/lib/new_relic/agent/autostart.rb +20 -15
- 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 +1 -1
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +138 -17
- data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -1
- data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
- 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 +1 -1
- data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
- data/lib/new_relic/agent/configuration/security_policy_source.rb +1 -1
- data/lib/new_relic/agent/configuration/server_source.rb +2 -2
- data/lib/new_relic/agent/configuration/yaml_source.rb +12 -7
- data/lib/new_relic/agent/configuration.rb +1 -1
- data/lib/new_relic/agent/connect/request_builder.rb +4 -12
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
- data/lib/new_relic/agent/database/obfuscator.rb +1 -1
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
- data/lib/new_relic/agent/database.rb +2 -3
- data/lib/new_relic/agent/database_adapter.rb +33 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +3 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +9 -9
- data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo.rb +2 -2
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/datastores.rb +1 -1
- data/lib/new_relic/agent/deprecator.rb +1 -1
- data/lib/new_relic/agent/{cross_app_payload.rb → distributed_tracing/cross_app_payload.rb} +3 -2
- data/lib/new_relic/agent/{cross_app_tracing.rb → distributed_tracing/cross_app_tracing.rb} +61 -46
- 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_trace_payload.rb → distributed_tracing/distributed_trace_payload.rb} +25 -102
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +39 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +246 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +126 -0
- data/lib/new_relic/agent/distributed_tracing.rb +156 -7
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +34 -17
- data/lib/new_relic/agent/error_event_aggregator.rb +8 -6
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
- data/lib/new_relic/agent/event_aggregator.rb +1 -1
- 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 +1 -1
- data/lib/new_relic/agent/external.rb +8 -8
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/harvester.rb +1 -1
- data/lib/new_relic/agent/heap.rb +1 -1
- data/lib/new_relic/agent/hostname.rb +8 -2
- data/lib/new_relic/agent/http_clients/abstract.rb +82 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +25 -20
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +29 -14
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +18 -22
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +11 -12
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +17 -5
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +5 -7
- data/lib/new_relic/agent/http_clients/uri_util.rb +12 -11
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -8
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +5 -1
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +12 -4
- data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +85 -38
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +17 -6
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +35 -11
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +8 -3
- data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +9 -5
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +10 -9
- data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +48 -29
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +66 -19
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +4 -2
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +3 -1
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +7 -4
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +2 -2
- data/lib/new_relic/agent/instrumentation/grape.rb +6 -11
- data/lib/new_relic/agent/instrumentation/http.rb +7 -4
- data/lib/new_relic/agent/instrumentation/httpclient.rb +6 -4
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -3
- data/lib/new_relic/agent/instrumentation/memcache.rb +4 -2
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +9 -7
- data/lib/new_relic/agent/instrumentation/mongo.rb +10 -4
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +36 -3
- data/lib/new_relic/agent/instrumentation/net.rb +48 -28
- data/lib/new_relic/agent/instrumentation/net_prepend.rb +40 -0
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +26 -2
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +3 -1
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +2 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +12 -6
- data/lib/new_relic/agent/instrumentation/resque.rb +4 -1
- data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +48 -24
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -2
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +24 -7
- 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 +1 -1
- data/lib/new_relic/agent/log_once.rb +1 -1
- data/lib/new_relic/agent/logging.rb +19 -5
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +6 -74
- data/lib/new_relic/agent/method_tracer.rb +10 -8
- data/lib/new_relic/agent/method_tracer_helpers.rb +3 -3
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +110 -0
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +27 -0
- data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +2 -2
- data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +3 -5
- data/lib/new_relic/agent/monitors.rb +27 -0
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
- 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 +34 -10
- data/lib/new_relic/agent/noticible_error.rb +22 -0
- data/lib/new_relic/agent/null_logger.rb +1 -1
- data/lib/new_relic/agent/obfuscator.rb +1 -1
- 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 +1 -1
- data/lib/new_relic/agent/pipe_service.rb +1 -1
- data/lib/new_relic/agent/prepend_supportability.rb +1 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +8 -5
- data/lib/new_relic/agent/range_extensions.rb +1 -1
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine.rb +1 -1
- 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 +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +2 -2
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/vm_sampler.rb +1 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -1
- data/lib/new_relic/agent/span_event_primitive.rb +108 -54
- data/lib/new_relic/agent/sql_sampler.rb +6 -6
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +2 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
- data/lib/new_relic/agent/stats_engine.rb +1 -1
- data/lib/new_relic/agent/supported_versions.rb +3 -3
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/system_info.rb +13 -4
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
- data/lib/new_relic/agent/threading/thread_profile.rb +1 -1
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +34 -19
- data/lib/new_relic/agent/transaction/abstract_segment.rb +32 -5
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +177 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +58 -147
- data/lib/new_relic/agent/transaction/external_request_segment.rb +32 -39
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -12
- data/lib/new_relic/agent/transaction/request_attributes.rb +1 -1
- data/lib/new_relic/agent/transaction/segment.rb +28 -2
- 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 -5
- data/lib/new_relic/agent/transaction/trace_builder.rb +1 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +11 -9
- data/lib/new_relic/agent/transaction/tracing.rb +1 -1
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +104 -82
- data/lib/new_relic/agent/transaction_error_primitive.rb +11 -16
- data/lib/new_relic/agent/transaction_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -40
- data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
- data/lib/new_relic/agent/transaction_metrics.rb +1 -1
- data/lib/new_relic/agent/transaction_sampler.rb +1 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
- data/lib/new_relic/agent/utilization/aws.rb +1 -1
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization/gcp.rb +1 -1
- data/lib/new_relic/agent/utilization/pcf.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +1 -1
- 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 +7 -5
- data/lib/new_relic/agent/vm/snapshot.rb +1 -1
- data/lib/new_relic/agent/vm.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +49 -8
- data/lib/new_relic/cli/command.rb +1 -1
- data/lib/new_relic/cli/commands/deployments.rb +1 -2
- data/lib/new_relic/cli/commands/install.rb +4 -3
- data/lib/new_relic/coerce.rb +32 -7
- data/lib/new_relic/collection_helper.rb +1 -1
- data/lib/new_relic/constants.rb +42 -0
- 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/merb.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +1 -1
- 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 +11 -2
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/server_methods.rb +1 -1
- 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 +9 -5
- data/lib/new_relic/environment_report.rb +2 -4
- data/lib/new_relic/helper.rb +1 -1
- data/lib/new_relic/language_support.rb +1 -1
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/local_environment.rb +1 -1
- data/lib/new_relic/metric_data.rb +1 -1
- data/lib/new_relic/metric_spec.rb +1 -1
- data/lib/new_relic/noticed_error.rb +39 -18
- 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 +6 -1
- data/lib/new_relic/rack.rb +1 -1
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/supportability_helper.rb +17 -1
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +1 -1
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/multiverse.rb +35 -1
- data/lib/tasks/newrelic.rb +1 -1
- data/lib/tasks/tests.rake +6 -1
- data/newrelic_rpm.gemspec +18 -13
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +339 -72
- metadata +104 -41
- data/.travis.yml +0 -175
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -110
- data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -40
- data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- data/lib/new_relic/build.rb +0 -2
- data/lib/new_relic/metrics.rb +0 -13
- data/lib/tasks/versions.html.erb +0 -28
- data/lib/tasks/versions.postface.html +0 -8
- data/lib/tasks/versions.preface.html +0 -9
- data/lib/tasks/versions.rake +0 -65
- data/lib/tasks/versions.txt.erb +0 -14
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/utilization/vendor'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/utilization/vendor'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'net/http'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/utilization/aws'
|
6
6
|
require 'new_relic/agent/utilization/gcp'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'thread'
|
6
6
|
require 'new_relic/agent/vm/snapshot'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
# The GC::Profiler class available on MRI has to be reset periodically to avoid
|
6
6
|
# memory "leaking" in the underlying implementation. However, it's a major
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'thread'
|
6
6
|
require 'new_relic/agent/vm/snapshot'
|
@@ -45,9 +45,11 @@ module NewRelic
|
|
45
45
|
|
46
46
|
def gather_ruby_vm_stats(snap)
|
47
47
|
if supports?(:method_cache_invalidations)
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
snap.method_cache_invalidations = RubyVM.stat[:global_method_state]
|
49
|
+
end
|
50
|
+
|
51
|
+
if supports?(:constant_cache_invalidations)
|
52
|
+
snap.constant_cache_invalidations = RubyVM.stat[:global_constant_state]
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
@@ -66,7 +68,7 @@ module NewRelic
|
|
66
68
|
when :minor_gc_count
|
67
69
|
RUBY_VERSION >= '2.1.0'
|
68
70
|
when :method_cache_invalidations
|
69
|
-
RUBY_VERSION >= '2.1.0'
|
71
|
+
RUBY_VERSION >= '2.1.0' && RUBY_VERSION < '3.0.0'
|
70
72
|
when :constant_cache_invalidations
|
71
73
|
RUBY_VERSION >= '2.1.0'
|
72
74
|
else
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
data/lib/new_relic/agent/vm.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/language_support'
|
6
6
|
require 'new_relic/agent/vm/mri_vm'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'thread'
|
6
6
|
|
data/lib/new_relic/agent.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'forwardable'
|
6
6
|
|
@@ -26,16 +26,15 @@ module NewRelic
|
|
26
26
|
|
27
27
|
require 'new_relic/version'
|
28
28
|
require 'new_relic/local_environment'
|
29
|
-
require 'new_relic/metrics'
|
30
29
|
require 'new_relic/metric_spec'
|
31
30
|
require 'new_relic/metric_data'
|
32
31
|
require 'new_relic/noticed_error'
|
32
|
+
require 'new_relic/agent/noticible_error'
|
33
33
|
require 'new_relic/supportability_helper'
|
34
34
|
|
35
35
|
require 'new_relic/agent/encoding_normalizer'
|
36
36
|
require 'new_relic/agent/stats'
|
37
37
|
require 'new_relic/agent/chained_call'
|
38
|
-
require 'new_relic/agent/cross_app_monitor'
|
39
38
|
require 'new_relic/agent/agent'
|
40
39
|
require 'new_relic/agent/method_tracer'
|
41
40
|
require 'new_relic/agent/worker_loop'
|
@@ -47,6 +46,7 @@ module NewRelic
|
|
47
46
|
require 'new_relic/agent/error_collector'
|
48
47
|
require 'new_relic/agent/sampler'
|
49
48
|
require 'new_relic/agent/database'
|
49
|
+
require 'new_relic/agent/database_adapter'
|
50
50
|
require 'new_relic/agent/datastores'
|
51
51
|
require 'new_relic/agent/pipe_channel_manager'
|
52
52
|
require 'new_relic/agent/configuration'
|
@@ -56,6 +56,8 @@ module NewRelic
|
|
56
56
|
require 'new_relic/agent/external'
|
57
57
|
require 'new_relic/agent/deprecator'
|
58
58
|
require 'new_relic/agent/logging'
|
59
|
+
require 'new_relic/agent/distributed_tracing'
|
60
|
+
require 'new_relic/agent/attribute_processing'
|
59
61
|
|
60
62
|
require 'new_relic/agent/instrumentation/controller_instrumentation'
|
61
63
|
|
@@ -351,10 +353,9 @@ module NewRelic
|
|
351
353
|
# @api public
|
352
354
|
#
|
353
355
|
def manual_start(options={})
|
354
|
-
record_api_supportability_metric(:manual_start)
|
355
|
-
|
356
356
|
raise "Options must be a hash" unless Hash === options
|
357
357
|
NewRelic::Control.instance.init_plugin({ :agent_enabled => true, :sync_startup => true }.merge(options))
|
358
|
+
record_api_supportability_metric(:manual_start)
|
358
359
|
end
|
359
360
|
|
360
361
|
# Register this method as a callback for processes that fork
|
@@ -568,6 +569,12 @@ module NewRelic
|
|
568
569
|
# these custom attributes will also be present in the script injected into
|
569
570
|
# the response body, making them available on Insights PageView events.
|
570
571
|
#
|
572
|
+
#
|
573
|
+
# @param [Hash] params A Hash of attributes to be attached to the transaction event.
|
574
|
+
# Keys should be strings or symbols, and values
|
575
|
+
# may be strings, symbols, numeric values or
|
576
|
+
# booleans.
|
577
|
+
#
|
571
578
|
# @api public
|
572
579
|
#
|
573
580
|
def add_custom_attributes(params) #THREAD_LOCAL_ACCESS
|
@@ -576,11 +583,43 @@ module NewRelic
|
|
576
583
|
if params.is_a? Hash
|
577
584
|
txn = Transaction.tl_current
|
578
585
|
txn.add_custom_attributes(params) if txn
|
586
|
+
|
587
|
+
segment = ::NewRelic::Agent::Tracer.current_segment
|
588
|
+
if segment
|
589
|
+
# Make sure not to override existing segment-level custom attributes
|
590
|
+
segment_custom_keys = segment.attributes.custom_attributes.keys.map(&:to_sym)
|
591
|
+
segment.add_custom_attributes(params.reject { |k, _v| segment_custom_keys.include?(k.to_sym) })
|
592
|
+
end
|
579
593
|
else
|
580
594
|
::NewRelic::Agent.logger.warn("Bad argument passed to #add_custom_attributes. Expected Hash but got #{params.class}")
|
581
595
|
end
|
582
596
|
end
|
583
597
|
|
598
|
+
# Add custom attributes to the span event for the current span. Attributes will be visible on spans in the
|
599
|
+
# New Relic Distributed Tracing UI and on span events in New Relic Insights.
|
600
|
+
#
|
601
|
+
# Custom attributes will not be transmitted when +high_security+ setting is enabled or
|
602
|
+
# +custom_attributes+ setting is disabled.
|
603
|
+
#
|
604
|
+
# @param [Hash] params A Hash of attributes to be attached to the span event.
|
605
|
+
# Keys should be strings or symbols, and values
|
606
|
+
# may be strings, symbols, numeric values or
|
607
|
+
# booleans.
|
608
|
+
#
|
609
|
+
# @see https://docs.newrelic.com/docs/using-new-relic/welcome-new-relic/get-started/glossary#span
|
610
|
+
# @api public
|
611
|
+
def add_custom_span_attributes params
|
612
|
+
record_api_supportability_metric :add_custom_span_attributes
|
613
|
+
|
614
|
+
if params.is_a? Hash
|
615
|
+
if segment = NewRelic::Agent::Tracer.current_segment
|
616
|
+
segment.add_custom_attributes params
|
617
|
+
end
|
618
|
+
else
|
619
|
+
::NewRelic::Agent.logger.warn "Bad argument passed to #add_custom_span_attributes. Expected Hash but got #{params.class}"
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
584
623
|
# @!endgroup
|
585
624
|
|
586
625
|
# @!group Transaction naming
|
@@ -589,7 +628,9 @@ module NewRelic
|
|
589
628
|
# apply a reasonable default based on framework routing, but in
|
590
629
|
# cases where this is insufficient, this can be used to manually
|
591
630
|
# control the name of the transaction.
|
592
|
-
#
|
631
|
+
#
|
632
|
+
# The category of transaction can be specified via the +:category+ option.
|
633
|
+
# The following are the only valid categories:
|
593
634
|
#
|
594
635
|
# * <tt>:category => :controller</tt> indicates that this is a
|
595
636
|
# controller action and will appear with all the other actions.
|
@@ -639,8 +680,8 @@ module NewRelic
|
|
639
680
|
# @param [String] method the name of the finder method or other method to
|
640
681
|
# identify the operation with.
|
641
682
|
#
|
642
|
-
def with_database_metric_name(model, method = nil, product = nil, &block)
|
643
|
-
if txn =
|
683
|
+
def with_database_metric_name(model, method = nil, product = nil, &block)
|
684
|
+
if txn = Tracer.current_transaction
|
644
685
|
txn.with_database_metric_name(model, method, product, &block)
|
645
686
|
else
|
646
687
|
yield
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'optparse'
|
6
6
|
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
# This is a class for executing commands related to deployment
|
6
6
|
# events. It runs without loading the rails environment
|
7
7
|
|
8
8
|
require 'yaml'
|
9
9
|
require 'net/http'
|
10
|
-
require 'rexml/document'
|
11
10
|
require 'new_relic/agent/hostname'
|
12
11
|
|
13
12
|
# We need to use the Control object but we don't want to load
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'fileutils'
|
6
6
|
require 'new_relic/version'
|
@@ -40,8 +40,8 @@ class NewRelic::Cli::Install < NewRelic::Cli::Command
|
|
40
40
|
|
41
41
|
def run
|
42
42
|
dest_file = File.expand_path(@dest_dir + "/newrelic.yml")
|
43
|
-
if File.exist?(dest_file)
|
44
|
-
raise NewRelic::Cli::Command::CommandFailure, "newrelic.yml file already exists.
|
43
|
+
if File.exist?(dest_file) && !@force
|
44
|
+
raise NewRelic::Cli::Command::CommandFailure, "newrelic.yml file already exists. Use --force flag to overwrite."
|
45
45
|
end
|
46
46
|
File.open(dest_file, 'w') { | out | out.puts(content) }
|
47
47
|
|
@@ -73,6 +73,7 @@ Visit support.newrelic.com if you are experiencing installation issues.
|
|
73
73
|
|
74
74
|
def options
|
75
75
|
OptionParser.new "Usage: #{$0} #{self.class.command} [ OPTIONS] 'application name'", 40 do |o|
|
76
|
+
o.on("-f", "--force", "Overwrite newrelic.yml if it exists") { | e | @force = true }
|
76
77
|
o.on("-l", "--license_key=NAME", String,
|
77
78
|
"Use the given license key") { | e | @license_key = e }
|
78
79
|
o.on("-d", "--destdir=name", String,
|
data/lib/new_relic/coerce.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
module NewRelic
|
6
|
-
# We really don't want to send bad values to the collector, and it doesn't
|
7
|
-
# accept types like Rational that have occasionally slipped into our data.
|
8
|
-
#
|
9
|
-
# These methods are intended to safely coerce things into the form we want,
|
10
|
-
# to provide documentation of expected types on to_collector_array methods,
|
11
|
-
# and to log failures if totally invalid data gets into outgoing data
|
12
7
|
module Coerce
|
8
|
+
|
13
9
|
module_function
|
14
10
|
|
11
|
+
# We really don't want to send bad values to the collector, and it doesn't
|
12
|
+
# accept types like Rational that have occasionally slipped into our data.
|
13
|
+
#
|
14
|
+
# These non-bang methods are intended to safely coerce things into the form we want,
|
15
|
+
# to provide documentation of expected types on to_collector_array methods,
|
16
|
+
# and to log failures if totally invalid data gets into outgoing data
|
17
|
+
|
15
18
|
def int(value, context=nil)
|
16
19
|
Integer(value)
|
17
20
|
rescue => error
|
@@ -61,6 +64,28 @@ module NewRelic
|
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
67
|
+
def int! value
|
68
|
+
return nil unless value_or_nil(value)
|
69
|
+
Integer(value)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Use when you plan to perform a boolean check using the integer 1
|
73
|
+
# for true and the integer 0 for false
|
74
|
+
# String values will be converted to 0
|
75
|
+
def boolean_int! value
|
76
|
+
value.to_i
|
77
|
+
end
|
78
|
+
|
79
|
+
def float! value, precision=NewRelic::PRIORITY_PRECISION
|
80
|
+
return nil unless value_or_nil(value)
|
81
|
+
value.to_f.round(precision)
|
82
|
+
end
|
83
|
+
|
84
|
+
def value_or_nil value
|
85
|
+
return nil if value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
86
|
+
value
|
87
|
+
end
|
88
|
+
|
64
89
|
def log_failure(value, type, context, error)
|
65
90
|
msg = "Unable to convert '#{value}' to #{type}"
|
66
91
|
msg += " in context '#{context}'" if context
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module CollectionHelper
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# This file is distributed under New Relic's license terms.
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
module NewRelic
|
7
|
+
PRIORITY_PRECISION = 6
|
8
|
+
|
9
|
+
EMPTY_ARRAY = [].freeze
|
10
|
+
EMPTY_HASH = {}.freeze
|
11
|
+
EMPTY_STR = ""
|
12
|
+
|
13
|
+
HTTP = "HTTP"
|
14
|
+
HTTPS = "HTTPS"
|
15
|
+
UNKNOWN = "Unknown"
|
16
|
+
|
17
|
+
FORMAT_NON_RACK = 0
|
18
|
+
FORMAT_RACK = 1
|
19
|
+
|
20
|
+
NEWRELIC_KEY = "newrelic"
|
21
|
+
CANDIDATE_NEWRELIC_KEYS = [
|
22
|
+
NEWRELIC_KEY,
|
23
|
+
'NEWRELIC',
|
24
|
+
'NewRelic',
|
25
|
+
'Newrelic'
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
TRACEPARENT_KEY = "traceparent"
|
29
|
+
TRACESTATE_KEY = "tracestate"
|
30
|
+
|
31
|
+
# Right now, old and new Rubies are the same. Intention is to use "(...)" for
|
32
|
+
# Ruby 2.7+ for argument delegation, but doing so is a breaking API change.
|
33
|
+
ARGS_FOR_RUBY_VERSION = RUBY_VERSION < "2.7.0" ? "*args, &block" : "*args, &block"
|
34
|
+
|
35
|
+
HTTP_TRACEPARENT_KEY = "HTTP_#{TRACEPARENT_KEY.upcase}"
|
36
|
+
HTTP_TRACESTATE_KEY = "HTTP_#{TRACESTATE_KEY.upcase}"
|
37
|
+
HTTP_NEWRELIC_KEY = "HTTP_#{NEWRELIC_KEY.upcase}"
|
38
|
+
|
39
|
+
CONNECT_RETRY_PERIODS = [15, 15, 30, 60, 120, 300]
|
40
|
+
MIN_RETRY_PERIOD = 15
|
41
|
+
MAX_RETRY_PERIOD = 300
|
42
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/ruby'
|
6
6
|
module NewRelic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/ruby'
|
6
6
|
module NewRelic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/rails'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/rails3'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/rails4'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/control/frameworks/ruby'
|
6
6
|
module NewRelic
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/null_logger'
|
6
6
|
require 'new_relic/agent/memory_logger'
|
@@ -101,7 +101,13 @@ module NewRelic
|
|
101
101
|
Agent.config.replace_or_add_config(manual)
|
102
102
|
|
103
103
|
config_file_path = @config_file_override || Agent.config[:config_path]
|
104
|
-
Agent
|
104
|
+
yaml_source = Agent::Configuration::YamlSource.new(config_file_path, env)
|
105
|
+
if yaml_source.failed?
|
106
|
+
yaml_source.failures.each do |msg|
|
107
|
+
stdout.puts Agent::AgentLogger.format_fatal_error(msg)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
Agent.config.replace_or_add_config(yaml_source)
|
105
111
|
|
106
112
|
if security_settings_valid? && Agent.config[:high_security]
|
107
113
|
Agent.logger.info("Installing high security configuration based on local configuration")
|
@@ -172,6 +178,9 @@ module NewRelic
|
|
172
178
|
'.'
|
173
179
|
end
|
174
180
|
|
181
|
+
def stdout
|
182
|
+
STDOUT
|
183
|
+
end
|
175
184
|
end
|
176
185
|
include InstanceMethods
|
177
186
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
class Control
|
data/lib/new_relic/control.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'yaml'
|
6
6
|
require 'new_relic/dependency_detection'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module DelayedJobInjection
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module DependencyDetection
|
6
6
|
|
@@ -67,6 +67,10 @@ module DependencyDetection
|
|
67
67
|
!executed and check_dependencies
|
68
68
|
end
|
69
69
|
|
70
|
+
def source_location_for klass, method_name
|
71
|
+
Object.instance_method(:method).bind(klass.allocate).call(method_name).source_location.to_s
|
72
|
+
end
|
73
|
+
|
70
74
|
def execute
|
71
75
|
@executes.each do |x|
|
72
76
|
begin
|
@@ -93,8 +97,8 @@ module DependencyDetection
|
|
93
97
|
end
|
94
98
|
end
|
95
99
|
|
96
|
-
def depends_on
|
97
|
-
@dependencies <<
|
100
|
+
def depends_on &block
|
101
|
+
@dependencies << block if block_given?
|
98
102
|
end
|
99
103
|
|
100
104
|
def allowed_by_config?
|
@@ -114,8 +118,8 @@ module DependencyDetection
|
|
114
118
|
self.name = new_name
|
115
119
|
end
|
116
120
|
|
117
|
-
def executes
|
118
|
-
@executes <<
|
121
|
+
def executes &block
|
122
|
+
@executes << block if block_given?
|
119
123
|
end
|
120
124
|
end
|
121
125
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
# The EnvironmentReport is responsible for analyzing the application's
|
@@ -69,9 +69,7 @@ module NewRelic
|
|
69
69
|
report_on('Arch' ) { ::NewRelic::Agent::SystemInfo.processor_arch }
|
70
70
|
report_on('OS version' ) { ::NewRelic::Agent::SystemInfo.os_version }
|
71
71
|
report_on('OS' ) { ::NewRelic::Agent::SystemInfo.ruby_os_identifier }
|
72
|
-
report_on('Database adapter' )
|
73
|
-
ActiveRecord::Base.configurations[NewRelic::Control.instance.env]['adapter']
|
74
|
-
end
|
72
|
+
report_on('Database adapter' ) { ::NewRelic::Agent::DatabaseAdapter.value }
|
75
73
|
report_on('Framework' ) { Agent.config[:framework].to_s }
|
76
74
|
report_on('Dispatcher' ) { Agent.config[:dispatcher].to_s }
|
77
75
|
report_on('Environment' ) { NewRelic::Control.instance.env }
|
data/lib/new_relic/helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/language_support'
|
6
6
|
|