newrelic_rpm 8.0.0 → 8.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rubocop.yml +1936 -0
- data/Brewfile +10 -0
- data/CHANGELOG.md +96 -0
- data/CONTRIBUTING.md +15 -3
- data/Guardfile +8 -8
- data/README.md +3 -1
- data/Rakefile +7 -9
- data/bin/mongrel_rpm +8 -9
- data/bin/newrelic +1 -1
- data/bin/nrdebug +14 -14
- data/init.rb +0 -2
- data/lefthook.yml +9 -0
- data/lib/new_relic/agent/adaptive_sampler.rb +7 -3
- data/lib/new_relic/agent/agent.rb +38 -40
- data/lib/new_relic/agent/agent_logger.rb +8 -9
- data/lib/new_relic/agent/attribute_filter.rb +31 -31
- data/lib/new_relic/agent/attributes.rb +2 -2
- data/lib/new_relic/agent/autostart.rb +6 -7
- data/lib/new_relic/agent/commands/agent_command.rb +2 -2
- data/lib/new_relic/agent/commands/agent_command_router.rb +6 -5
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +0 -3
- data/lib/new_relic/agent/configuration/default_source.rb +343 -337
- data/lib/new_relic/agent/configuration/dotted_hash.rb +3 -3
- data/lib/new_relic/agent/configuration/environment_source.rb +3 -4
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +2 -4
- data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
- data/lib/new_relic/agent/configuration/manager.rb +57 -57
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
- data/lib/new_relic/agent/configuration/security_policy_source.rb +73 -73
- data/lib/new_relic/agent/configuration/server_source.rb +10 -10
- data/lib/new_relic/agent/configuration/yaml_source.rb +9 -9
- data/lib/new_relic/agent/connect/request_builder.rb +13 -16
- data/lib/new_relic/agent/connect/response_handler.rb +0 -3
- data/lib/new_relic/agent/custom_event_aggregator.rb +9 -10
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +3 -4
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +12 -12
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +2 -2
- data/lib/new_relic/agent/database.rb +20 -24
- data/lib/new_relic/agent/datastores/metric_helper.rb +10 -10
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +2 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +3 -5
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +1 -2
- data/lib/new_relic/agent/datastores/redis.rb +2 -4
- data/lib/new_relic/agent/datastores.rb +1 -3
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +5 -5
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +11 -10
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -11
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +41 -42
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +3 -3
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +41 -43
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +24 -24
- data/lib/new_relic/agent/distributed_tracing.rb +17 -18
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +17 -17
- data/lib/new_relic/agent/error_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/error_filter.rb +16 -10
- 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 +6 -7
- data/lib/new_relic/agent/event_listener.rb +0 -1
- data/lib/new_relic/agent/event_loop.rb +10 -10
- data/lib/new_relic/agent/external.rb +1 -2
- data/lib/new_relic/agent/guid_generator.rb +2 -9
- data/lib/new_relic/agent/harvester.rb +3 -4
- data/lib/new_relic/agent/heap.rb +1 -3
- data/lib/new_relic/agent/hostname.rb +3 -3
- data/lib/new_relic/agent/http_clients/abstract.rb +5 -7
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +1 -5
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +4 -4
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +3 -3
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +1 -2
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +8 -3
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +2 -3
- data/lib/new_relic/agent/http_clients/uri_util.rb +0 -1
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +2 -3
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +9 -10
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +5 -7
- data/lib/new_relic/agent/instrumentation/active_job.rb +4 -3
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_record.rb +20 -18
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +36 -42
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +28 -25
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +3 -3
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +5 -6
- data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +8 -9
- data/lib/new_relic/agent/instrumentation/bunny/chain.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny/instrumentation.rb +7 -8
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +41 -41
- data/lib/new_relic/agent/instrumentation/curb/chain.rb +19 -20
- data/lib/new_relic/agent/instrumentation/curb/instrumentation.rb +34 -38
- data/lib/new_relic/agent/instrumentation/curb/prepend.rb +9 -10
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +10 -10
- data/lib/new_relic/agent/instrumentation/delayed_job/chain.rb +5 -7
- data/lib/new_relic/agent/instrumentation/delayed_job/instrumentation.rb +5 -9
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +2 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +0 -1
- data/lib/new_relic/agent/instrumentation/grape/chain.rb +1 -2
- data/lib/new_relic/agent/instrumentation/grape/instrumentation.rb +6 -7
- data/lib/new_relic/agent/instrumentation/grape.rb +2 -3
- data/lib/new_relic/agent/instrumentation/httpclient/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/httpclient/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/httpclient/prepend.rb +0 -2
- data/lib/new_relic/agent/instrumentation/httprb/chain.rb +2 -2
- data/lib/new_relic/agent/instrumentation/httprb/instrumentation.rb +6 -6
- data/lib/new_relic/agent/instrumentation/httprb/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +2 -3
- data/lib/new_relic/agent/instrumentation/logger/chain.rb +21 -0
- data/lib/new_relic/agent/instrumentation/logger/instrumentation.rb +58 -0
- data/lib/new_relic/agent/instrumentation/logger/prepend.rb +13 -0
- data/lib/new_relic/agent/instrumentation/logger.rb +25 -0
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -2
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +5 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +9 -2
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +4 -5
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +4 -4
- data/lib/new_relic/agent/instrumentation/net_http/chain.rb +3 -4
- data/lib/new_relic/agent/instrumentation/net_http/instrumentation.rb +5 -5
- data/lib/new_relic/agent/instrumentation/net_http/prepend.rb +4 -4
- data/lib/new_relic/agent/instrumentation/net_http.rb +1 -1
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +2 -3
- data/lib/new_relic/agent/instrumentation/padrino/chain.rb +23 -19
- data/lib/new_relic/agent/instrumentation/padrino/instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +2 -2
- data/lib/new_relic/agent/instrumentation/padrino.rb +2 -5
- data/lib/new_relic/agent/instrumentation/queue_time.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rack/chain.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rack/helpers.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack/instrumentation.rb +4 -5
- data/lib/new_relic/agent/instrumentation/rack/prepend.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +0 -1
- data/lib/new_relic/agent/instrumentation/rake/chain.rb +0 -5
- data/lib/new_relic/agent/instrumentation/rake/instrumentation.rb +6 -6
- data/lib/new_relic/agent/instrumentation/rake.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis/chain.rb +6 -6
- data/lib/new_relic/agent/instrumentation/redis/instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/redis/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/chain.rb +2 -3
- data/lib/new_relic/agent/instrumentation/resque/helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/resque/instrumentation.rb +4 -4
- data/lib/new_relic/agent/instrumentation/resque/prepend.rb +1 -2
- data/lib/new_relic/agent/instrumentation/resque.rb +7 -7
- data/lib/new_relic/agent/instrumentation/sequel.rb +7 -9
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +5 -4
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +0 -1
- data/lib/new_relic/agent/instrumentation/sinatra/instrumentation.rb +4 -3
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/tilt/chain.rb +24 -0
- data/lib/new_relic/agent/instrumentation/tilt/instrumentation.rb +40 -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 +4 -4
- data/lib/new_relic/agent/instrumentation/typhoeus/instrumentation.rb +3 -5
- data/lib/new_relic/agent/instrumentation/typhoeus/prepend.rb +1 -1
- data/lib/new_relic/agent/internal_agent_error.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +28 -28
- data/lib/new_relic/agent/logging.rb +11 -8
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +42 -43
- data/lib/new_relic/agent/method_tracer.rb +17 -15
- data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +19 -16
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +2 -2
- data/lib/new_relic/agent/monitors/inbound_request_monitor.rb +0 -1
- data/lib/new_relic/agent/monitors/synthetics_monitor.rb +4 -7
- data/lib/new_relic/agent/monitors.rb +1 -2
- data/lib/new_relic/agent/new_relic_service/encoders.rb +4 -4
- 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 +4 -3
- data/lib/new_relic/agent/new_relic_service.rb +26 -33
- data/lib/new_relic/agent/noticible_error.rb +0 -2
- data/lib/new_relic/agent/null_logger.rb +6 -2
- data/lib/new_relic/agent/obfuscator.rb +6 -8
- data/lib/new_relic/agent/parameter_filtering.rb +15 -7
- data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
- data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
- data/lib/new_relic/agent/pipe_service.rb +1 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +4 -7
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +9 -9
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +12 -12
- data/lib/new_relic/agent/rules_engine.rb +2 -2
- data/lib/new_relic/agent/sampler.rb +2 -3
- data/lib/new_relic/agent/sampler_collection.rb +2 -3
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +10 -7
- data/lib/new_relic/agent/samplers/memory_sampler.rb +4 -3
- data/lib/new_relic/agent/samplers/vm_sampler.rb +18 -18
- data/lib/new_relic/agent/span_event_aggregator.rb +8 -8
- data/lib/new_relic/agent/span_event_primitive.rb +39 -39
- data/lib/new_relic/agent/sql_sampler.rb +9 -9
- data/lib/new_relic/agent/stats.rb +16 -16
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +7 -9
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +8 -9
- data/lib/new_relic/agent/stats_engine.rb +6 -6
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +0 -1
- data/lib/new_relic/agent/system_info.rb +22 -20
- data/lib/new_relic/agent/threading/agent_thread.rb +4 -5
- data/lib/new_relic/agent/threading/backtrace_node.rb +6 -9
- data/lib/new_relic/agent/threading/backtrace_service.rb +8 -8
- data/lib/new_relic/agent/threading/thread_profile.rb +15 -18
- data/lib/new_relic/agent/tracer.rb +37 -43
- data/lib/new_relic/agent/transaction/abstract_segment.rb +6 -6
- data/lib/new_relic/agent/transaction/datastore_segment.rb +7 -6
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +8 -9
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
- data/lib/new_relic/agent/transaction/external_request_segment.rb +6 -5
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +23 -23
- data/lib/new_relic/agent/transaction/request_attributes.rb +7 -7
- data/lib/new_relic/agent/transaction/segment.rb +6 -3
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +0 -2
- data/lib/new_relic/agent/transaction/trace.rb +8 -8
- data/lib/new_relic/agent/transaction/trace_context.rb +13 -15
- data/lib/new_relic/agent/transaction/trace_node.rb +16 -16
- data/lib/new_relic/agent/transaction/tracing.rb +1 -3
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -2
- data/lib/new_relic/agent/transaction.rb +79 -81
- data/lib/new_relic/agent/transaction_error_primitive.rb +16 -16
- data/lib/new_relic/agent/transaction_event_aggregator.rb +5 -6
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
- data/lib/new_relic/agent/transaction_metrics.rb +3 -3
- data/lib/new_relic/agent/transaction_sampler.rb +0 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +6 -6
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization_data.rb +3 -4
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/snapshot.rb +3 -3
- data/lib/new_relic/agent/worker_loop.rb +3 -5
- data/lib/new_relic/agent.rb +22 -22
- data/lib/new_relic/cli/command.rb +15 -17
- data/lib/new_relic/cli/commands/deployments.rb +20 -22
- data/lib/new_relic/cli/commands/install.rb +6 -10
- data/lib/new_relic/coerce.rb +5 -8
- data/lib/new_relic/collection_helper.rb +48 -47
- data/lib/new_relic/control/class_methods.rb +2 -2
- data/lib/new_relic/control/frameworks/external.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +5 -6
- data/lib/new_relic/control/frameworks/rails3.rb +2 -3
- data/lib/new_relic/control/frameworks/ruby.rb +2 -2
- data/lib/new_relic/control/frameworks/sinatra.rb +6 -0
- data/lib/new_relic/control/instance_methods.rb +4 -5
- data/lib/new_relic/control/instrumentation.rb +4 -5
- data/lib/new_relic/control/server_methods.rb +2 -3
- data/lib/new_relic/control.rb +0 -1
- data/lib/new_relic/dependency_detection.rb +6 -8
- data/lib/new_relic/environment_report.rb +16 -18
- data/lib/new_relic/helper.rb +5 -5
- 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 +7 -7
- data/lib/new_relic/metric_data.rb +6 -7
- data/lib/new_relic/metric_spec.rb +3 -3
- data/lib/new_relic/noticed_error.rb +14 -15
- data/lib/new_relic/rack/agent_middleware.rb +2 -2
- data/lib/new_relic/rack/browser_monitoring.rb +9 -9
- data/lib/new_relic/recipes/capistrano3.rb +11 -13
- data/lib/new_relic/recipes/capistrano_legacy.rb +11 -14
- data/lib/new_relic/supportability_helper.rb +1 -2
- data/lib/new_relic/version.rb +3 -4
- data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
- data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/config.rake +21 -21
- data/lib/tasks/multiverse.rb +4 -6
- data/lib/tasks/tests.rake +3 -7
- data/newrelic.yml +8 -21
- data/newrelic_rpm.gemspec +13 -12
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +55 -55
- metadata +43 -7
- 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
@@ -12,27 +12,28 @@ module NewRelic
|
|
12
12
|
module Agent
|
13
13
|
module DistributedTracing
|
14
14
|
class CrossAppMonitor < InboundRequestMonitor
|
15
|
-
|
16
|
-
|
17
|
-
NEWRELIC_TXN_HEADER = 'X-NewRelic-Transaction'.freeze
|
15
|
+
NEWRELIC_ID_HEADER = 'X-NewRelic-ID'.freeze
|
16
|
+
NEWRELIC_TXN_HEADER = 'X-NewRelic-Transaction'.freeze
|
18
17
|
NEWRELIC_APPDATA_HEADER = 'X-NewRelic-App-Data'.freeze
|
19
18
|
|
20
|
-
NEWRELIC_ID_HEADER_KEY
|
21
|
-
NEWRELIC_TXN_HEADER_KEY
|
19
|
+
NEWRELIC_ID_HEADER_KEY = 'HTTP_X_NEWRELIC_ID'.freeze
|
20
|
+
NEWRELIC_TXN_HEADER_KEY = 'HTTP_X_NEWRELIC_TRANSACTION'.freeze
|
22
21
|
CONTENT_LENGTH_HEADER_KEY = 'HTTP_CONTENT_LENGTH'.freeze
|
23
22
|
|
24
23
|
def on_finished_configuring(events)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
if CrossAppTracing.cross_app_enabled?
|
25
|
+
Deprecator.deprecate('cross_application_tracer')
|
26
|
+
::NewRelic::Agent.logger.warn(
|
27
|
+
"[DEPRECATED] Cross application tracing is enabled. Distributed tracing is replacing cross application tracing as the default means of tracing between services. To continue using cross application tracing, enable it with `cross_application_tracer.enabled: true` and `distributed_tracing.enabled: false`"
|
28
|
+
)
|
29
|
+
end
|
29
30
|
|
30
31
|
register_event_listeners(events)
|
31
32
|
end
|
32
33
|
|
33
34
|
def path_hash(txn_name, seed)
|
34
|
-
rotated
|
35
|
-
app_name
|
35
|
+
rotated = ((seed << 1) | (seed >> 31)) & 0xffffffff
|
36
|
+
app_name = NewRelic::Agent.config[:app_name].first
|
36
37
|
identifier = "#{app_name};#{txn_name}"
|
37
38
|
sprintf("%08x", rotated ^ hash_transaction_name(identifier))
|
38
39
|
end
|
@@ -43,10 +44,10 @@ module NewRelic
|
|
43
44
|
# :before_call will save our cross application request id to the thread
|
44
45
|
# :after_call will write our response headers/metrics and clean up the thread
|
45
46
|
def register_event_listeners(events)
|
46
|
-
NewRelic::Agent.logger
|
47
|
-
debug("Wiring up Cross Application Tracing to events after finished configuring")
|
47
|
+
NewRelic::Agent.logger
|
48
|
+
.debug("Wiring up Cross Application Tracing to events after finished configuring")
|
48
49
|
|
49
|
-
events.subscribe(:before_call) do |env| #THREAD_LOCAL_ACCESS
|
50
|
+
events.subscribe(:before_call) do |env| # THREAD_LOCAL_ACCESS
|
50
51
|
if id = decoded_id(env) and should_process_request?(id)
|
51
52
|
state = NewRelic::Agent::Tracer.state
|
52
53
|
|
@@ -61,7 +62,7 @@ module NewRelic
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
|
-
events.subscribe(:after_call) do |env, (_status_code, headers, _body)| #THREAD_LOCAL_ACCESS
|
65
|
+
events.subscribe(:after_call) do |env, (_status_code, headers, _body)| # THREAD_LOCAL_ACCESS
|
65
66
|
state = NewRelic::Agent::Tracer.state
|
66
67
|
|
67
68
|
insert_response_header(state, env, headers)
|
@@ -90,7 +91,9 @@ module NewRelic
|
|
90
91
|
def set_response_headers(transaction, response_headers, content_length)
|
91
92
|
payload = obfuscator.obfuscate(
|
92
93
|
::JSON.dump(
|
93
|
-
transaction.distributed_tracer.cross_app_payload.as_json_array(content_length)
|
94
|
+
transaction.distributed_tracer.cross_app_payload.as_json_array(content_length)
|
95
|
+
)
|
96
|
+
)
|
94
97
|
|
95
98
|
response_headers[NEWRELIC_APPDATA_HEADER] = payload
|
96
99
|
end
|
@@ -13,7 +13,7 @@ module NewRelic
|
|
13
13
|
|
14
14
|
def on_before_call(request)
|
15
15
|
unless NewRelic::Agent.config[:'distributed_tracing.enabled']
|
16
|
-
NewRelic::Agent.logger.warn "Not configured to accept distributed trace headers"
|
16
|
+
NewRelic::Agent.logger.warn "Not configured to accept distributed trace headers"
|
17
17
|
return
|
18
18
|
end
|
19
19
|
|
@@ -24,4 +24,4 @@ module NewRelic
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|
7
7
|
class SyntheticsMonitor < InboundRequestMonitor
|
8
|
-
SYNTHETICS_HEADER_KEY
|
8
|
+
SYNTHETICS_HEADER_KEY = 'HTTP_X_NEWRELIC_SYNTHETICS'.freeze
|
9
9
|
|
10
10
|
SUPPORTED_VERSION = 1
|
11
11
|
EXPECTED_PAYLOAD_LENGTH = 5
|
@@ -14,7 +14,7 @@ module NewRelic
|
|
14
14
|
events.subscribe(:before_call, &method(:on_before_call))
|
15
15
|
end
|
16
16
|
|
17
|
-
def on_before_call(request) #THREAD_LOCAL_ACCESS
|
17
|
+
def on_before_call(request) # THREAD_LOCAL_ACCESS
|
18
18
|
encoded_header = request[SYNTHETICS_HEADER_KEY]
|
19
19
|
return unless encoded_header
|
20
20
|
|
@@ -27,11 +27,10 @@ module NewRelic
|
|
27
27
|
|
28
28
|
txn = Tracer.current_transaction
|
29
29
|
txn.raw_synthetics_header = encoded_header
|
30
|
-
txn.synthetics_payload
|
30
|
+
txn.synthetics_payload = incoming_payload
|
31
31
|
end
|
32
32
|
|
33
33
|
class << self
|
34
|
-
|
35
34
|
def is_supported_version?(incoming_payload)
|
36
35
|
incoming_payload.first == SUPPORTED_VERSION
|
37
36
|
end
|
@@ -46,11 +45,9 @@ module NewRelic
|
|
46
45
|
end
|
47
46
|
|
48
47
|
def reject_messaging_synthetics_header headers
|
49
|
-
headers.reject {|k,_| k == CrossAppTracing::NR_MESSAGE_BROKER_SYNTHETICS_HEADER}
|
48
|
+
headers.reject { |k, _| k == CrossAppTracing::NR_MESSAGE_BROKER_SYNTHETICS_HEADER }
|
50
49
|
end
|
51
|
-
|
52
50
|
end
|
53
|
-
|
54
51
|
end
|
55
52
|
end
|
56
53
|
end
|
@@ -12,14 +12,14 @@ module NewRelic
|
|
12
12
|
class NewRelicService
|
13
13
|
module Encoders
|
14
14
|
module Identity
|
15
|
-
def self.encode(data, opts=nil)
|
15
|
+
def self.encode(data, opts = nil)
|
16
16
|
data
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
module Compressed
|
21
21
|
module Deflate
|
22
|
-
def self.encode(data, opts=nil)
|
22
|
+
def self.encode(data, opts = nil)
|
23
23
|
Zlib::Deflate.deflate(data, Zlib::DEFAULT_COMPRESSION)
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ module NewRelic
|
|
27
27
|
module Gzip
|
28
28
|
BINARY = "BINARY".freeze
|
29
29
|
|
30
|
-
def self.encode(data, opts=nil)
|
30
|
+
def self.encode(data, opts = nil)
|
31
31
|
output = StringIO.new
|
32
32
|
output.set_encoding BINARY
|
33
33
|
gz = Zlib::GzipWriter.new(output, Zlib::DEFAULT_COMPRESSION, Zlib::DEFAULT_STRATEGY)
|
@@ -40,7 +40,7 @@ module NewRelic
|
|
40
40
|
end
|
41
41
|
|
42
42
|
module Base64CompressedJSON
|
43
|
-
def self.encode(data, opts={})
|
43
|
+
def self.encode(data, opts = {})
|
44
44
|
if !opts[:skip_normalization] && Agent.config[:normalize_json_string_encodings]
|
45
45
|
data = NewRelic::Agent::EncodingNormalizer.normalize_object(data)
|
46
46
|
end
|
@@ -27,7 +27,7 @@ module NewRelic
|
|
27
27
|
::NewRelic::Agent.logger.warn "Failed trying to watch for problematic yajl-ruby version.", err
|
28
28
|
end
|
29
29
|
|
30
|
-
def dump(ruby, opts={})
|
30
|
+
def dump(ruby, opts = {})
|
31
31
|
prepared = prepare(ruby, opts)
|
32
32
|
|
33
33
|
if !opts[:skip_normalization] && Agent.config[:normalize_json_string_encodings]
|
@@ -6,7 +6,7 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
class NewRelicService
|
8
8
|
class Marshaller
|
9
|
-
def prepare(data, options={})
|
9
|
+
def prepare(data, options = {})
|
10
10
|
encoder = options[:encoder] || default_encoder
|
11
11
|
if data.respond_to?(:to_collector_array)
|
12
12
|
data.to_collector_array(encoder)
|
@@ -6,7 +6,7 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
class NewRelicService
|
8
8
|
module SecurityPolicySettings
|
9
|
-
EXPECTED_SECURITY_POLICIES = %w
|
9
|
+
EXPECTED_SECURITY_POLICIES = %w[
|
10
10
|
record_sql
|
11
11
|
attributes_include
|
12
12
|
allow_raw_exception_messages
|
@@ -14,12 +14,13 @@ module NewRelic
|
|
14
14
|
custom_parameters
|
15
15
|
custom_instrumentation_editor
|
16
16
|
message_parameters
|
17
|
-
job_arguments
|
17
|
+
job_arguments
|
18
|
+
].map(&:freeze)
|
18
19
|
|
19
20
|
def self.preliminary_settings(security_policies)
|
20
21
|
enabled_key = 'enabled'.freeze
|
21
22
|
settings = EXPECTED_SECURITY_POLICIES.inject({}) do |memo, policy_name|
|
22
|
-
memo[policy_name] =
|
23
|
+
memo[policy_name] = {enabled_key => security_policies[policy_name][enabled_key]}
|
23
24
|
memo
|
24
25
|
end
|
25
26
|
{'security_policies' => settings}
|
@@ -35,7 +35,7 @@ module NewRelic
|
|
35
35
|
attr_accessor :request_timeout
|
36
36
|
attr_reader :collector, :marshaller, :agent_id
|
37
37
|
|
38
|
-
def initialize(license_key=nil, collector=control.server)
|
38
|
+
def initialize(license_key = nil, collector = control.server)
|
39
39
|
@license_key = license_key
|
40
40
|
@collector = collector
|
41
41
|
@configured_collector = collector
|
@@ -69,7 +69,7 @@ module NewRelic
|
|
69
69
|
@agent_id = id
|
70
70
|
end
|
71
71
|
|
72
|
-
def connect(settings={})
|
72
|
+
def connect(settings = {})
|
73
73
|
@request_headers_map = nil
|
74
74
|
security_policies = nil
|
75
75
|
if response = preconnect
|
@@ -128,7 +128,7 @@ module NewRelic
|
|
128
128
|
|
129
129
|
def metric_data(stats_hash)
|
130
130
|
timeslice_start = stats_hash.started_at
|
131
|
-
timeslice_end
|
131
|
+
timeslice_end = stats_hash.harvested_at || Process.clock_gettime(Process::CLOCK_REALTIME)
|
132
132
|
metric_data_array = build_metric_data_array(stats_hash)
|
133
133
|
result = invoke_remote(
|
134
134
|
:metric_data,
|
@@ -289,7 +289,7 @@ module NewRelic
|
|
289
289
|
# Jruby 1.6.8 requires a gem for full ssl support and will throw
|
290
290
|
# an error when use_ssl=(true) is called and jruby-openssl isn't
|
291
291
|
# installed
|
292
|
-
conn.use_ssl
|
292
|
+
conn.use_ssl = true
|
293
293
|
conn.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
294
294
|
set_cert_store(conn)
|
295
295
|
rescue StandardError, LoadError
|
@@ -299,7 +299,7 @@ module NewRelic
|
|
299
299
|
|
300
300
|
def set_cert_store(conn)
|
301
301
|
if NewRelic::Agent.config[:ca_bundle_path]
|
302
|
-
conn.cert_store
|
302
|
+
conn.cert_store = ssl_cert_store
|
303
303
|
else
|
304
304
|
::NewRelic::Agent.logger.debug("Using default security certificates")
|
305
305
|
end
|
@@ -388,15 +388,15 @@ module NewRelic
|
|
388
388
|
def generate_remote_method_uri(method)
|
389
389
|
params = {
|
390
390
|
'protocol_version' => PROTOCOL_VERSION,
|
391
|
-
'license_key'
|
392
|
-
'run_id'
|
393
|
-
'method'
|
394
|
-
'marshal_format'
|
395
|
-
|
391
|
+
'license_key' => license_key,
|
392
|
+
'run_id' => @agent_id,
|
393
|
+
'method' => method,
|
394
|
+
'marshal_format' => 'json' # Other formats are explicitly
|
395
|
+
# ruled out; see the initializer
|
396
396
|
}
|
397
397
|
|
398
398
|
uri = "/agent_listener/invoke_raw_method?"
|
399
|
-
uri << params.map do |k,v|
|
399
|
+
uri << params.map do |k, v|
|
400
400
|
next unless v
|
401
401
|
"#{k}=#{v}"
|
402
402
|
end.compact.join('&')
|
@@ -426,29 +426,22 @@ module NewRelic
|
|
426
426
|
size = data.size
|
427
427
|
|
428
428
|
# Preconnect needs to always use the configured collector host, not the redirect host
|
429
|
-
#
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
endpoint_specific_collector = if method == :preconnect && (@configured_collector && @configured_collector.name != 'staging-collector.newrelic.com')
|
435
|
-
::NewRelic::Agent.logger.debug "Using configured collector for preconnect: #{@configured_collector}"
|
436
|
-
@configured_collector
|
437
|
-
else
|
438
|
-
::NewRelic::Agent.logger.debug "Using redirect host for collector: #{@collector}"
|
439
|
-
@collector
|
440
|
-
end
|
429
|
+
# We reset it here so we are always using the configured collector during our creation of the new connection
|
430
|
+
# and we also don't want to keep the previous redirect host around anymore
|
431
|
+
if method == :preconnect
|
432
|
+
@collector = @configured_collector
|
433
|
+
end
|
441
434
|
|
442
435
|
uri = remote_method_uri(method)
|
443
|
-
full_uri = "#{
|
436
|
+
full_uri = "#{@collector}#{uri}"
|
444
437
|
|
445
438
|
@audit_logger.log_request(full_uri, payload, @marshaller)
|
446
439
|
request_send_ts = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
447
|
-
response = send_request(:data
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
440
|
+
response = send_request(:data => data,
|
441
|
+
:uri => uri,
|
442
|
+
:encoding => encoding,
|
443
|
+
:collector => @collector,
|
444
|
+
:endpoint => method)
|
452
445
|
response_check_ts = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
453
446
|
@marshaller.load(decompress_response(response))
|
454
447
|
ensure
|
@@ -519,7 +512,7 @@ module NewRelic
|
|
519
512
|
def send_request(opts)
|
520
513
|
headers = {
|
521
514
|
'Content-Encoding' => opts[:encoding],
|
522
|
-
'Host'
|
515
|
+
'Host' => opts[:collector].name
|
523
516
|
}
|
524
517
|
headers.merge!(@request_headers_map) if @request_headers_map
|
525
518
|
|
@@ -533,10 +526,10 @@ module NewRelic
|
|
533
526
|
request.content_type = "application/octet-stream"
|
534
527
|
request.body = opts[:data]
|
535
528
|
|
536
|
-
response
|
537
|
-
attempts
|
529
|
+
response = nil
|
530
|
+
attempts = 0
|
538
531
|
max_attempts = 2
|
539
|
-
endpoint
|
532
|
+
endpoint = opts[:endpoint]
|
540
533
|
|
541
534
|
begin
|
542
535
|
attempts += 1
|
@@ -5,7 +5,6 @@
|
|
5
5
|
|
6
6
|
module NewRelic
|
7
7
|
module Agent
|
8
|
-
|
9
8
|
# This class is used for instrumentations that have exceptions or error classes
|
10
9
|
# not derived from Ruby's usual Exception or StandardError or in situations
|
11
10
|
# where we do not have such Exception object to work with.
|
@@ -17,6 +16,5 @@ module NewRelic
|
|
17
16
|
@message = message
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
22
20
|
end
|
@@ -8,9 +8,13 @@ module NewRelic
|
|
8
8
|
module Agent
|
9
9
|
class NullLogger
|
10
10
|
def fatal(*args); end
|
11
|
+
|
11
12
|
def error(*args); end
|
12
|
-
|
13
|
-
def
|
13
|
+
|
14
|
+
def warn(*args); end
|
15
|
+
|
16
|
+
def info(*args); end
|
17
|
+
|
14
18
|
def debug(*args); end
|
15
19
|
|
16
20
|
def method_missing(method, *args, &blk)
|
@@ -2,19 +2,18 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
|
-
#require 'base64'
|
5
|
+
# require 'base64'
|
6
6
|
|
7
7
|
module NewRelic
|
8
8
|
module Agent
|
9
9
|
class Obfuscator
|
10
|
-
|
11
10
|
attr_reader :key_bytes
|
12
11
|
|
13
12
|
EMPTY_KEY_BYTES = [0]
|
14
13
|
PACK_FORMAT = 'm'
|
15
14
|
|
16
15
|
# RUM uses a shortened key, so just trim it up front
|
17
|
-
def initialize(key, length=nil)
|
16
|
+
def initialize(key, length = nil)
|
18
17
|
if key.nil? || key.empty?
|
19
18
|
@key_bytes = EMPTY_KEY_BYTES
|
20
19
|
else
|
@@ -24,26 +23,25 @@ module NewRelic
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def obfuscate(text)
|
27
|
-
[
|
26
|
+
[encode(text)].pack(PACK_FORMAT).gsub(/\n/, '')
|
28
27
|
end
|
29
28
|
|
30
29
|
def deobfuscate(text)
|
31
|
-
encode(text.unpack(PACK_FORMAT).first
|
30
|
+
encode(text.unpack(PACK_FORMAT).first)
|
32
31
|
end
|
33
32
|
|
34
33
|
def encode(text)
|
35
34
|
return text unless key_bytes
|
36
35
|
|
37
36
|
encoded = ""
|
38
|
-
encoded.force_encoding('binary') if encoded.respond_to?(
|
37
|
+
encoded.force_encoding('binary') if encoded.respond_to?(:force_encoding)
|
39
38
|
index = 0
|
40
39
|
text.each_byte do |byte|
|
41
40
|
encoded.concat((byte ^ key_bytes[index % key_bytes.length]))
|
42
|
-
index+=1
|
41
|
+
index += 1
|
43
42
|
end
|
44
43
|
encoded
|
45
44
|
end
|
46
|
-
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
@@ -9,17 +9,25 @@ module NewRelic
|
|
9
9
|
|
10
10
|
ACTION_DISPATCH_PARAMETER_FILTER = "action_dispatch.parameter_filter".freeze
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
if defined?(Rails) && Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('5.0.0')
|
13
|
+
Rails.application.config.to_prepare do
|
14
|
+
RAILS_FILTER_CLASS = if defined?(ActiveSupport::ParameterFilter)
|
15
|
+
ActiveSupport::ParameterFilter
|
16
|
+
elsif defined?(ActionDispatch::Http::ParameterFilter)
|
17
|
+
ActionDispatch::Http::ParameterFilter
|
18
|
+
end
|
19
|
+
end
|
16
20
|
else
|
17
|
-
|
21
|
+
RAILS_FILTER_CLASS = if defined?(ActiveSupport::ParameterFilter)
|
22
|
+
ActiveSupport::ParameterFilter
|
23
|
+
elsif defined?(ActionDispatch::Http::ParameterFilter)
|
24
|
+
ActionDispatch::Http::ParameterFilter
|
25
|
+
end
|
18
26
|
end
|
19
27
|
|
20
28
|
def apply_filters(env, params)
|
21
29
|
if filters = env[ACTION_DISPATCH_PARAMETER_FILTER]
|
22
|
-
params = filter_using_rails(params, filters)
|
30
|
+
params = filter_using_rails(params, filters)
|
23
31
|
end
|
24
32
|
params = filter_rack_file_data(env, params)
|
25
33
|
params
|
@@ -36,7 +44,7 @@ module NewRelic
|
|
36
44
|
content_type = env["CONTENT_TYPE"]
|
37
45
|
multipart = content_type && content_type.start_with?("multipart")
|
38
46
|
|
39
|
-
params.inject({}) do |memo, (k,v)|
|
47
|
+
params.inject({}) do |memo, (k, v)|
|
40
48
|
if multipart && v.is_a?(Hash) && v[:tempfile]
|
41
49
|
memo[k] = "[FILE]"
|
42
50
|
else
|
@@ -6,7 +6,6 @@
|
|
6
6
|
module NewRelic
|
7
7
|
module Agent
|
8
8
|
module PayloadMetricMapping
|
9
|
-
|
10
9
|
# this logic was extracted from TransactionEventAggregator for reuse by
|
11
10
|
# the ErrorEventAggregator
|
12
11
|
|
@@ -28,7 +27,7 @@ module NewRelic
|
|
28
27
|
|
29
28
|
private
|
30
29
|
|
31
|
-
def map_metric(metric_name, to_add={})
|
30
|
+
def map_metric(metric_name, to_add = {})
|
32
31
|
to_add.values.each(&:freeze)
|
33
32
|
|
34
33
|
mappings = SPEC_MAPPINGS.fetch(metric_name, {})
|
@@ -41,18 +40,18 @@ module NewRelic
|
|
41
40
|
# All Transactions
|
42
41
|
# Don't need to use the transaction-type specific metrics since this is
|
43
42
|
# scoped to just one transaction, so Datastore/all has what we want.
|
44
|
-
map_metric('Datastore/all',
|
45
|
-
map_metric('Datastore/all',
|
46
|
-
map_metric('GC/Transaction/all',
|
43
|
+
map_metric('Datastore/all', :total_call_time => 'databaseDuration')
|
44
|
+
map_metric('Datastore/all', :call_count => 'databaseCallCount')
|
45
|
+
map_metric('GC/Transaction/all', :total_call_time => 'gcCumulative')
|
47
46
|
|
48
47
|
# Web Metrics
|
49
48
|
map_metric('WebFrontend/QueueTime', :total_call_time => 'queueDuration')
|
50
|
-
map_metric('External/allWeb',
|
51
|
-
map_metric('External/allWeb',
|
49
|
+
map_metric('External/allWeb', :total_call_time => 'externalDuration')
|
50
|
+
map_metric('External/allWeb', :call_count => 'externalCallCount')
|
52
51
|
|
53
52
|
# Background Metrics
|
54
|
-
map_metric('External/allOther',
|
55
|
-
map_metric('External/allOther',
|
53
|
+
map_metric('External/allOther', :total_call_time => 'externalDuration')
|
54
|
+
map_metric('External/allOther', :call_count => 'externalCallCount')
|
56
55
|
end
|
57
56
|
end
|
58
57
|
end
|
@@ -6,7 +6,6 @@ require 'base64'
|
|
6
6
|
|
7
7
|
module NewRelic
|
8
8
|
module Agent
|
9
|
-
|
10
9
|
#--
|
11
10
|
# Manages the registering and servicing of pipes used by child
|
12
11
|
# processes to report data to their parent, rather than directly
|
@@ -128,7 +127,7 @@ module NewRelic
|
|
128
127
|
end
|
129
128
|
|
130
129
|
class Listener
|
131
|
-
attr_reader
|
130
|
+
attr_reader :thread
|
132
131
|
|
133
132
|
# This attr_accessor intentionally provides unsynchronized access to the
|
134
133
|
# @pipes hash. It is used to look up the write end of the pipe from
|
@@ -168,7 +167,7 @@ module NewRelic
|
|
168
167
|
clean_up_pipes
|
169
168
|
|
170
169
|
pipes_to_listen_to = @pipes_lock.synchronize do
|
171
|
-
@pipes.values.map{|pipe| pipe.out} + [wake.out]
|
170
|
+
@pipes.values.map { |pipe| pipe.out } + [wake.out]
|
172
171
|
end
|
173
172
|
|
174
173
|
if now
|
@@ -255,7 +254,7 @@ module NewRelic
|
|
255
254
|
end
|
256
255
|
|
257
256
|
def should_keep_listening?
|
258
|
-
@started || @pipes_lock.synchronize { @pipes.values.find{|pipe| !pipe.in.closed?} }
|
257
|
+
@started || @pipes_lock.synchronize { @pipes.values.find { |pipe| !pipe.in.closed? } }
|
259
258
|
end
|
260
259
|
|
261
260
|
def clean_up_pipes
|
@@ -265,13 +264,13 @@ module NewRelic
|
|
265
264
|
pipe.close unless pipe.closed?
|
266
265
|
end
|
267
266
|
end
|
268
|
-
@pipes.reject! {|id, pipe| pipe.out.closed? }
|
267
|
+
@pipes.reject! { |id, pipe| pipe.out.closed? }
|
269
268
|
end
|
270
269
|
end
|
271
270
|
|
272
271
|
def find_pipe_for_handle(out_handle)
|
273
272
|
@pipes_lock.synchronize do
|
274
|
-
@pipes.values.find{|pipe| pipe.out == out_handle }
|
273
|
+
@pipes.values.find { |pipe| pipe.out == out_handle }
|
275
274
|
end
|
276
275
|
end
|
277
276
|
end
|
@@ -11,7 +11,7 @@ module NewRelic
|
|
11
11
|
def initialize(channel_id)
|
12
12
|
@channel_id = channel_id
|
13
13
|
@collector = NewRelic::Control::Server.new(:name => 'parent',
|
14
|
-
|
14
|
+
:port => 0)
|
15
15
|
@pipe = NewRelic::Agent::PipeChannelManager.channels[@channel_id]
|
16
16
|
if @pipe && @pipe.parent_pid != $$
|
17
17
|
@pipe.after_fork_in_child
|
@@ -15,12 +15,12 @@ module NewRelic
|
|
15
15
|
def initialize(capacity)
|
16
16
|
super
|
17
17
|
@captured_lifetime = 0
|
18
|
-
@seen_lifetime
|
18
|
+
@seen_lifetime = 0
|
19
19
|
end
|
20
20
|
|
21
21
|
def heapify_items_array
|
22
22
|
if @items.is_a?(Array)
|
23
|
-
@items = Heap.new(@items) { |x| priority_for(x) }
|
23
|
+
@items = Heap.new(@items) { |x| priority_for(x) }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -38,8 +38,6 @@ module NewRelic
|
|
38
38
|
@items[0] = incoming
|
39
39
|
@items.fix(0)
|
40
40
|
incoming
|
41
|
-
else
|
42
|
-
nil
|
43
41
|
end
|
44
42
|
else
|
45
43
|
@items << (event || blk.call)
|
@@ -53,10 +51,10 @@ module NewRelic
|
|
53
51
|
def capacity=(new_capacity)
|
54
52
|
@capacity = new_capacity
|
55
53
|
old_items = @items.to_a
|
56
|
-
old_seen
|
54
|
+
old_seen = @seen
|
57
55
|
reset!
|
58
56
|
old_items.each { |i| append(event: i) }
|
59
|
-
@seen
|
57
|
+
@seen = old_seen
|
60
58
|
end
|
61
59
|
|
62
60
|
def to_a
|
@@ -92,4 +90,3 @@ module NewRelic
|
|
92
90
|
end
|
93
91
|
end
|
94
92
|
end
|
95
|
-
|