newrelic_rpm 4.8.0.341 → 6.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
- data/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- data/.github/actions/annotate/README.md +79 -0
- data/.github/actions/annotate/action.yml +6 -0
- data/.github/actions/annotate/dist/index.js +433 -0
- data/.github/actions/annotate/index.js +25 -0
- data/.github/actions/annotate/package-lock.json +172 -0
- data/.github/actions/annotate/package.json +30 -0
- data/.github/actions/annotate/pre-commit +5 -0
- data/.github/actions/build-ruby/README.md +79 -0
- data/.github/actions/build-ruby/action.yml +15 -0
- data/.github/actions/build-ruby/dist/index.js +52683 -0
- data/.github/actions/build-ruby/index.js +514 -0
- data/.github/actions/build-ruby/package-lock.json +581 -0
- data/.github/actions/build-ruby/package.json +32 -0
- data/.github/actions/build-ruby/pre-commit +5 -0
- data/.github/pull_request_template.md +16 -0
- data/.github/workflows/ci.yml +212 -0
- data/.github/workflows/pr_review_checklist.yml +22 -0
- data/.github/workflows/release.yml +78 -0
- data/.github/workflows/scripts/rubygems-authenticate.py +13 -0
- data/.github/workflows/scripts/rubygems-publish.rb +32 -0
- data/.github/workflows/snyk.yml +27 -0
- data/.github/workflows/stale.yml +21 -0
- data/.gitignore +9 -0
- data/.yardopts +4 -1
- data/CHANGELOG.md +868 -3
- data/CONTRIBUTING.md +106 -19
- data/Gemfile +6 -2
- data/Guardfile +18 -1
- data/LICENSE +208 -38
- data/README.md +81 -88
- data/ROADMAP.md +24 -0
- data/Rakefile +2 -0
- data/THIRD_PARTY_NOTICES.md +213 -0
- data/bin/nrdebug +1 -1
- data/config.dot +3 -12
- data/init.rb +1 -1
- data/install.rb +1 -1
- data/lib/new_relic/agent.rb +145 -31
- data/lib/new_relic/agent/adaptive_sampler.rb +104 -0
- data/lib/new_relic/agent/agent.rb +192 -190
- data/lib/new_relic/agent/agent_logger.rb +5 -1
- data/lib/new_relic/agent/attribute_filter.rb +85 -25
- 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 +1 -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 +3 -22
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
- data/lib/new_relic/agent/configuration.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +375 -67
- data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -1
- data/lib/new_relic/agent/configuration/environment_source.rb +5 -3
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +45 -0
- data/lib/new_relic/agent/configuration/high_security_source.rb +2 -3
- data/lib/new_relic/agent/configuration/manager.rb +54 -43
- 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 +238 -0
- data/lib/new_relic/agent/configuration/server_source.rb +46 -5
- data/lib/new_relic/agent/configuration/yaml_source.rb +12 -7
- data/lib/new_relic/agent/connect/request_builder.rb +61 -0
- data/lib/new_relic/agent/connect/response_handler.rb +61 -0
- data/lib/new_relic/agent/custom_event_aggregator.rb +17 -6
- data/lib/new_relic/agent/database.rb +21 -3
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +12 -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/datastores.rb +12 -11
- data/lib/new_relic/agent/datastores/metric_helper.rb +2 -3
- data/lib/new_relic/agent/datastores/mongo.rb +2 -2
- 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/redis.rb +1 -1
- data/lib/new_relic/agent/deprecator.rb +1 -1
- data/lib/new_relic/agent/distributed_tracing.rb +216 -0
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +44 -0
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +248 -0
- 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 +165 -0
- 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/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +51 -20
- data/lib/new_relic/agent/error_event_aggregator.rb +14 -7
- data/lib/new_relic/agent/error_trace_aggregator.rb +2 -1
- data/lib/new_relic/agent/event_aggregator.rb +34 -15
- 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 +31 -29
- 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 +140 -0
- data/lib/new_relic/agent/hostname.rb +16 -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.rb +1 -1
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +26 -43
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +56 -74
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +82 -56
- data/lib/new_relic/agent/instrumentation/active_job.rb +19 -17
- 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 +82 -24
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +168 -0
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +102 -31
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +47 -57
- data/lib/new_relic/agent/instrumentation/active_storage.rb +23 -0
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +63 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +24 -8
- data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +115 -44
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +18 -12
- data/lib/new_relic/agent/instrumentation/curb.rb +121 -35
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +6 -4
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +61 -25
- data/lib/new_relic/agent/instrumentation/excon.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +8 -5
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +4 -3
- data/lib/new_relic/agent/instrumentation/grape.rb +46 -35
- data/lib/new_relic/agent/instrumentation/http.rb +8 -5
- data/lib/new_relic/agent/instrumentation/httpclient.rb +7 -5
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache.rb +5 -3
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +10 -6
- 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 +13 -5
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +20 -11
- data/lib/new_relic/agent/instrumentation/mongo.rb +11 -5
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +39 -7
- data/lib/new_relic/agent/instrumentation/net.rb +60 -23
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +100 -0
- data/lib/new_relic/agent/instrumentation/padrino.rb +40 -16
- 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 +36 -13
- 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/{rails5 → rails_notifications}/action_cable.rb +8 -5
- data/lib/new_relic/agent/instrumentation/{rails5 → rails_notifications}/action_controller.rb +4 -4
- data/lib/new_relic/agent/instrumentation/{rails4 → rails_notifications}/action_view.rb +4 -4
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +56 -22
- data/lib/new_relic/agent/instrumentation/redis.rb +141 -56
- data/lib/new_relic/agent/instrumentation/resque.rb +21 -37
- data/lib/new_relic/agent/instrumentation/sequel.rb +2 -3
- 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.rb +62 -23
- 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/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +27 -10
- data/lib/new_relic/agent/internal_agent_error.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +19 -16
- data/lib/new_relic/agent/log_once.rb +1 -1
- data/lib/new_relic/agent/logging.rb +139 -0
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +15 -59
- data/lib/new_relic/agent/method_tracer.rb +42 -25
- data/lib/new_relic/agent/method_tracer_helpers.rb +5 -5
- data/lib/new_relic/agent/monitors.rb +27 -0
- 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} +4 -4
- data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +4 -7
- data/lib/new_relic/agent/new_relic_service.rb +174 -63
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -2
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +6 -27
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +61 -0
- 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 +19 -6
- 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 +5 -1
- data/lib/new_relic/agent/prepend_supportability.rb +1 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +95 -0
- data/lib/new_relic/agent/range_extensions.rb +1 -1
- data/lib/new_relic/agent/rules_engine.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/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 +1 -1
- 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 +49 -0
- data/lib/new_relic/agent/span_event_primitive.rb +206 -0
- data/lib/new_relic/agent/sql_sampler.rb +23 -7
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/stats_engine.rb +4 -4
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +1 -1
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
- data/lib/new_relic/agent/supported_versions.rb +3 -3
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +6 -13
- data/lib/new_relic/agent/system_info.rb +18 -8
- data/lib/new_relic/agent/threading/agent_thread.rb +6 -4
- data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +4 -4
- data/lib/new_relic/agent/threading/thread_profile.rb +10 -24
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +19 -0
- data/lib/new_relic/agent/tracer.rb +509 -0
- data/lib/new_relic/agent/transaction.rb +191 -278
- data/lib/new_relic/agent/transaction/abstract_segment.rb +38 -5
- data/lib/new_relic/agent/transaction/datastore_segment.rb +30 -5
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +171 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +123 -71
- data/lib/new_relic/agent/transaction/external_request_segment.rb +41 -89
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +7 -8
- data/lib/new_relic/agent/transaction/request_attributes.rb +1 -1
- data/lib/new_relic/agent/transaction/segment.rb +42 -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 +7 -23
- data/lib/new_relic/agent/transaction/trace_builder.rb +1 -2
- data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +12 -8
- data/lib/new_relic/agent/transaction/tracing.rb +2 -100
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction_error_primitive.rb +13 -22
- data/lib/new_relic/agent/transaction_event_aggregator.rb +7 -16
- data/lib/new_relic/agent/transaction_event_primitive.rb +31 -42
- data/lib/new_relic/agent/transaction_event_recorder.rb +8 -16
- data/lib/new_relic/agent/transaction_metrics.rb +1 -1
- data/lib/new_relic/agent/transaction_sampler.rb +3 -14
- data/lib/new_relic/agent/transaction_time_aggregator.rb +155 -0
- 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 +37 -2
- data/lib/new_relic/agent/vm.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 +1 -1
- data/lib/new_relic/agent/vm/snapshot.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/cli/command.rb +1 -1
- data/lib/new_relic/cli/commands/deployments.rb +2 -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 +38 -0
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/control/class_methods.rb +8 -2
- data/lib/new_relic/control/frameworks.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/{rails5.rb → rails_notifications.rb} +2 -2
- 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/instance_methods.rb +30 -4
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/server_methods.rb +1 -1
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +5 -5
- data/lib/new_relic/environment_report.rb +6 -2
- data/lib/new_relic/helper.rb +1 -1
- data/lib/new_relic/language_support.rb +1 -1
- data/lib/new_relic/latest_changes.rb +4 -4
- 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.rb +1 -1
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +2 -2
- data/lib/new_relic/rack/browser_monitoring.rb +16 -9
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/recipes/capistrano3.rb +6 -3
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
- data/lib/new_relic/supportability_helper.rb +15 -1
- data/lib/new_relic/version.rb +4 -4
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +3 -3
- data/lib/sequel/plugins/newrelic_instrumentation.rb +2 -2
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/config.rake +1 -2
- 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 +23 -17
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +357 -78
- metadata +154 -60
- data/.travis.yml +0 -173
- data/lib/new_relic/agent/busy_calculator.rb +0 -117
- data/lib/new_relic/agent/commands/xray_session.rb +0 -55
- data/lib/new_relic/agent/commands/xray_session_collection.rb +0 -161
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -140
- data/lib/new_relic/agent/cross_app_tracing.rb +0 -143
- data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -29
- data/lib/new_relic/agent/distributed_trace_payload.rb +0 -223
- data/lib/new_relic/agent/distributed_trace_priority_sampled_buffer.rb +0 -72
- data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
- data/lib/new_relic/agent/instrumentation/active_record_4.rb +0 -42
- data/lib/new_relic/agent/instrumentation/active_record_5.rb +0 -36
- data/lib/new_relic/agent/instrumentation/evented_subscriber.rb +0 -104
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +0 -32
- data/lib/new_relic/agent/instrumentation/rails5/action_view.rb +0 -27
- data/lib/new_relic/agent/sampled_buffer.rb +0 -68
- data/lib/new_relic/agent/sized_buffer.rb +0 -23
- data/lib/new_relic/agent/synthetics_event_buffer.rb +0 -40
- data/lib/new_relic/agent/throughput_monitor.rb +0 -59
- data/lib/new_relic/agent/transaction/attributes.rb +0 -153
- data/lib/new_relic/agent/transaction/xray_sample_buffer.rb +0 -64
- data/lib/new_relic/agent/transaction_state.rb +0 -145
- data/lib/new_relic/agent/transaction_timings.rb +0 -57
- 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
|
# This class represents a set of metrics that were recorded during a single
|
6
6
|
# transaction. Since the name of the transaction is not known until its end, we
|
@@ -1,10 +1,9 @@
|
|
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/transaction/slowest_sample_buffer'
|
6
6
|
require 'new_relic/agent/transaction/synthetics_sample_buffer'
|
7
|
-
require 'new_relic/agent/transaction/xray_sample_buffer'
|
8
7
|
require 'new_relic/agent/transaction/trace_builder'
|
9
8
|
|
10
9
|
module NewRelic
|
@@ -19,13 +18,10 @@ module NewRelic
|
|
19
18
|
#
|
20
19
|
# @api public
|
21
20
|
class TransactionSampler
|
22
|
-
attr_reader :last_sample
|
21
|
+
attr_reader :last_sample
|
23
22
|
|
24
23
|
def initialize
|
25
|
-
@xray_sample_buffer = NewRelic::Agent::Transaction::XraySampleBuffer.new
|
26
|
-
|
27
24
|
@sample_buffers = []
|
28
|
-
@sample_buffers << @xray_sample_buffer
|
29
25
|
@sample_buffers << NewRelic::Agent::Transaction::SlowestSampleBuffer.new
|
30
26
|
@sample_buffers << NewRelic::Agent::Transaction::SyntheticsSampleBuffer.new
|
31
27
|
|
@@ -54,14 +50,7 @@ module NewRelic
|
|
54
50
|
Agent.config[:'transaction_tracer.enabled']
|
55
51
|
end
|
56
52
|
|
57
|
-
|
58
|
-
# unwound the stack to the top level. It also clears the
|
59
|
-
# transaction sample builder so that it won't continue to have
|
60
|
-
# frames appended to it.
|
61
|
-
#
|
62
|
-
# It sets various instance variables to the finished sample,
|
63
|
-
# depending on which settings are active. See `store_sample`
|
64
|
-
def on_finishing_transaction(state, txn, time=Time.now)
|
53
|
+
def on_finishing_transaction(txn)
|
65
54
|
return if !enabled? || txn.ignore_trace?
|
66
55
|
|
67
56
|
@samples_lock.synchronize do
|
@@ -0,0 +1,155 @@
|
|
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
|
+
|
5
|
+
# This module powers the Busy calculation for the Capacity report in
|
6
|
+
# APM (https://rpm.newrelic.com/accounts/.../applications/.../optimize/capacity_analysis).
|
7
|
+
#
|
8
|
+
# total time spent in transactions this harvest across all threads
|
9
|
+
# Busy time = ------------------------------------------------------------------------
|
10
|
+
# (elapsed time for this harvest cycle) * (# threads that had transactions)
|
11
|
+
#
|
12
|
+
module NewRelic
|
13
|
+
module Agent
|
14
|
+
module TransactionTimeAggregator
|
15
|
+
TransactionStats = Struct.new :transaction_started_at, :elapsed_transaction_time
|
16
|
+
|
17
|
+
@lock = Mutex.new
|
18
|
+
@harvest_cycle_started_at = Time.now
|
19
|
+
|
20
|
+
@stats = Hash.new do |h, k|
|
21
|
+
h[k] = TransactionStats.new nil, 0.0
|
22
|
+
end
|
23
|
+
|
24
|
+
def reset!(timestamp = Time.now)
|
25
|
+
@harvest_cycle_started_at = timestamp
|
26
|
+
@stats.clear
|
27
|
+
end
|
28
|
+
|
29
|
+
def transaction_start(timestamp = Time.now)
|
30
|
+
@lock.synchronize do
|
31
|
+
set_transaction_start_time timestamp
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def transaction_stop(timestamp = Time.now, starting_thread_id = current_thread)
|
36
|
+
@lock.synchronize do
|
37
|
+
record_elapsed_transaction_time_until timestamp, starting_thread_id
|
38
|
+
set_transaction_start_time nil, starting_thread_id
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
INSTANCE_BUSY_METRIC = 'Instance/Busy'.freeze
|
43
|
+
|
44
|
+
def harvest!(timestamp = Time.now)
|
45
|
+
active_threads = 0
|
46
|
+
result = @lock.synchronize do
|
47
|
+
# Sum up the transaction times spent in each thread
|
48
|
+
elapsed_transaction_time = @stats.inject(0.0) do |total, (thread_id, entry)|
|
49
|
+
total + transaction_time_in_thread(timestamp, thread_id, entry)
|
50
|
+
end
|
51
|
+
|
52
|
+
active_threads = @stats.size
|
53
|
+
elapsed_harvest_time = (timestamp - @harvest_cycle_started_at) * active_threads
|
54
|
+
@harvest_cycle_started_at = timestamp
|
55
|
+
|
56
|
+
# Clear out the stats for all threads, _except_ the live ones
|
57
|
+
# that have transactions still open (we'll count the rest of
|
58
|
+
# those in a future harvest)
|
59
|
+
@stats.keep_if do |thread_id, _|
|
60
|
+
in_transaction?(thread_id) && thread_is_alive?(thread_id)
|
61
|
+
end
|
62
|
+
|
63
|
+
if elapsed_harvest_time > 0.0
|
64
|
+
elapsed_transaction_time / elapsed_harvest_time
|
65
|
+
else
|
66
|
+
0.0
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if Agent.config[:report_instance_busy]
|
71
|
+
NewRelic::Agent.record_metric(INSTANCE_BUSY_METRIC, result)
|
72
|
+
end
|
73
|
+
|
74
|
+
result
|
75
|
+
end
|
76
|
+
|
77
|
+
module_function :reset!,
|
78
|
+
:transaction_start,
|
79
|
+
:transaction_stop,
|
80
|
+
:harvest!
|
81
|
+
|
82
|
+
class << self
|
83
|
+
private
|
84
|
+
|
85
|
+
def record_elapsed_transaction_time_until(timestamp, thread_id = current_thread)
|
86
|
+
if @stats[thread_id].transaction_started_at
|
87
|
+
@stats[thread_id].elapsed_transaction_time +=
|
88
|
+
(timestamp - (@stats[thread_id].transaction_started_at || 0.0))
|
89
|
+
else
|
90
|
+
log_missing_elapsed_transaction_time
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def in_transaction?(thread_id = current_thread)
|
95
|
+
!!@stats[thread_id].transaction_started_at
|
96
|
+
end
|
97
|
+
|
98
|
+
def current_thread
|
99
|
+
Thread.current.object_id
|
100
|
+
end
|
101
|
+
|
102
|
+
def thread_is_alive?(thread_id)
|
103
|
+
thread = thread_by_id thread_id
|
104
|
+
thread && thread.alive?
|
105
|
+
rescue StandardError
|
106
|
+
false
|
107
|
+
end
|
108
|
+
|
109
|
+
# ObjectSpace is faster on MRI, but disabled by default on JRuby for
|
110
|
+
# perfomance reasons. We have two implmentations of `thread_by_id`
|
111
|
+
# based on ruby implementation.
|
112
|
+
if RUBY_ENGINE == 'jruby'
|
113
|
+
def thread_by_id thread_id
|
114
|
+
Thread.list.detect { |t| t.object_id == thread_id }
|
115
|
+
end
|
116
|
+
else
|
117
|
+
require 'objspace'
|
118
|
+
|
119
|
+
def thread_by_id thread_id
|
120
|
+
ObjectSpace._id2ref(thread_id)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def set_transaction_start_time(timestamp, thread_id = current_thread)
|
125
|
+
@stats[thread_id].transaction_started_at = timestamp
|
126
|
+
end
|
127
|
+
|
128
|
+
def split_transaction_at_harvest(timestamp, thread_id = nil)
|
129
|
+
raise ArgumentError, 'thread_id required' unless thread_id
|
130
|
+
@stats[thread_id].transaction_started_at = timestamp
|
131
|
+
@stats[thread_id].elapsed_transaction_time = 0.0
|
132
|
+
end
|
133
|
+
|
134
|
+
def transaction_time_in_thread timestamp, thread_id, entry
|
135
|
+
return entry.elapsed_transaction_time unless in_transaction? thread_id
|
136
|
+
|
137
|
+
# Count the portion of the transaction that's elapsed so far,...
|
138
|
+
elapsed = record_elapsed_transaction_time_until timestamp, thread_id
|
139
|
+
|
140
|
+
# ...then readjust the transaction start time to the next harvest
|
141
|
+
split_transaction_at_harvest timestamp, thread_id
|
142
|
+
|
143
|
+
elapsed
|
144
|
+
end
|
145
|
+
|
146
|
+
def log_missing_elapsed_transaction_time
|
147
|
+
transaction_name = Tracer.current_transaction &&
|
148
|
+
Tracer.current_transaction.best_name ||
|
149
|
+
"unknown"
|
150
|
+
NewRelic::Agent.logger.warn("Unable to calculate elapsed transaction time for #{transaction_name}")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
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
|
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
|
module NewRelic
|
6
6
|
module Agent
|
@@ -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,16 +1,17 @@
|
|
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'
|
7
7
|
require 'new_relic/agent/utilization/azure'
|
8
8
|
require 'new_relic/agent/utilization/pcf'
|
9
9
|
|
10
|
+
|
10
11
|
module NewRelic
|
11
12
|
module Agent
|
12
13
|
class UtilizationData
|
13
|
-
METADATA_VERSION =
|
14
|
+
METADATA_VERSION = 5
|
14
15
|
|
15
16
|
VENDORS = {
|
16
17
|
Utilization::AWS => :'utilization.detect_aws',
|
@@ -23,6 +24,14 @@ module NewRelic
|
|
23
24
|
NewRelic::Agent::Hostname.get
|
24
25
|
end
|
25
26
|
|
27
|
+
def fqdn
|
28
|
+
NewRelic::Agent::Hostname.get_fqdn
|
29
|
+
end
|
30
|
+
|
31
|
+
def ip_addresses
|
32
|
+
::NewRelic::Agent::SystemInfo.ip_addresses
|
33
|
+
end
|
34
|
+
|
26
35
|
def container_id
|
27
36
|
::NewRelic::Agent::SystemInfo.docker_container_id
|
28
37
|
end
|
@@ -69,6 +78,9 @@ module NewRelic
|
|
69
78
|
append_docker_info(result)
|
70
79
|
append_configured_values(result)
|
71
80
|
append_boot_id(result)
|
81
|
+
append_ip_address(result)
|
82
|
+
append_full_hostname(result)
|
83
|
+
append_kubernetes_info(result)
|
72
84
|
|
73
85
|
result
|
74
86
|
end
|
@@ -105,6 +117,29 @@ module NewRelic
|
|
105
117
|
end
|
106
118
|
end
|
107
119
|
|
120
|
+
def append_ip_address(collector_hash)
|
121
|
+
ips = ip_addresses
|
122
|
+
collector_hash[:ip_address] = ips unless ips.empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
KUBERNETES_SERVICE_HOST = 'KUBERNETES_SERVICE_HOST'.freeze
|
126
|
+
|
127
|
+
def append_kubernetes_info(collector_hash)
|
128
|
+
return unless Agent.config[:'utilization.detect_kubernetes']
|
129
|
+
if host = ENV[KUBERNETES_SERVICE_HOST]
|
130
|
+
collector_hash[:vendors] ||= {}
|
131
|
+
collector_hash[:vendors][:kubernetes] = {
|
132
|
+
kubernetes_service_host: host
|
133
|
+
}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def append_full_hostname(collector_hash)
|
138
|
+
full_hostname = fqdn
|
139
|
+
return if full_hostname.nil? || full_hostname.empty?
|
140
|
+
collector_hash[:full_hostname] = full_hostname
|
141
|
+
end
|
142
|
+
|
108
143
|
def config_hash
|
109
144
|
config_hash = {}
|
110
145
|
|
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
|
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'
|
@@ -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
|
@@ -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
|
|
@@ -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,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
|
# This is a class for executing commands related to deployment
|
6
6
|
# events. It runs without loading the rails environment
|
@@ -39,7 +39,7 @@ class NewRelic::Cli::Deployments < NewRelic::Cli::Command
|
|
39
39
|
control.env = @environment if @environment
|
40
40
|
|
41
41
|
load_yaml_from_env(control.env)
|
42
|
-
@appname ||= NewRelic::Agent.config
|
42
|
+
@appname ||= NewRelic::Agent.config[:app_name][0] || control.env || 'development'
|
43
43
|
@license_key ||= NewRelic::Agent.config[:license_key]
|
44
44
|
|
45
45
|
setup_logging(control.env)
|
@@ -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
|