newrelic_rpm 8.2.0 → 8.5.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 +1938 -0
- data/Brewfile +10 -0
- data/CHANGELOG.md +80 -2
- data/CONTRIBUTING.md +19 -3
- data/DOCKER.md +167 -0
- data/Dockerfile +10 -0
- data/Guardfile +8 -8
- data/Rakefile +14 -9
- data/bin/mongrel_rpm +8 -9
- data/bin/newrelic +1 -1
- data/bin/nrdebug +14 -14
- data/docker-compose.yml +85 -0
- 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 +347 -330
- 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 +11 -6
- data/lib/new_relic/agent/configuration/high_security_source.rb +7 -7
- data/lib/new_relic/agent/configuration/manager.rb +74 -63
- 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 +11 -11
- 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 +23 -23
- 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 +6 -8
- 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 +2 -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 -4
- 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 +2 -6
- 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/instrumentation.rb +0 -1
- data/lib/new_relic/agent/instrumentation/logger.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +2 -1
- data/lib/new_relic/agent/instrumentation/memcache/helper.rb +0 -1
- data/lib/new_relic/agent/instrumentation/memcache/prepend.rb +1 -0
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +9 -10
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +5 -6
- 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/instrumentation.rb +3 -2
- data/lib/new_relic/agent/instrumentation/padrino/prepend.rb +1 -1
- data/lib/new_relic/agent/instrumentation/padrino.rb +0 -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/instrumentation.rb +0 -1
- 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 +8 -4
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +42 -44
- data/lib/new_relic/agent/method_tracer.rb +11 -14
- data/lib/new_relic/agent/method_tracer_helpers.rb +2 -2
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +13 -12
- 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 +20 -20
- 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 +16 -8
- 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 +3 -3
- 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 +1 -2
- 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 +5 -7
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +7 -9
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +21 -22
- data/lib/new_relic/agent/transaction/external_request_segment.rb +3 -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 +3 -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 +14 -16
- 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 +7 -8
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -29
- data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
- 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/aws.rb +32 -2
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +15 -2
- 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 +3 -2
- 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 +4 -15
- 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 +3 -3
- data/newrelic_rpm.gemspec +13 -12
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +55 -55
- metadata +38 -4
@@ -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,9 +98,8 @@ 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
|
-
transaction_guid = Agent.config[:'
|
102
|
+
transaction_guid = Agent.config[:'transaction_events.enabled'] ? transaction.guid : nil
|
104
103
|
|
105
104
|
TraceContextPayload.create \
|
106
105
|
parent_account_id: Agent.config[:account_id],
|
@@ -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
|
@@ -24,33 +24,33 @@ module NewRelic
|
|
24
24
|
include Tracing
|
25
25
|
|
26
26
|
# for nested transactions
|
27
|
-
NESTED_TRANSACTION_PREFIX
|
28
|
-
CONTROLLER_PREFIX
|
29
|
-
MIDDLEWARE_PREFIX
|
30
|
-
OTHER_TRANSACTION_PREFIX
|
31
|
-
TASK_PREFIX
|
32
|
-
RAKE_PREFIX
|
33
|
-
MESSAGE_PREFIX
|
34
|
-
RACK_PREFIX
|
35
|
-
SINATRA_PREFIX
|
36
|
-
GRAPE_PREFIX
|
37
|
-
ACTION_CABLE_PREFIX
|
38
|
-
|
39
|
-
WEB_TRANSACTION_CATEGORIES
|
40
|
-
TRANSACTION_NAMING_SOURCES
|
41
|
-
|
42
|
-
MIDDLEWARE_SUMMARY_METRICS
|
43
|
-
WEB_SUMMARY_METRIC
|
44
|
-
OTHER_SUMMARY_METRIC
|
45
|
-
QUEUE_TIME_METRIC
|
46
|
-
|
47
|
-
APDEX_S
|
48
|
-
APDEX_T
|
49
|
-
APDEX_F
|
50
|
-
APDEX_ALL_METRIC
|
51
|
-
APDEX_METRIC
|
52
|
-
APDEX_OTHER_METRIC
|
53
|
-
APDEX_TXN_METRIC_PREFIX
|
27
|
+
NESTED_TRANSACTION_PREFIX = "Nested/"
|
28
|
+
CONTROLLER_PREFIX = "Controller/"
|
29
|
+
MIDDLEWARE_PREFIX = "Middleware/Rack/"
|
30
|
+
OTHER_TRANSACTION_PREFIX = "OtherTransaction/"
|
31
|
+
TASK_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Background/"
|
32
|
+
RAKE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Rake/"
|
33
|
+
MESSAGE_PREFIX = "#{OTHER_TRANSACTION_PREFIX}Message/"
|
34
|
+
RACK_PREFIX = "#{CONTROLLER_PREFIX}Rack/"
|
35
|
+
SINATRA_PREFIX = "#{CONTROLLER_PREFIX}Sinatra/"
|
36
|
+
GRAPE_PREFIX = "#{CONTROLLER_PREFIX}Grape/"
|
37
|
+
ACTION_CABLE_PREFIX = "#{CONTROLLER_PREFIX}ActionCable/"
|
38
|
+
|
39
|
+
WEB_TRANSACTION_CATEGORIES = [:web, :controller, :uri, :rack, :sinatra, :grape, :middleware, :action_cable].freeze
|
40
|
+
TRANSACTION_NAMING_SOURCES = [:child, :api].freeze
|
41
|
+
|
42
|
+
MIDDLEWARE_SUMMARY_METRICS = ["Middleware/all"].freeze
|
43
|
+
WEB_SUMMARY_METRIC = "HttpDispatcher"
|
44
|
+
OTHER_SUMMARY_METRIC = "#{OTHER_TRANSACTION_PREFIX}all"
|
45
|
+
QUEUE_TIME_METRIC = "WebFrontend/QueueTime"
|
46
|
+
|
47
|
+
APDEX_S = "S"
|
48
|
+
APDEX_T = "T"
|
49
|
+
APDEX_F = "F"
|
50
|
+
APDEX_ALL_METRIC = "ApdexAll"
|
51
|
+
APDEX_METRIC = "Apdex"
|
52
|
+
APDEX_OTHER_METRIC = "ApdexOther"
|
53
|
+
APDEX_TXN_METRIC_PREFIX = "Apdex/"
|
54
54
|
APDEX_OTHER_TXN_METRIC_PREFIX = "ApdexOther/Transaction/"
|
55
55
|
|
56
56
|
JRUBY_CPU_TIME_ERROR = "Error calculating JRuby CPU Time"
|
@@ -67,27 +67,27 @@ module NewRelic
|
|
67
67
|
attr_accessor :apdex_start
|
68
68
|
|
69
69
|
attr_accessor :exceptions,
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
:filtered_params,
|
71
|
+
:jruby_cpu_start,
|
72
|
+
:process_cpu_start,
|
73
|
+
:http_response_code,
|
74
|
+
:response_content_length,
|
75
|
+
:response_content_type,
|
76
|
+
:parent_span_id
|
77
77
|
|
78
78
|
attr_reader :guid,
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
:metrics,
|
80
|
+
:gc_start_snapshot,
|
81
|
+
:category,
|
82
|
+
:attributes,
|
83
|
+
:payload,
|
84
|
+
:nesting_max_depth,
|
85
|
+
:segments,
|
86
|
+
:end_time,
|
87
|
+
:duration
|
88
88
|
|
89
89
|
attr_writer :sampled,
|
90
|
-
|
90
|
+
:priority
|
91
91
|
|
92
92
|
# Populated with the trace sample once this transaction is completed.
|
93
93
|
attr_reader :transaction_trace
|
@@ -100,13 +100,13 @@ module NewRelic
|
|
100
100
|
Tracer.current_transaction
|
101
101
|
end
|
102
102
|
|
103
|
-
def self.set_default_transaction_name(partial_name, category = nil) #THREAD_LOCAL_ACCESS
|
104
|
-
txn
|
103
|
+
def self.set_default_transaction_name(partial_name, category = nil) # THREAD_LOCAL_ACCESS
|
104
|
+
txn = tl_current
|
105
105
|
name = name_from_partial(partial_name, category || txn.category)
|
106
106
|
txn.set_default_transaction_name(name, category)
|
107
107
|
end
|
108
108
|
|
109
|
-
def self.set_overriding_transaction_name(partial_name, category = nil) #THREAD_LOCAL_ACCESS
|
109
|
+
def self.set_overriding_transaction_name(partial_name, category = nil) # THREAD_LOCAL_ACCESS
|
110
110
|
txn = tl_current
|
111
111
|
return unless txn
|
112
112
|
|
@@ -143,7 +143,7 @@ module NewRelic
|
|
143
143
|
end
|
144
144
|
|
145
145
|
# See NewRelic::Agent.notice_error for options and commentary
|
146
|
-
def self.notice_error(e, options={})
|
146
|
+
def self.notice_error(e, options = {})
|
147
147
|
if txn = Tracer.current_transaction
|
148
148
|
txn.notice_error(e, options)
|
149
149
|
elsif NewRelic::Agent.instance
|
@@ -156,7 +156,7 @@ module NewRelic
|
|
156
156
|
#
|
157
157
|
# @api public
|
158
158
|
#
|
159
|
-
def self.recording_web_transaction? #THREAD_LOCAL_ACCESS
|
159
|
+
def self.recording_web_transaction? # THREAD_LOCAL_ACCESS
|
160
160
|
NewRelic::Agent.record_api_supportability_metric(:recording_web_transaction?)
|
161
161
|
|
162
162
|
txn = tl_current
|
@@ -220,8 +220,8 @@ module NewRelic
|
|
220
220
|
@segments = []
|
221
221
|
|
222
222
|
self.default_name = options[:transaction_name]
|
223
|
-
@overridden_name
|
224
|
-
@frozen_name
|
223
|
+
@overridden_name = nil
|
224
|
+
@frozen_name = nil
|
225
225
|
|
226
226
|
@category = category
|
227
227
|
@start_time = Process.clock_gettime(Process::CLOCK_REALTIME)
|
@@ -352,9 +352,9 @@ module NewRelic
|
|
352
352
|
|
353
353
|
def best_name
|
354
354
|
@frozen_name ||
|
355
|
-
|
356
|
-
|
357
|
-
|
355
|
+
@overridden_name ||
|
356
|
+
@default_name ||
|
357
|
+
NewRelic::Agent::UNKNOWN_METRIC
|
358
358
|
end
|
359
359
|
|
360
360
|
# For common interface with Trace
|
@@ -546,8 +546,8 @@ module NewRelic
|
|
546
546
|
|
547
547
|
def assign_agent_attributes
|
548
548
|
default_destinations = AttributeFilter::DST_TRANSACTION_TRACER |
|
549
|
-
|
550
|
-
|
549
|
+
AttributeFilter::DST_TRANSACTION_EVENTS |
|
550
|
+
AttributeFilter::DST_ERROR_COLLECTOR
|
551
551
|
|
552
552
|
if http_response_code
|
553
553
|
add_agent_attribute(:'http.statusCode', http_response_code, default_destinations)
|
@@ -622,14 +622,14 @@ module NewRelic
|
|
622
622
|
|
623
623
|
def generate_payload
|
624
624
|
@payload = {
|
625
|
-
:name
|
626
|
-
:bucket
|
627
|
-
:start_timestamp
|
628
|
-
:duration
|
629
|
-
:metrics
|
630
|
-
:attributes
|
631
|
-
:error
|
632
|
-
:priority
|
625
|
+
:name => @frozen_name,
|
626
|
+
:bucket => recording_web_transaction? ? :request : :background,
|
627
|
+
:start_timestamp => start_time,
|
628
|
+
:duration => duration,
|
629
|
+
:metrics => @metrics,
|
630
|
+
:attributes => @attributes,
|
631
|
+
:error => false,
|
632
|
+
:priority => priority
|
633
633
|
}
|
634
634
|
|
635
635
|
distributed_tracer.append_payload(@payload)
|
@@ -683,7 +683,6 @@ module NewRelic
|
|
683
683
|
when :apdex_s then APDEX_S
|
684
684
|
when :apdex_t then APDEX_T
|
685
685
|
when :apdex_f then APDEX_F
|
686
|
-
else nil
|
687
686
|
end
|
688
687
|
payload[:apdex_perf_zone] = bucket_str if bucket_str
|
689
688
|
end
|
@@ -692,8 +691,8 @@ module NewRelic
|
|
692
691
|
return unless is_synthetics_request?
|
693
692
|
|
694
693
|
payload[:synthetics_resource_id] = synthetics_resource_id
|
695
|
-
payload[:synthetics_job_id]
|
696
|
-
payload[:synthetics_monitor_id]
|
694
|
+
payload[:synthetics_job_id] = synthetics_job_id
|
695
|
+
payload[:synthetics_monitor_id] = synthetics_monitor_id
|
697
696
|
end
|
698
697
|
|
699
698
|
def merge_metrics
|
@@ -703,9 +702,9 @@ module NewRelic
|
|
703
702
|
def record_exceptions
|
704
703
|
error_recorded = false
|
705
704
|
@exceptions.each do |exception, options|
|
706
|
-
options[:uri]
|
707
|
-
options[:port]
|
708
|
-
options[:metric]
|
705
|
+
options[:uri] ||= request_path if request_path
|
706
|
+
options[:port] = request_port if request_port
|
707
|
+
options[:metric] = best_name
|
709
708
|
options[:attributes] = @attributes
|
710
709
|
|
711
710
|
span_id = options.delete :span_id
|
@@ -715,8 +714,7 @@ module NewRelic
|
|
715
714
|
end
|
716
715
|
|
717
716
|
# Do not call this. Invoke the class method instead.
|
718
|
-
def notice_error(error, options={}) # :nodoc:
|
719
|
-
|
717
|
+
def notice_error(error, options = {}) # :nodoc:
|
720
718
|
# Only the last error is kept
|
721
719
|
if @current_segment
|
722
720
|
@current_segment.notice_error error, expected: options[:expected]
|
@@ -771,8 +769,8 @@ module NewRelic
|
|
771
769
|
record_apdex_metrics(APDEX_METRIC, APDEX_TXN_METRIC_PREFIX, apdex_t)
|
772
770
|
else
|
773
771
|
record_apdex_metrics(APDEX_OTHER_METRIC,
|
774
|
-
|
775
|
-
|
772
|
+
APDEX_OTHER_TXN_METRIC_PREFIX,
|
773
|
+
transaction_specific_apdex_t)
|
776
774
|
end
|
777
775
|
end
|
778
776
|
end
|
@@ -780,9 +778,9 @@ module NewRelic
|
|
780
778
|
def record_apdex_metrics(rollup_metric, transaction_prefix, current_apdex_t)
|
781
779
|
return unless current_apdex_t
|
782
780
|
|
783
|
-
total_duration
|
781
|
+
total_duration = end_time - apdex_start
|
784
782
|
apdex_bucket_global = apdex_bucket(total_duration, current_apdex_t)
|
785
|
-
apdex_bucket_txn
|
783
|
+
apdex_bucket_txn = apdex_bucket(duration, current_apdex_t)
|
786
784
|
|
787
785
|
@metrics.record_unscoped(rollup_metric, apdex_bucket_global, current_apdex_t)
|
788
786
|
@metrics.record_unscoped(APDEX_ALL_METRIC, apdex_bucket_global, current_apdex_t)
|
@@ -800,7 +798,7 @@ module NewRelic
|
|
800
798
|
end
|
801
799
|
|
802
800
|
def threshold
|
803
|
-
|
801
|
+
source_class = Agent.config.source(:'transaction_tracer.transaction_threshold').class
|
804
802
|
if source_class == Configuration::DefaultSource
|
805
803
|
apdex_t * 4
|
806
804
|
else
|
@@ -808,7 +806,7 @@ module NewRelic
|
|
808
806
|
end
|
809
807
|
end
|
810
808
|
|
811
|
-
def with_database_metric_name(model, method, product=nil)
|
809
|
+
def with_database_metric_name(model, method, product = nil)
|
812
810
|
previous = self.instrumentation_state[:datastore_override]
|
813
811
|
model_name = case model
|
814
812
|
when Class
|
@@ -817,7 +815,7 @@ module NewRelic
|
|
817
815
|
model
|
818
816
|
else
|
819
817
|
model.to_s
|
820
|
-
|
818
|
+
end
|
821
819
|
self.instrumentation_state[:datastore_override] = [method, model_name, product]
|
822
820
|
yield
|
823
821
|
ensure
|
@@ -895,9 +893,9 @@ module NewRelic
|
|
895
893
|
threadMBean = Java::JavaLangManagement::ManagementFactory.getThreadMXBean()
|
896
894
|
|
897
895
|
return nil unless threadMBean.isCurrentThreadCpuTimeSupported
|
898
|
-
java_utime = threadMBean.getCurrentThreadUserTime()
|
896
|
+
java_utime = threadMBean.getCurrentThreadUserTime() # ns
|
899
897
|
|
900
|
-
-1 == java_utime ? 0.0 : java_utime/1e9
|
898
|
+
-1 == java_utime ? 0.0 : java_utime / 1e9
|
901
899
|
rescue => e
|
902
900
|
::NewRelic::Agent.logger.log_once(:warn, :jruby_cpu_time, JRUBY_CPU_TIME_ERROR, e)
|
903
901
|
::NewRelic::Agent.logger.debug(JRUBY_CPU_TIME_ERROR, e)
|
@@ -16,23 +16,23 @@ module NewRelic
|
|
16
16
|
module TransactionErrorPrimitive
|
17
17
|
extend self
|
18
18
|
|
19
|
-
SAMPLE_TYPE
|
20
|
-
TYPE_KEY
|
21
|
-
ERROR_CLASS_KEY
|
22
|
-
ERROR_MESSAGE_KEY
|
23
|
-
ERROR_EXPECTED_KEY
|
24
|
-
TIMESTAMP_KEY
|
25
|
-
PORT_KEY
|
26
|
-
NAME_KEY
|
27
|
-
DURATION_KEY
|
28
|
-
SAMPLED_KEY
|
29
|
-
GUID_KEY
|
19
|
+
SAMPLE_TYPE = 'TransactionError'.freeze
|
20
|
+
TYPE_KEY = 'type'.freeze
|
21
|
+
ERROR_CLASS_KEY = 'error.class'.freeze
|
22
|
+
ERROR_MESSAGE_KEY = 'error.message'.freeze
|
23
|
+
ERROR_EXPECTED_KEY = 'error.expected'.freeze
|
24
|
+
TIMESTAMP_KEY = 'timestamp'.freeze
|
25
|
+
PORT_KEY = 'port'.freeze
|
26
|
+
NAME_KEY = 'transactionName'.freeze
|
27
|
+
DURATION_KEY = 'duration'.freeze
|
28
|
+
SAMPLED_KEY = 'sampled'.freeze
|
29
|
+
GUID_KEY = 'nr.transactionGuid'.freeze
|
30
30
|
REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'.freeze
|
31
|
-
SYNTHETICS_RESOURCE_ID_KEY
|
32
|
-
SYNTHETICS_JOB_ID_KEY
|
33
|
-
SYNTHETICS_MONITOR_ID_KEY
|
34
|
-
PRIORITY_KEY
|
35
|
-
SPAN_ID_KEY
|
31
|
+
SYNTHETICS_RESOURCE_ID_KEY = "nr.syntheticsResourceId".freeze
|
32
|
+
SYNTHETICS_JOB_ID_KEY = "nr.syntheticsJobId".freeze
|
33
|
+
SYNTHETICS_MONITOR_ID_KEY = "nr.syntheticsMonitorId".freeze
|
34
|
+
PRIORITY_KEY = "priority".freeze
|
35
|
+
SPAN_ID_KEY = "spanId".freeze
|
36
36
|
|
37
37
|
def create noticed_error, payload, span_id
|
38
38
|
[
|
@@ -3,22 +3,21 @@
|
|
3
3
|
# This file is distributed under New Relic's license terms.
|
4
4
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
5
5
|
|
6
|
-
require 'newrelic_rpm' unless defined?(
|
7
|
-
require 'new_relic/agent' unless defined?(
|
6
|
+
require 'newrelic_rpm' unless defined?(NewRelic)
|
7
|
+
require 'new_relic/agent' unless defined?(NewRelic::Agent)
|
8
8
|
require 'new_relic/agent/event_aggregator'
|
9
9
|
require 'new_relic/agent/priority_sampled_buffer'
|
10
10
|
|
11
11
|
module NewRelic
|
12
12
|
module Agent
|
13
13
|
class TransactionEventAggregator < EventAggregator
|
14
|
-
|
15
14
|
named :TransactionEventAggregator
|
16
|
-
capacity_key :'
|
17
|
-
enabled_key :'
|
15
|
+
capacity_key :'transaction_events.max_samples_stored'
|
16
|
+
enabled_key :'transaction_events.enabled'
|
18
17
|
buffer_class PrioritySampledBuffer
|
19
18
|
|
20
|
-
def record priority: nil, event:nil, &blk
|
21
|
-
unless
|
19
|
+
def record priority: nil, event: nil, &blk
|
20
|
+
unless event || priority && blk
|
22
21
|
raise ArgumentError, "Expected priority and block, or event"
|
23
22
|
end
|
24
23
|
|
@@ -37,7 +36,7 @@ module NewRelic
|
|
37
36
|
record_sampling_rate metadata
|
38
37
|
end
|
39
38
|
|
40
|
-
def record_sampling_rate(metadata) #THREAD_LOCAL_ACCESS
|
39
|
+
def record_sampling_rate(metadata) # THREAD_LOCAL_ACCESS
|
41
40
|
NewRelic::Agent.logger.debug("Sampled %d / %d (%.1f %%) requests this cycle, %d / %d (%.1f %%) since startup" % [
|
42
41
|
metadata[:captured],
|
43
42
|
metadata[:seen],
|