newrelic_rpm 7.2.0 → 8.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +1936 -0
- data/CHANGELOG.md +182 -9
- data/CONTRIBUTING.md +14 -2
- data/Guardfile +8 -8
- data/README.md +5 -1
- data/Rakefile +5 -7
- 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 +9 -5
- data/lib/new_relic/agent/agent.rb +44 -46
- 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 +7 -6
- data/lib/new_relic/agent/configuration/default_source.rb +352 -336
- 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 +30 -16
- data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
- data/lib/new_relic/agent/configuration/manager.rb +57 -58
- 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 +12 -11
- data/lib/new_relic/agent/configuration/yaml_source.rb +26 -5
- 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 -9
- 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 +25 -26
- 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/mongo.rb +5 -10
- data/lib/new_relic/agent/datastores/redis.rb +2 -4
- data/lib/new_relic/agent/datastores.rb +7 -9
- data/lib/new_relic/agent/distributed_tracing/cross_app_payload.rb +9 -9
- data/lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb +21 -16
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +10 -12
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb +42 -43
- 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 +25 -25
- 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 +14 -14
- data/lib/new_relic/agent/external.rb +1 -34
- data/lib/new_relic/agent/guid_generator.rb +1 -3
- 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 +7 -9
- 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 +10 -11
- 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 +3 -3
- 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/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 +8 -9
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +42 -42
- 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 +3 -23
- 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/mongo.rb +3 -141
- 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 +8 -8
- 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 +11 -47
- 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 +7 -1
- 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 +30 -30
- 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 +46 -61
- data/lib/new_relic/agent/method_tracer.rb +139 -143
- data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +21 -13
- 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 +34 -41
- 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 +3 -5
- data/lib/new_relic/agent/payload_metric_mapping.rb +8 -9
- data/lib/new_relic/agent/pipe_channel_manager.rb +15 -12
- data/lib/new_relic/agent/pipe_service.rb +2 -2
- 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/cpu_sampler.rb +1 -1
- 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 +10 -10
- 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 +7 -7
- 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 +12 -13
- data/lib/new_relic/agent/threading/thread_profile.rb +16 -19
- data/lib/new_relic/agent/tracer.rb +43 -71
- data/lib/new_relic/agent/transaction/abstract_segment.rb +9 -9
- 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 +24 -30
- 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 +85 -108
- 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 +11 -11
- 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 +4 -4
- data/lib/new_relic/agent/worker_loop.rb +8 -10
- data/lib/new_relic/agent.rb +27 -27
- data/lib/new_relic/cli/command.rb +15 -17
- data/lib/new_relic/cli/commands/deployments.rb +21 -23
- 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/constants.rb +0 -4
- 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/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 +16 -17
- 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 +4 -5
- data/lib/newrelic_rpm.rb +10 -34
- data/lib/sequel/extensions/newrelic_instrumentation.rb +4 -7
- data/lib/sequel/plugins/newrelic_instrumentation.rb +3 -9
- data/lib/tasks/all.rb +2 -2
- data/lib/tasks/config.rake +21 -21
- data/lib/tasks/multiverse.rb +4 -6
- data/lib/tasks/tests.rake +3 -7
- data/newrelic.yml +580 -3
- data/newrelic_rpm.gemspec +13 -12
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +80 -55
- metadata +42 -13
- data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +0 -53
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +0 -49
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +0 -44
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +0 -33
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +0 -125
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +0 -46
- data/lib/new_relic/agent/supported_versions.rb +0 -275
- data/lib/new_relic/control/frameworks/merb.rb +0 -29
@@ -11,13 +11,11 @@ module NewRelic
|
|
11
11
|
module Agent
|
12
12
|
class Transaction
|
13
13
|
class DatastoreSegment < Segment
|
14
|
-
|
15
14
|
UNKNOWN = 'unknown'.freeze
|
16
15
|
|
17
16
|
attr_reader :product, :operation, :collection, :sql_statement, :nosql_statement, :host, :port_path_or_id
|
18
17
|
attr_accessor :database_name, :record_sql
|
19
18
|
|
20
|
-
|
21
19
|
def initialize product, operation, collection = nil, host = nil, port_path_or_id = nil, database_name = nil, start_time = nil
|
22
20
|
@product = product
|
23
21
|
@operation = operation
|
@@ -63,7 +61,7 @@ module NewRelic
|
|
63
61
|
end
|
64
62
|
|
65
63
|
# @api private
|
66
|
-
def _notice_sql sql, config=nil, explainer=nil, binds=nil, name=nil
|
64
|
+
def _notice_sql sql, config = nil, explainer = nil, binds = nil, name = nil
|
67
65
|
return unless record_sql?
|
68
66
|
@sql_statement = Database::Statement.new sql, config, explainer, binds, name, host, port_path_or_id, database_name
|
69
67
|
end
|
@@ -120,8 +118,8 @@ module NewRelic
|
|
120
118
|
NEWLINE = "\n".freeze
|
121
119
|
|
122
120
|
def add_backtrace_parameter
|
123
|
-
|
124
|
-
|
121
|
+
return unless duration >= Agent.config[:'transaction_tracer.stack_trace_threshold']
|
122
|
+
params[:backtrace] = caller.join(NEWLINE)
|
125
123
|
end
|
126
124
|
|
127
125
|
def notice_sql_statement
|
@@ -138,8 +136,11 @@ module NewRelic
|
|
138
136
|
end
|
139
137
|
|
140
138
|
def record_span_event
|
139
|
+
# don't record a span event if the transaction is ignored
|
140
|
+
return if transaction.ignore?
|
141
|
+
|
141
142
|
aggregator = ::NewRelic::Agent.agent.span_event_aggregator
|
142
|
-
priority
|
143
|
+
priority = transaction.priority
|
143
144
|
|
144
145
|
aggregator.record(priority: priority) do
|
145
146
|
SpanEventPrimitive.for_datastore_segment(self)
|
@@ -26,7 +26,7 @@ module NewRelic
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def accept_incoming_request request, transport_type=nil
|
29
|
+
def accept_incoming_request request, transport_type = nil
|
30
30
|
accept_incoming_transport_type request, transport_type
|
31
31
|
if trace_parent_header_present? request
|
32
32
|
accept_trace_context_incoming_request request
|
@@ -73,6 +73,7 @@ module NewRelic
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def insert_headers headers
|
76
|
+
return unless NewRelic::Agent.agent.connected?
|
76
77
|
insert_trace_context_header headers
|
77
78
|
insert_distributed_trace_header headers
|
78
79
|
insert_cross_app_header headers
|
@@ -118,10 +119,10 @@ module NewRelic
|
|
118
119
|
def consume_message_synthetics_headers headers
|
119
120
|
synthetics_header = headers[CrossAppTracing::NR_MESSAGE_BROKER_SYNTHETICS_HEADER]
|
120
121
|
if synthetics_header and
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
incoming_payload = ::JSON.load(deobfuscate(synthetics_header)) and
|
123
|
+
SyntheticsMonitor.is_valid_payload?(incoming_payload) and
|
124
|
+
SyntheticsMonitor.is_supported_version?(incoming_payload) and
|
125
|
+
SyntheticsMonitor.is_trusted?(incoming_payload)
|
125
126
|
|
126
127
|
transaction.raw_synthetics_header = synthetics_header
|
127
128
|
transaction.synthetics_payload = incoming_payload
|
@@ -157,8 +158,8 @@ module NewRelic
|
|
157
158
|
|
158
159
|
return unless CrossAppTracing.trusted_valid_cross_app_id?(decoded_id)
|
159
160
|
txn_header = headers[CrossAppTracing::NR_MESSAGE_BROKER_TXN_HEADER]
|
160
|
-
txn_info
|
161
|
-
payload
|
161
|
+
txn_info = ::JSON.load(deobfuscate(txn_header))
|
162
|
+
payload = CrossAppPayload.new(decoded_id, transaction, txn_info)
|
162
163
|
|
163
164
|
@cross_app_payload = payload
|
164
165
|
rescue => e
|
@@ -169,9 +170,7 @@ module NewRelic
|
|
169
170
|
def deobfuscate message
|
170
171
|
CrossAppTracing.obfuscator.deobfuscate message
|
171
172
|
end
|
172
|
-
|
173
173
|
end
|
174
174
|
end
|
175
175
|
end
|
176
176
|
end
|
177
|
-
|
@@ -14,21 +14,21 @@ module NewRelic
|
|
14
14
|
attr_accessor :distributed_trace_payload
|
15
15
|
attr_writer :distributed_trace_payload_created
|
16
16
|
|
17
|
-
SUPPORTABILITY_DISTRIBUTED_TRACE
|
18
|
-
CREATE_PREFIX
|
19
|
-
ACCEPT_PREFIX
|
20
|
-
IGNORE_PREFIX
|
21
|
-
|
22
|
-
CREATE_SUCCESS_METRIC
|
23
|
-
CREATE_EXCEPTION_METRIC
|
24
|
-
ACCEPT_SUCCESS_METRIC
|
25
|
-
ACCEPT_EXCEPTION_METRIC
|
26
|
-
ACCEPT_PARSE_EXCEPTION_METRIC
|
27
|
-
|
28
|
-
IGNORE_ACCEPT_AFTER_CREATE_METRIC
|
29
|
-
IGNORE_MULTIPLE_ACCEPT_METRIC
|
30
|
-
IGNORE_ACCEPT_NULL_METRIC
|
31
|
-
IGNORE_ACCEPT_MAJOR_VERSION_METRIC
|
17
|
+
SUPPORTABILITY_DISTRIBUTED_TRACE = "Supportability/DistributedTrace"
|
18
|
+
CREATE_PREFIX = "#{SUPPORTABILITY_DISTRIBUTED_TRACE}/CreatePayload"
|
19
|
+
ACCEPT_PREFIX = "#{SUPPORTABILITY_DISTRIBUTED_TRACE}/AcceptPayload"
|
20
|
+
IGNORE_PREFIX = "#{ACCEPT_PREFIX}/Ignored"
|
21
|
+
|
22
|
+
CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
|
23
|
+
CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
|
24
|
+
ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
|
25
|
+
ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
|
26
|
+
ACCEPT_PARSE_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/ParseException"
|
27
|
+
|
28
|
+
IGNORE_ACCEPT_AFTER_CREATE_METRIC = "#{IGNORE_PREFIX}/CreateBeforeAccept"
|
29
|
+
IGNORE_MULTIPLE_ACCEPT_METRIC = "#{IGNORE_PREFIX}/Multiple"
|
30
|
+
IGNORE_ACCEPT_NULL_METRIC = "#{IGNORE_PREFIX}/Null"
|
31
|
+
IGNORE_ACCEPT_MAJOR_VERSION_METRIC = "#{IGNORE_PREFIX}/MajorVersion"
|
32
32
|
IGNORE_ACCEPT_UNTRUSTED_ACCOUNT_METRIC = "#{IGNORE_PREFIX}/UntrustedAccount"
|
33
33
|
|
34
34
|
LBRACE = "{"
|
@@ -122,12 +122,12 @@ module NewRelic
|
|
122
122
|
def check_required_fields_present(payload)
|
123
123
|
if \
|
124
124
|
!payload.version.nil? &&
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
!payload.parent_account_id.nil? &&
|
126
|
+
!payload.parent_app_id.nil? &&
|
127
|
+
!payload.parent_type.nil? &&
|
128
|
+
(!payload.transaction_id.nil? || !payload.id.nil?) &&
|
129
|
+
!payload.trace_id.nil? &&
|
130
|
+
!payload.timestamp.nil?
|
131
131
|
|
132
132
|
true
|
133
133
|
else
|
@@ -170,4 +170,3 @@ module NewRelic
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
173
|
-
|
@@ -9,7 +9,6 @@ require 'new_relic/agent/http_clients/uri_util'
|
|
9
9
|
module NewRelic
|
10
10
|
module Agent
|
11
11
|
class Transaction
|
12
|
-
|
13
12
|
#
|
14
13
|
# This class represents an external segment in a transaction trace.
|
15
14
|
#
|
@@ -219,10 +218,9 @@ module NewRelic
|
|
219
218
|
end
|
220
219
|
|
221
220
|
def add_unscoped_metrics
|
222
|
-
@unscoped_metrics = [
|
221
|
+
@unscoped_metrics = [EXTERNAL_ALL,
|
223
222
|
"External/#{host}/all",
|
224
|
-
suffixed_rollup_metric
|
225
|
-
]
|
223
|
+
suffixed_rollup_metric]
|
226
224
|
|
227
225
|
if cross_app_request?
|
228
226
|
@unscoped_metrics << "ExternalApp/#{host}/#{cross_process_id}/all"
|
@@ -250,8 +248,11 @@ module NewRelic
|
|
250
248
|
end
|
251
249
|
|
252
250
|
def record_span_event
|
251
|
+
# don't record a span event if the transaction is ignored
|
252
|
+
return if transaction.ignore?
|
253
|
+
|
253
254
|
aggregator = ::NewRelic::Agent.agent.span_event_aggregator
|
254
|
-
priority
|
255
|
+
priority = transaction.priority
|
255
256
|
aggregator.record(priority: priority) do
|
256
257
|
SpanEventPrimitive.for_external_request_segment(self)
|
257
258
|
end
|
@@ -9,16 +9,16 @@ module NewRelic
|
|
9
9
|
module Agent
|
10
10
|
class Transaction
|
11
11
|
class MessageBrokerSegment < Segment
|
12
|
-
CONSUME
|
12
|
+
CONSUME = 'Consume'.freeze
|
13
13
|
EXCHANGE = 'Exchange'.freeze
|
14
|
-
NAMED
|
15
|
-
PRODUCE
|
16
|
-
QUEUE
|
17
|
-
PURGE
|
18
|
-
SLASH
|
19
|
-
TEMP
|
20
|
-
TOPIC
|
21
|
-
UNKNOWN
|
14
|
+
NAMED = 'Named/'.freeze
|
15
|
+
PRODUCE = 'Produce'.freeze
|
16
|
+
QUEUE = 'Queue'.freeze
|
17
|
+
PURGE = 'Purge'.freeze
|
18
|
+
SLASH = '/'.freeze
|
19
|
+
TEMP = 'Temp'.freeze
|
20
|
+
TOPIC = 'Topic'.freeze
|
21
|
+
UNKNOWN = 'Unknown'.freeze
|
22
22
|
|
23
23
|
DESTINATION_TYPES = [
|
24
24
|
:exchange,
|
@@ -36,35 +36,29 @@ module NewRelic
|
|
36
36
|
}
|
37
37
|
|
38
38
|
TYPES = {
|
39
|
-
exchange:
|
39
|
+
exchange: EXCHANGE,
|
40
40
|
temporary_queue: QUEUE,
|
41
|
-
queue:
|
41
|
+
queue: QUEUE,
|
42
42
|
temporary_topic: TOPIC,
|
43
|
-
topic:
|
44
|
-
unknown:
|
43
|
+
topic: TOPIC,
|
44
|
+
unknown: EXCHANGE
|
45
45
|
}
|
46
46
|
|
47
47
|
METRIC_PREFIX = 'MessageBroker/'.freeze
|
48
48
|
|
49
49
|
attr_reader :action,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
:destination_name,
|
51
|
+
:destination_type,
|
52
|
+
:library,
|
53
|
+
:headers
|
54
54
|
|
55
|
-
def initialize
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# ruby 2.0.0 does not support required kwargs
|
64
|
-
raise ArgumentError, 'missing required argument: action' if action.nil?
|
65
|
-
raise ArgumentError, 'missing required argument: library' if library.nil?
|
66
|
-
raise ArgumentError, 'missing required argument: destination_type' if destination_type.nil?
|
67
|
-
raise ArgumentError, 'missing required argument: destination_name' if destination_name.nil?
|
55
|
+
def initialize(action:,
|
56
|
+
library:,
|
57
|
+
destination_type:,
|
58
|
+
destination_name:,
|
59
|
+
headers: nil,
|
60
|
+
parameters: nil,
|
61
|
+
start_time: nil)
|
68
62
|
|
69
63
|
@action = action
|
70
64
|
@library = library
|
@@ -9,7 +9,7 @@ module NewRelic
|
|
9
9
|
class Transaction
|
10
10
|
class RequestAttributes
|
11
11
|
attr_reader :request_path, :referer, :accept, :content_length, :content_type,
|
12
|
-
|
12
|
+
:host, :port, :user_agent, :request_method
|
13
13
|
|
14
14
|
HTTP_ACCEPT_HEADER_KEY = "HTTP_ACCEPT".freeze
|
15
15
|
|
@@ -26,9 +26,9 @@ module NewRelic
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def assign_agent_attributes txn
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
default_destinations = AttributeFilter::DST_TRANSACTION_TRACER |
|
30
|
+
AttributeFilter::DST_TRANSACTION_EVENTS |
|
31
|
+
AttributeFilter::DST_ERROR_COLLECTOR
|
32
32
|
|
33
33
|
if referer
|
34
34
|
txn.add_agent_attribute :'request.headers.referer', referer, AttributeFilter::DST_ERROR_COLLECTOR
|
@@ -36,9 +36,9 @@ module NewRelic
|
|
36
36
|
|
37
37
|
if request_path
|
38
38
|
txn.add_agent_attribute :'request.uri',
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
request_path,
|
40
|
+
AttributeFilter::DST_TRANSACTION_TRACER |
|
41
|
+
AttributeFilter::DST_ERROR_COLLECTOR
|
42
42
|
end
|
43
43
|
|
44
44
|
if accept
|
@@ -15,7 +15,7 @@ module NewRelic
|
|
15
15
|
# initialize it as an array that would be empty, have one item, or many items.
|
16
16
|
attr_reader :unscoped_metrics, :custom_transaction_attributes
|
17
17
|
|
18
|
-
def initialize name=nil, unscoped_metrics=nil, start_time=nil
|
18
|
+
def initialize name = nil, unscoped_metrics = nil, start_time = nil
|
19
19
|
@unscoped_metrics = unscoped_metrics
|
20
20
|
super name, start_time
|
21
21
|
end
|
@@ -24,7 +24,7 @@ module NewRelic
|
|
24
24
|
@attributes ||= Attributes.new(NewRelic::Agent.instance.attribute_filter)
|
25
25
|
end
|
26
26
|
|
27
|
-
def add_agent_attribute(key, value, default_destinations=AttributeFilter::DST_SPAN_EVENTS)
|
27
|
+
def add_agent_attribute(key, value, default_destinations = AttributeFilter::DST_SPAN_EVENTS)
|
28
28
|
attributes.add_agent_attribute(key, value, default_destinations)
|
29
29
|
end
|
30
30
|
|
@@ -79,8 +79,11 @@ module NewRelic
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def record_span_event
|
82
|
+
# don't record a span event if the transaction is ignored
|
83
|
+
return if transaction.ignore?
|
84
|
+
|
82
85
|
aggregator = ::NewRelic::Agent.agent.span_event_aggregator
|
83
|
-
priority
|
86
|
+
priority = transaction.priority
|
84
87
|
|
85
88
|
aggregator.record(priority: priority) do
|
86
89
|
SpanEventPrimitive.for_segment(self)
|
@@ -8,7 +8,6 @@ module NewRelic
|
|
8
8
|
module Agent
|
9
9
|
class Transaction
|
10
10
|
class SlowestSampleBuffer < TransactionSampleBuffer
|
11
|
-
|
12
11
|
CAPACITY = 1
|
13
12
|
|
14
13
|
def capacity
|
@@ -18,7 +17,6 @@ module NewRelic
|
|
18
17
|
def allow_sample?(sample)
|
19
18
|
sample.threshold && sample.duration >= sample.threshold
|
20
19
|
end
|
21
|
-
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -12,7 +12,7 @@ module NewRelic
|
|
12
12
|
|
13
13
|
attr_reader :start_time, :root_node
|
14
14
|
attr_accessor :transaction_name, :guid, :attributes,
|
15
|
-
|
15
|
+
:node_count, :finished, :threshold, :profile
|
16
16
|
|
17
17
|
ROOT = "ROOT".freeze
|
18
18
|
|
@@ -31,7 +31,7 @@ module NewRelic
|
|
31
31
|
node_count = 0
|
32
32
|
each_node do |node|
|
33
33
|
next if node == root_node
|
34
|
-
node_count +=1
|
34
|
+
node_count += 1
|
35
35
|
end
|
36
36
|
node_count
|
37
37
|
end
|
@@ -103,20 +103,20 @@ module NewRelic
|
|
103
103
|
@root_node.each_node_with_nest_tracking(&block)
|
104
104
|
end
|
105
105
|
|
106
|
-
AGENT_ATTRIBUTES_KEY
|
107
|
-
USER_ATTRIBUTES_KEY
|
106
|
+
AGENT_ATTRIBUTES_KEY = 'agentAttributes'.freeze
|
107
|
+
USER_ATTRIBUTES_KEY = 'userAttributes'.freeze
|
108
108
|
INTRINSIC_ATTRIBUTES_KEY = 'intrinsics'.freeze
|
109
109
|
|
110
110
|
def attributes_for_tracer_destination
|
111
111
|
destination = NewRelic::Agent::AttributeFilter::DST_TRANSACTION_TRACER
|
112
112
|
|
113
|
-
agent_attributes
|
114
|
-
custom_attributes
|
113
|
+
agent_attributes = self.attributes.agent_attributes_for(destination)
|
114
|
+
custom_attributes = self.attributes.custom_attributes_for(destination)
|
115
115
|
intrinsic_attributes = self.attributes.intrinsic_attributes_for(destination)
|
116
116
|
|
117
117
|
{
|
118
|
-
AGENT_ATTRIBUTES_KEY
|
119
|
-
USER_ATTRIBUTES_KEY
|
118
|
+
AGENT_ATTRIBUTES_KEY => agent_attributes,
|
119
|
+
USER_ATTRIBUTES_KEY => custom_attributes,
|
120
120
|
INTRINSIC_ATTRIBUTES_KEY => intrinsic_attributes
|
121
121
|
}
|
122
122
|
end
|
@@ -21,24 +21,24 @@ module NewRelic
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
SUPPORTABILITY_PREFIX
|
25
|
-
CREATE_PREFIX
|
26
|
-
ACCEPT_PREFIX
|
27
|
-
TRACESTATE_PREFIX
|
24
|
+
SUPPORTABILITY_PREFIX = "Supportability/TraceContext"
|
25
|
+
CREATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/Create"
|
26
|
+
ACCEPT_PREFIX = "#{SUPPORTABILITY_PREFIX}/Accept"
|
27
|
+
TRACESTATE_PREFIX = "#{SUPPORTABILITY_PREFIX}/TraceState"
|
28
28
|
|
29
|
-
CREATE_SUCCESS_METRIC
|
30
|
-
CREATE_EXCEPTION_METRIC
|
29
|
+
CREATE_SUCCESS_METRIC = "#{CREATE_PREFIX}/Success"
|
30
|
+
CREATE_EXCEPTION_METRIC = "#{CREATE_PREFIX}/Exception"
|
31
31
|
|
32
|
-
ACCEPT_SUCCESS_METRIC
|
33
|
-
ACCEPT_EXCEPTION_METRIC
|
34
|
-
IGNORE_MULTIPLE_ACCEPT_METRIC
|
32
|
+
ACCEPT_SUCCESS_METRIC = "#{ACCEPT_PREFIX}/Success"
|
33
|
+
ACCEPT_EXCEPTION_METRIC = "#{ACCEPT_PREFIX}/Exception"
|
34
|
+
IGNORE_MULTIPLE_ACCEPT_METRIC = "#{ACCEPT_PREFIX}/Ignored/Multiple"
|
35
35
|
IGNORE_ACCEPT_AFTER_CREATE_METRIC = "#{ACCEPT_PREFIX}/Ignored/CreateBeforeAccept"
|
36
36
|
|
37
|
-
NO_NR_ENTRY_TRACESTATE_METRIC
|
37
|
+
NO_NR_ENTRY_TRACESTATE_METRIC = "#{TRACESTATE_PREFIX}/NoNrEntry"
|
38
38
|
INVALID_TRACESTATE_PAYLOAD_METRIC = "#{TRACESTATE_PREFIX}/InvalidNrEntry"
|
39
39
|
|
40
40
|
attr_accessor :trace_context_header_data
|
41
|
-
attr_reader
|
41
|
+
attr_reader :trace_state_payload
|
42
42
|
|
43
43
|
def trace_parent_header_present? request
|
44
44
|
request[NewRelic::HTTP_TRACEPARENT_KEY]
|
@@ -48,7 +48,7 @@ module NewRelic
|
|
48
48
|
header_data = NewRelic::Agent::DistributedTracing::TraceContext.parse(
|
49
49
|
format: NewRelic::FORMAT_RACK,
|
50
50
|
carrier: request,
|
51
|
-
trace_state_entry_key: AccountHelpers.trace_state_entry_key
|
51
|
+
trace_state_entry_key: AccountHelpers.trace_state_entry_key
|
52
52
|
)
|
53
53
|
return if header_data.nil?
|
54
54
|
|
@@ -56,7 +56,7 @@ module NewRelic
|
|
56
56
|
end
|
57
57
|
private :accept_trace_context_incoming_request
|
58
58
|
|
59
|
-
def insert_trace_context_header header, format=NewRelic::FORMAT_NON_RACK
|
59
|
+
def insert_trace_context_header header, format = NewRelic::FORMAT_NON_RACK
|
60
60
|
return unless Agent.config[:'distributed_tracing.enabled']
|
61
61
|
|
62
62
|
NewRelic::Agent::DistributedTracing::TraceContext.insert \
|
@@ -98,7 +98,6 @@ module NewRelic
|
|
98
98
|
return
|
99
99
|
end
|
100
100
|
|
101
|
-
|
102
101
|
span_guid = Agent.config[:'span_events.enabled'] ? transaction.current_segment.guid : nil
|
103
102
|
transaction_guid = Agent.config[:'analytics_events.enabled'] ? transaction.guid : nil
|
104
103
|
|
@@ -161,7 +160,6 @@ module NewRelic
|
|
161
160
|
def trace_context_inserted?
|
162
161
|
@trace_context_inserted ||= false
|
163
162
|
end
|
164
|
-
|
165
163
|
end
|
166
164
|
end
|
167
165
|
end
|
@@ -17,13 +17,13 @@ module NewRelic
|
|
17
17
|
|
18
18
|
UNKNOWN_NODE_NAME = '<unknown>'.freeze
|
19
19
|
|
20
|
-
def initialize(metric_name, relative_start, relative_end=nil, params=nil, parent=nil)
|
20
|
+
def initialize(metric_name, relative_start, relative_end = nil, params = nil, parent = nil)
|
21
21
|
@entry_timestamp = relative_start
|
22
|
-
@metric_name
|
23
|
-
@exit_timestamp
|
24
|
-
@children
|
25
|
-
@params
|
26
|
-
@parent_node
|
22
|
+
@metric_name = metric_name || UNKNOWN_NODE_NAME
|
23
|
+
@exit_timestamp = relative_end
|
24
|
+
@children = nil
|
25
|
+
@params = select_allowed_params(params)
|
26
|
+
@parent_node = parent
|
27
27
|
end
|
28
28
|
|
29
29
|
def select_allowed_params params
|
@@ -44,23 +44,23 @@ module NewRelic
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def to_array
|
47
|
-
params = @params
|
48
|
-
[
|
47
|
+
params = @params || NewRelic::EMPTY_HASH
|
48
|
+
[NewRelic::Helper.time_to_millis(@entry_timestamp),
|
49
49
|
NewRelic::Helper.time_to_millis(@exit_timestamp),
|
50
50
|
NewRelic::Coerce.string(@metric_name),
|
51
|
-
params
|
52
|
-
[
|
51
|
+
params] +
|
52
|
+
[(@children ? @children.map { |s| s.to_array } : NewRelic::EMPTY_ARRAY)]
|
53
53
|
end
|
54
54
|
|
55
55
|
def path_string
|
56
|
-
"#{metric_name}[#{children.collect {|node| node.path_string }.join('')}]"
|
56
|
+
"#{metric_name}[#{children.collect { |node| node.path_string }.join('')}]"
|
57
57
|
end
|
58
58
|
|
59
59
|
def to_s_compact
|
60
60
|
str = ""
|
61
61
|
str << metric_name
|
62
62
|
if children.any?
|
63
|
-
str << "{#{children.map { |
|
63
|
+
str << "{#{children.map { |cs| cs.to_s_compact }.join(",")}}"
|
64
64
|
end
|
65
65
|
str
|
66
66
|
end
|
@@ -68,9 +68,9 @@ module NewRelic
|
|
68
68
|
def to_debug_str(depth)
|
69
69
|
tab = " " * depth
|
70
70
|
s = tab.clone
|
71
|
-
s << ">> #{'%3i ms' % (@entry_timestamp*1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
|
71
|
+
s << ">> #{'%3i ms' % (@entry_timestamp * 1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
|
72
72
|
unless params.empty?
|
73
|
-
params.each do |k,v|
|
73
|
+
params.each do |k, v|
|
74
74
|
s << "#{tab} -#{'%-16s' % k}: #{v.to_s[0..80]}\n"
|
75
75
|
end
|
76
76
|
end
|
@@ -80,7 +80,7 @@ module NewRelic
|
|
80
80
|
s << tab + "<< "
|
81
81
|
s << case @exit_timestamp
|
82
82
|
when nil then ' n/a'
|
83
|
-
when Numeric then '%3i ms' % (@exit_timestamp*1000)
|
83
|
+
when Numeric then '%3i ms' % (@exit_timestamp * 1000)
|
84
84
|
else @exit_timestamp.to_s
|
85
85
|
end
|
86
86
|
s << " #{metric_name}\n"
|
@@ -110,7 +110,7 @@ module NewRelic
|
|
110
110
|
|
111
111
|
def count_nodes
|
112
112
|
count = 1
|
113
|
-
children.each { |
|
113
|
+
children.each { |node| count += node.count_nodes }
|
114
114
|
count
|
115
115
|
end
|
116
116
|
|
@@ -6,7 +6,6 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
class Transaction
|
8
8
|
module Tracing
|
9
|
-
|
10
9
|
attr_reader :current_segment
|
11
10
|
|
12
11
|
def async?
|
@@ -48,8 +47,7 @@ module NewRelic
|
|
48
47
|
segments.each { |s| s.finalize }
|
49
48
|
end
|
50
49
|
|
51
|
-
|
52
|
-
WEB_TRANSACTION_TOTAL_TIME = "WebTransactionTotalTime".freeze
|
50
|
+
WEB_TRANSACTION_TOTAL_TIME = "WebTransactionTotalTime".freeze
|
53
51
|
OTHER_TRANSACTION_TOTAL_TIME = "OtherTransactionTotalTime".freeze
|
54
52
|
|
55
53
|
def record_total_time_metrics
|
@@ -81,7 +81,7 @@ module NewRelic
|
|
81
81
|
# This doesn't use the more convenient #last and #sort_by to avoid
|
82
82
|
# additional array allocations (and abundant alliteration)
|
83
83
|
def truncate_samples
|
84
|
-
@samples.sort!{|a,b| a.duration <=> b.duration}
|
84
|
+
@samples.sort! { |a, b| a.duration <=> b.duration }
|
85
85
|
@samples.slice!(0..-(max_capacity + 1))
|
86
86
|
end
|
87
87
|
|
@@ -98,7 +98,6 @@ module NewRelic
|
|
98
98
|
def add_sample(sample)
|
99
99
|
@samples << sample
|
100
100
|
end
|
101
|
-
|
102
101
|
end
|
103
102
|
end
|
104
103
|
end
|