newrelic_rpm 6.7.0.359 → 6.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/CHANGELOG.md +493 -4
- data/CONTRIBUTING.md +106 -19
- data/Gemfile +6 -2
- data/Guardfile +18 -1
- data/LICENSE +208 -38
- data/README.md +81 -85
- data/ROADMAP.md +24 -0
- data/Rakefile +2 -0
- data/THIRD_PARTY_NOTICES.md +213 -0
- data/bin/nrdebug +1 -1
- data/init.rb +1 -1
- data/install.rb +1 -1
- data/lib/new_relic/agent/adaptive_sampler.rb +1 -1
- data/lib/new_relic/agent/agent.rb +63 -44
- data/lib/new_relic/agent/agent_logger.rb +5 -1
- data/lib/new_relic/agent/attribute_filter.rb +8 -8
- data/lib/new_relic/agent/attribute_processing.rb +1 -1
- data/lib/new_relic/agent/attributes.rb +152 -0
- data/lib/new_relic/agent/audit_logger.rb +11 -1
- data/lib/new_relic/agent/autostart.rb +20 -15
- data/lib/new_relic/agent/chained_call.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command.rb +1 -1
- data/lib/new_relic/agent/commands/agent_command_router.rb +1 -1
- data/lib/new_relic/agent/commands/thread_profiler_session.rb +1 -1
- data/lib/new_relic/agent/configuration/default_source.rb +138 -17
- data/lib/new_relic/agent/configuration/dotted_hash.rb +1 -1
- data/lib/new_relic/agent/configuration/environment_source.rb +1 -1
- data/lib/new_relic/agent/configuration/event_harvest_config.rb +1 -1
- data/lib/new_relic/agent/configuration/high_security_source.rb +1 -1
- data/lib/new_relic/agent/configuration/manager.rb +1 -1
- data/lib/new_relic/agent/configuration/manual_source.rb +1 -1
- data/lib/new_relic/agent/configuration/mask_defaults.rb +1 -1
- data/lib/new_relic/agent/configuration/security_policy_source.rb +1 -1
- data/lib/new_relic/agent/configuration/server_source.rb +2 -2
- data/lib/new_relic/agent/configuration/yaml_source.rb +12 -7
- data/lib/new_relic/agent/configuration.rb +1 -1
- data/lib/new_relic/agent/connect/request_builder.rb +4 -12
- data/lib/new_relic/agent/connect/response_handler.rb +1 -1
- data/lib/new_relic/agent/custom_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/database/explain_plan_helpers.rb +1 -1
- data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -2
- data/lib/new_relic/agent/database/obfuscator.rb +1 -1
- data/lib/new_relic/agent/database/postgres_explain_obfuscator.rb +1 -1
- data/lib/new_relic/agent/database.rb +2 -3
- data/lib/new_relic/agent/database_adapter.rb +33 -0
- data/lib/new_relic/agent/datastores/metric_helper.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/event_formatter.rb +3 -3
- data/lib/new_relic/agent/datastores/mongo/metric_translator.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo/obfuscator.rb +9 -9
- data/lib/new_relic/agent/datastores/mongo/statement_formatter.rb +1 -1
- data/lib/new_relic/agent/datastores/mongo.rb +2 -2
- data/lib/new_relic/agent/datastores/redis.rb +1 -1
- data/lib/new_relic/agent/datastores.rb +1 -1
- data/lib/new_relic/agent/deprecator.rb +1 -1
- data/lib/new_relic/agent/{cross_app_payload.rb → distributed_tracing/cross_app_payload.rb} +3 -2
- data/lib/new_relic/agent/{cross_app_tracing.rb → distributed_tracing/cross_app_tracing.rb} +61 -46
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_attributes.rb +84 -0
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_metrics.rb +75 -0
- data/lib/new_relic/agent/{distributed_trace_payload.rb → distributed_tracing/distributed_trace_payload.rb} +25 -102
- data/lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb +39 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context.rb +246 -0
- data/lib/new_relic/agent/distributed_tracing/trace_context_payload.rb +126 -0
- data/lib/new_relic/agent/distributed_tracing.rb +156 -7
- data/lib/new_relic/agent/encoding_normalizer.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +34 -17
- data/lib/new_relic/agent/error_event_aggregator.rb +8 -6
- data/lib/new_relic/agent/error_trace_aggregator.rb +1 -1
- data/lib/new_relic/agent/event_aggregator.rb +1 -1
- data/lib/new_relic/agent/event_buffer.rb +1 -1
- data/lib/new_relic/agent/event_listener.rb +1 -1
- data/lib/new_relic/agent/event_loop.rb +1 -1
- data/lib/new_relic/agent/external.rb +8 -8
- data/lib/new_relic/agent/guid_generator.rb +28 -0
- data/lib/new_relic/agent/harvester.rb +1 -1
- data/lib/new_relic/agent/heap.rb +1 -1
- data/lib/new_relic/agent/hostname.rb +8 -2
- data/lib/new_relic/agent/http_clients/abstract.rb +82 -0
- data/lib/new_relic/agent/http_clients/curb_wrappers.rb +25 -20
- data/lib/new_relic/agent/http_clients/excon_wrappers.rb +29 -14
- data/lib/new_relic/agent/http_clients/http_rb_wrappers.rb +18 -22
- data/lib/new_relic/agent/http_clients/httpclient_wrappers.rb +11 -12
- data/lib/new_relic/agent/http_clients/net_http_wrappers.rb +17 -5
- data/lib/new_relic/agent/http_clients/typhoeus_wrappers.rb +5 -7
- data/lib/new_relic/agent/http_clients/uri_util.rb +12 -11
- data/lib/new_relic/agent/instrumentation/action_cable_subscriber.rb +6 -8
- data/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb +5 -1
- data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +12 -4
- data/lib/new_relic/agent/instrumentation/active_job.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +85 -38
- data/lib/new_relic/agent/instrumentation/active_record_helper.rb +17 -6
- data/lib/new_relic/agent/instrumentation/active_record_notifications.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record_prepend.rb +35 -11
- data/lib/new_relic/agent/instrumentation/active_record_subscriber.rb +8 -3
- data/lib/new_relic/agent/instrumentation/active_storage.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_storage_subscriber.rb +9 -5
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +10 -9
- data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
- data/lib/new_relic/agent/instrumentation/bunny.rb +48 -29
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/curb.rb +66 -19
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +4 -2
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +3 -1
- data/lib/new_relic/agent/instrumentation/excon/connection.rb +7 -4
- data/lib/new_relic/agent/instrumentation/excon/middleware.rb +3 -2
- data/lib/new_relic/agent/instrumentation/excon.rb +2 -2
- data/lib/new_relic/agent/instrumentation/grape.rb +6 -11
- data/lib/new_relic/agent/instrumentation/http.rb +7 -4
- data/lib/new_relic/agent/instrumentation/httpclient.rb +6 -4
- data/lib/new_relic/agent/instrumentation/ignore_actions.rb +1 -1
- data/lib/new_relic/agent/instrumentation/memcache/dalli.rb +7 -3
- data/lib/new_relic/agent/instrumentation/memcache.rb +4 -2
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_proxy.rb +1 -1
- data/lib/new_relic/agent/instrumentation/middleware_tracing.rb +9 -7
- data/lib/new_relic/agent/instrumentation/mongo.rb +10 -4
- data/lib/new_relic/agent/instrumentation/mongodb_command_subscriber.rb +36 -3
- data/lib/new_relic/agent/instrumentation/net.rb +48 -28
- data/lib/new_relic/agent/instrumentation/net_prepend.rb +40 -0
- data/lib/new_relic/agent/instrumentation/notifications_subscriber.rb +26 -2
- data/lib/new_relic/agent/instrumentation/padrino.rb +3 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/queue_time.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rack.rb +3 -1
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_middleware.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_cable.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_controller.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails_notifications/action_view.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rainbows_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rake.rb +2 -1
- data/lib/new_relic/agent/instrumentation/redis.rb +12 -6
- data/lib/new_relic/agent/instrumentation/resque.rb +4 -1
- data/lib/new_relic/agent/instrumentation/sequel.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sequel_helper.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sidekiq.rb +48 -24
- data/lib/new_relic/agent/instrumentation/sinatra/ignorer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra/transaction_namer.rb +1 -1
- data/lib/new_relic/agent/instrumentation/sinatra.rb +1 -2
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/typhoeus.rb +24 -7
- data/lib/new_relic/agent/instrumentation.rb +1 -1
- data/lib/new_relic/agent/internal_agent_error.rb +1 -1
- data/lib/new_relic/agent/javascript_instrumentor.rb +1 -1
- data/lib/new_relic/agent/log_once.rb +1 -1
- data/lib/new_relic/agent/logging.rb +19 -5
- data/lib/new_relic/agent/memory_logger.rb +1 -1
- data/lib/new_relic/agent/messaging.rb +6 -74
- data/lib/new_relic/agent/method_tracer.rb +10 -8
- data/lib/new_relic/agent/method_tracer_helpers.rb +3 -3
- data/lib/new_relic/agent/monitors/cross_app_monitor.rb +110 -0
- data/lib/new_relic/agent/monitors/distributed_tracing_monitor.rb +27 -0
- data/lib/new_relic/agent/{inbound_request_monitor.rb → monitors/inbound_request_monitor.rb} +2 -2
- data/lib/new_relic/agent/{synthetics_monitor.rb → monitors/synthetics_monitor.rb} +3 -5
- data/lib/new_relic/agent/monitors.rb +27 -0
- data/lib/new_relic/agent/new_relic_service/encoders.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/json_marshaller.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +1 -1
- data/lib/new_relic/agent/new_relic_service/security_policy_settings.rb +1 -1
- data/lib/new_relic/agent/new_relic_service.rb +34 -10
- data/lib/new_relic/agent/noticible_error.rb +22 -0
- data/lib/new_relic/agent/null_logger.rb +1 -1
- data/lib/new_relic/agent/obfuscator.rb +1 -1
- data/lib/new_relic/agent/parameter_filtering.rb +1 -1
- data/lib/new_relic/agent/payload_metric_mapping.rb +1 -1
- data/lib/new_relic/agent/pipe_channel_manager.rb +1 -1
- data/lib/new_relic/agent/pipe_service.rb +1 -1
- data/lib/new_relic/agent/prepend_supportability.rb +1 -1
- data/lib/new_relic/agent/priority_sampled_buffer.rb +8 -5
- data/lib/new_relic/agent/range_extensions.rb +1 -1
- data/lib/new_relic/agent/rules_engine/replacement_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine/segment_terms_rule.rb +1 -1
- data/lib/new_relic/agent/rules_engine.rb +1 -1
- data/lib/new_relic/agent/sampler.rb +1 -1
- data/lib/new_relic/agent/sampler_collection.rb +1 -1
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/memory_sampler.rb +2 -2
- data/lib/new_relic/agent/samplers/object_sampler.rb +1 -1
- data/lib/new_relic/agent/samplers/vm_sampler.rb +1 -1
- data/lib/new_relic/agent/span_event_aggregator.rb +2 -1
- data/lib/new_relic/agent/span_event_primitive.rb +108 -54
- data/lib/new_relic/agent/sql_sampler.rb +6 -6
- data/lib/new_relic/agent/stats.rb +1 -1
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +2 -2
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +1 -1
- data/lib/new_relic/agent/stats_engine.rb +1 -1
- data/lib/new_relic/agent/supported_versions.rb +3 -3
- data/lib/new_relic/agent/synthetics_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/system_info.rb +13 -4
- data/lib/new_relic/agent/threading/agent_thread.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_node.rb +1 -1
- data/lib/new_relic/agent/threading/backtrace_service.rb +1 -1
- data/lib/new_relic/agent/threading/thread_profile.rb +1 -1
- data/lib/new_relic/agent/timestamp_sampled_buffer.rb +1 -1
- data/lib/new_relic/agent/tracer.rb +34 -19
- data/lib/new_relic/agent/transaction/abstract_segment.rb +32 -5
- data/lib/new_relic/agent/transaction/datastore_segment.rb +1 -1
- data/lib/new_relic/agent/transaction/distributed_tracer.rb +177 -0
- data/lib/new_relic/agent/transaction/distributed_tracing.rb +58 -147
- data/lib/new_relic/agent/transaction/external_request_segment.rb +32 -39
- data/lib/new_relic/agent/transaction/message_broker_segment.rb +5 -12
- data/lib/new_relic/agent/transaction/request_attributes.rb +1 -1
- data/lib/new_relic/agent/transaction/segment.rb +28 -2
- data/lib/new_relic/agent/transaction/slowest_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/synthetics_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction/trace.rb +3 -5
- data/lib/new_relic/agent/transaction/trace_builder.rb +1 -1
- data/lib/new_relic/agent/transaction/trace_context.rb +168 -0
- data/lib/new_relic/agent/transaction/trace_node.rb +11 -9
- data/lib/new_relic/agent/transaction/tracing.rb +1 -1
- data/lib/new_relic/agent/transaction/transaction_sample_buffer.rb +1 -1
- data/lib/new_relic/agent/transaction.rb +104 -82
- data/lib/new_relic/agent/transaction_error_primitive.rb +11 -16
- data/lib/new_relic/agent/transaction_event_aggregator.rb +1 -1
- data/lib/new_relic/agent/transaction_event_primitive.rb +29 -40
- data/lib/new_relic/agent/transaction_event_recorder.rb +1 -1
- data/lib/new_relic/agent/transaction_metrics.rb +1 -1
- data/lib/new_relic/agent/transaction_sampler.rb +1 -1
- data/lib/new_relic/agent/transaction_time_aggregator.rb +1 -1
- data/lib/new_relic/agent/utilization/aws.rb +1 -1
- data/lib/new_relic/agent/utilization/azure.rb +1 -1
- data/lib/new_relic/agent/utilization/gcp.rb +1 -1
- data/lib/new_relic/agent/utilization/pcf.rb +1 -1
- data/lib/new_relic/agent/utilization/vendor.rb +1 -1
- data/lib/new_relic/agent/utilization_data.rb +1 -1
- data/lib/new_relic/agent/vm/jruby_vm.rb +1 -1
- data/lib/new_relic/agent/vm/monotonic_gc_profiler.rb +1 -1
- data/lib/new_relic/agent/vm/mri_vm.rb +7 -5
- data/lib/new_relic/agent/vm/snapshot.rb +1 -1
- data/lib/new_relic/agent/vm.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +1 -1
- data/lib/new_relic/agent.rb +49 -8
- data/lib/new_relic/cli/command.rb +1 -1
- data/lib/new_relic/cli/commands/deployments.rb +1 -2
- data/lib/new_relic/cli/commands/install.rb +4 -3
- data/lib/new_relic/coerce.rb +32 -7
- data/lib/new_relic/collection_helper.rb +1 -1
- data/lib/new_relic/constants.rb +42 -0
- data/lib/new_relic/control/class_methods.rb +1 -1
- data/lib/new_relic/control/frameworks/external.rb +1 -1
- data/lib/new_relic/control/frameworks/merb.rb +1 -1
- data/lib/new_relic/control/frameworks/rails.rb +1 -1
- data/lib/new_relic/control/frameworks/rails3.rb +1 -1
- data/lib/new_relic/control/frameworks/rails4.rb +1 -1
- data/lib/new_relic/control/frameworks/rails_notifications.rb +1 -1
- data/lib/new_relic/control/frameworks/ruby.rb +1 -1
- data/lib/new_relic/control/frameworks/sinatra.rb +1 -1
- data/lib/new_relic/control/frameworks.rb +1 -1
- data/lib/new_relic/control/instance_methods.rb +11 -2
- data/lib/new_relic/control/instrumentation.rb +1 -1
- data/lib/new_relic/control/server_methods.rb +1 -1
- data/lib/new_relic/control.rb +1 -1
- data/lib/new_relic/delayed_job_injection.rb +1 -1
- data/lib/new_relic/dependency_detection.rb +9 -5
- data/lib/new_relic/environment_report.rb +2 -4
- data/lib/new_relic/helper.rb +1 -1
- data/lib/new_relic/language_support.rb +1 -1
- data/lib/new_relic/latest_changes.rb +2 -2
- data/lib/new_relic/local_environment.rb +1 -1
- data/lib/new_relic/metric_data.rb +1 -1
- data/lib/new_relic/metric_spec.rb +1 -1
- data/lib/new_relic/noticed_error.rb +39 -18
- data/lib/new_relic/rack/agent_hooks.rb +1 -1
- data/lib/new_relic/rack/agent_middleware.rb +1 -1
- data/lib/new_relic/rack/browser_monitoring.rb +6 -1
- data/lib/new_relic/rack.rb +1 -1
- data/lib/new_relic/recipes/capistrano3.rb +1 -1
- data/lib/new_relic/recipes/capistrano_legacy.rb +1 -1
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/supportability_helper.rb +17 -1
- data/lib/new_relic/version.rb +2 -2
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/sequel/extensions/newrelic_instrumentation.rb +1 -1
- data/lib/sequel/plugins/newrelic_instrumentation.rb +1 -1
- data/lib/tasks/all.rb +1 -1
- data/lib/tasks/multiverse.rb +35 -1
- data/lib/tasks/newrelic.rb +1 -1
- data/lib/tasks/tests.rake +6 -1
- data/newrelic_rpm.gemspec +18 -13
- data/recipes/newrelic.rb +1 -1
- data/test/agent_helper.rb +339 -72
- metadata +104 -41
- data/.travis.yml +0 -175
- data/lib/new_relic/agent/cross_app_monitor.rb +0 -110
- data/lib/new_relic/agent/distributed_trace_monitor.rb +0 -40
- data/lib/new_relic/agent/http_clients/abstract_request.rb +0 -31
- data/lib/new_relic/agent/transaction/attributes.rb +0 -154
- data/lib/new_relic/build.rb +0 -2
- data/lib/new_relic/metrics.rb +0 -13
- data/lib/tasks/versions.html.erb +0 -28
- data/lib/tasks/versions.postface.html +0 -8
- data/lib/tasks/versions.preface.html +0 -9
- data/lib/tasks/versions.rake +0 -65
- data/lib/tasks/versions.txt.erb +0 -14
@@ -1,17 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
require 'new_relic/agent/instrumentation/queue_time'
|
6
7
|
require 'new_relic/agent/transaction_metrics'
|
7
8
|
require 'new_relic/agent/method_tracer_helpers'
|
8
|
-
require 'new_relic/agent/
|
9
|
+
require 'new_relic/agent/attributes'
|
9
10
|
require 'new_relic/agent/transaction/request_attributes'
|
10
11
|
require 'new_relic/agent/transaction/tracing'
|
11
|
-
require 'new_relic/agent/transaction/
|
12
|
-
require 'new_relic/agent/cross_app_tracing'
|
12
|
+
require 'new_relic/agent/transaction/distributed_tracer'
|
13
13
|
require 'new_relic/agent/transaction_time_aggregator'
|
14
14
|
require 'new_relic/agent/deprecator'
|
15
|
+
require 'new_relic/agent/guid_generator'
|
15
16
|
|
16
17
|
module NewRelic
|
17
18
|
module Agent
|
@@ -21,26 +22,38 @@ module NewRelic
|
|
21
22
|
# @api public
|
22
23
|
class Transaction
|
23
24
|
include Tracing
|
24
|
-
include DistributedTracing
|
25
|
-
include CrossAppTracing
|
26
25
|
|
27
26
|
# for nested transactions
|
28
|
-
|
29
|
-
CONTROLLER_PREFIX =
|
30
|
-
MIDDLEWARE_PREFIX =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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/"
|
39
38
|
|
40
39
|
WEB_TRANSACTION_CATEGORIES = [:web, :controller, :uri, :rack, :sinatra, :grape, :middleware, :action_cable].freeze
|
41
40
|
TRANSACTION_NAMING_SOURCES = [:child, :api].freeze
|
42
41
|
|
43
|
-
MIDDLEWARE_SUMMARY_METRICS = [
|
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
|
+
APDEX_OTHER_TXN_METRIC_PREFIX = "ApdexOther/Transaction/"
|
55
|
+
|
56
|
+
JRUBY_CPU_TIME_ERROR = "Error calculating JRuby CPU Time"
|
44
57
|
|
45
58
|
# reference to the transaction state managing this transaction
|
46
59
|
attr_accessor :state
|
@@ -59,7 +72,8 @@ module NewRelic
|
|
59
72
|
:process_cpu_start,
|
60
73
|
:http_response_code,
|
61
74
|
:response_content_length,
|
62
|
-
:response_content_type
|
75
|
+
:response_content_type,
|
76
|
+
:parent_span_id
|
63
77
|
|
64
78
|
attr_reader :guid,
|
65
79
|
:metrics,
|
@@ -137,23 +151,22 @@ module NewRelic
|
|
137
151
|
|
138
152
|
def self.nested_transaction_name(name)
|
139
153
|
if name.start_with?(CONTROLLER_PREFIX) || name.start_with?(OTHER_TRANSACTION_PREFIX)
|
140
|
-
"#{
|
154
|
+
"#{NESTED_TRANSACTION_PREFIX}#{name}"
|
141
155
|
else
|
142
156
|
name
|
143
157
|
end
|
144
158
|
end
|
145
159
|
|
146
|
-
#
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
160
|
+
# discards the currently saved transaction information
|
161
|
+
def self.abort_transaction!
|
162
|
+
if txn = Tracer.current_transaction
|
163
|
+
txn.abort_transaction!
|
164
|
+
end
|
151
165
|
end
|
152
166
|
|
153
167
|
# See NewRelic::Agent.notice_error for options and commentary
|
154
|
-
def self.notice_error(e, options={})
|
155
|
-
txn = Tracer.current_transaction
|
156
|
-
if txn
|
168
|
+
def self.notice_error(e, options={})
|
169
|
+
if txn = Tracer.current_transaction
|
157
170
|
txn.notice_error(e, options)
|
158
171
|
elsif NewRelic::Agent.instance
|
159
172
|
NewRelic::Agent.instance.error_collector.notice_error(e, options)
|
@@ -195,6 +208,7 @@ module NewRelic
|
|
195
208
|
|
196
209
|
def add_agent_attribute(key, value, default_destinations)
|
197
210
|
@attributes.add_agent_attribute(key, value, default_destinations)
|
211
|
+
current_segment.add_agent_attribute(key, value) if current_segment
|
198
212
|
end
|
199
213
|
|
200
214
|
def self.merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
@@ -207,6 +221,7 @@ module NewRelic
|
|
207
221
|
|
208
222
|
def merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
209
223
|
@attributes.merge_untrusted_agent_attributes(attributes, prefix, default_destinations)
|
224
|
+
current_segment.merge_untrusted_agent_attributes(attributes, prefix, default_destinations) if current_segment
|
210
225
|
end
|
211
226
|
|
212
227
|
@@java_classes_loaded = false
|
@@ -242,7 +257,7 @@ module NewRelic
|
|
242
257
|
|
243
258
|
@exceptions = {}
|
244
259
|
@metrics = TransactionMetrics.new
|
245
|
-
@guid = generate_guid
|
260
|
+
@guid = NewRelic::Agent::GuidGenerator.generate_guid
|
246
261
|
|
247
262
|
@ignore_this_transaction = false
|
248
263
|
@ignore_apdex = options.fetch(:ignore_apdex, false)
|
@@ -265,6 +280,10 @@ module NewRelic
|
|
265
280
|
end
|
266
281
|
end
|
267
282
|
|
283
|
+
def distributed_tracer
|
284
|
+
@distributed_tracer ||= DistributedTracer.new(self)
|
285
|
+
end
|
286
|
+
|
268
287
|
def sampled?
|
269
288
|
return unless Agent.config[:'distributed_tracing.enabled']
|
270
289
|
if @sampled.nil?
|
@@ -273,12 +292,16 @@ module NewRelic
|
|
273
292
|
@sampled
|
274
293
|
end
|
275
294
|
|
295
|
+
def trace_id
|
296
|
+
@trace_id ||= NewRelic::Agent::GuidGenerator.generate_guid 32
|
297
|
+
end
|
298
|
+
|
299
|
+
def trace_id=(value)
|
300
|
+
@trace_id = value
|
301
|
+
end
|
302
|
+
|
276
303
|
def priority
|
277
|
-
|
278
|
-
@priority = rand.round(6)
|
279
|
-
@priority += 1 if sampled?
|
280
|
-
end
|
281
|
-
@priority
|
304
|
+
@priority ||= (sampled? ? 1.0 + rand : rand).round(NewRelic::PRIORITY_PRECISION)
|
282
305
|
end
|
283
306
|
|
284
307
|
def referer
|
@@ -349,8 +372,10 @@ module NewRelic
|
|
349
372
|
end
|
350
373
|
|
351
374
|
def best_name
|
352
|
-
@frozen_name
|
353
|
-
|
375
|
+
@frozen_name ||
|
376
|
+
@overridden_name ||
|
377
|
+
@default_name ||
|
378
|
+
NewRelic::Agent::UNKNOWN_METRIC
|
354
379
|
end
|
355
380
|
|
356
381
|
# For common interface with Trace
|
@@ -398,6 +423,10 @@ module NewRelic
|
|
398
423
|
ignore! if user_defined_rules_ignore?
|
399
424
|
|
400
425
|
create_initial_segment
|
426
|
+
Segment.merge_untrusted_agent_attributes \
|
427
|
+
@filtered_params,
|
428
|
+
:'request.parameters',
|
429
|
+
AttributeFilter::DST_SPAN_EVENTS
|
401
430
|
end
|
402
431
|
|
403
432
|
def initial_segment
|
@@ -437,9 +466,9 @@ module NewRelic
|
|
437
466
|
|
438
467
|
nest_initial_segment if nesting_max_depth == 1
|
439
468
|
nested_name = self.class.nested_transaction_name options[:transaction_name]
|
440
|
-
|
469
|
+
segment = create_segment nested_name
|
441
470
|
set_default_transaction_name(options[:transaction_name], category)
|
442
|
-
|
471
|
+
segment
|
443
472
|
end
|
444
473
|
|
445
474
|
def nest_initial_segment
|
@@ -453,9 +482,6 @@ module NewRelic
|
|
453
482
|
@ignore_trace = true
|
454
483
|
end
|
455
484
|
|
456
|
-
WEB_SUMMARY_METRIC = 'HttpDispatcher'.freeze
|
457
|
-
OTHER_SUMMARY_METRIC = 'OtherTransaction/all'.freeze
|
458
|
-
|
459
485
|
def summary_metrics
|
460
486
|
if @frozen_name.start_with?(CONTROLLER_PREFIX)
|
461
487
|
[WEB_SUMMARY_METRIC]
|
@@ -487,6 +513,9 @@ module NewRelic
|
|
487
513
|
initial_segment.name = @frozen_name
|
488
514
|
end
|
489
515
|
|
516
|
+
initial_segment.transaction_name = @frozen_name
|
517
|
+
assign_segment_dt_attributes
|
518
|
+
assign_agent_attributes
|
490
519
|
initial_segment.finish
|
491
520
|
|
492
521
|
NewRelic::Agent::TransactionTimeAggregator.transaction_stop(@end_time, @starting_thread_id)
|
@@ -510,8 +539,6 @@ module NewRelic
|
|
510
539
|
|
511
540
|
def commit!(outermost_node_name)
|
512
541
|
generate_payload
|
513
|
-
|
514
|
-
assign_agent_attributes
|
515
542
|
assign_intrinsics
|
516
543
|
|
517
544
|
finalize_segments
|
@@ -523,8 +550,7 @@ module NewRelic
|
|
523
550
|
record_total_time_metrics
|
524
551
|
record_apdex unless ignore_apdex?
|
525
552
|
record_queue_time
|
526
|
-
|
527
|
-
record_distributed_tracing_metrics
|
553
|
+
distributed_tracer.record_metrics
|
528
554
|
|
529
555
|
record_exceptions
|
530
556
|
record_transaction_event
|
@@ -532,6 +558,13 @@ module NewRelic
|
|
532
558
|
send_transaction_finished_event
|
533
559
|
end
|
534
560
|
|
561
|
+
def assign_segment_dt_attributes
|
562
|
+
dt_payload = distributed_tracer.trace_state_payload || distributed_tracer.distributed_trace_payload
|
563
|
+
parent_attributes = {}
|
564
|
+
DistributedTraceAttributes.copy_parent_attributes self, dt_payload, parent_attributes
|
565
|
+
parent_attributes.each { |k, v| initial_segment.add_agent_attribute k, v }
|
566
|
+
end
|
567
|
+
|
535
568
|
def assign_agent_attributes
|
536
569
|
default_destinations = AttributeFilter::DST_TRANSACTION_TRACER |
|
537
570
|
AttributeFilter::DST_TRANSACTION_EVENTS |
|
@@ -539,6 +572,9 @@ module NewRelic
|
|
539
572
|
|
540
573
|
if http_response_code
|
541
574
|
add_agent_attribute(:httpResponseCode, http_response_code.to_s, default_destinations)
|
575
|
+
# Sending status code as an int with http.statusCode key is correct
|
576
|
+
# The above attribute is deprecated and should be removed in agent version 7.0.0
|
577
|
+
add_agent_attribute(:'http.statusCode', http_response_code, default_destinations)
|
542
578
|
end
|
543
579
|
|
544
580
|
if response_content_length
|
@@ -576,11 +612,7 @@ module NewRelic
|
|
576
612
|
attributes.add_intrinsic_attribute(:synthetics_monitor_id, synthetics_monitor_id)
|
577
613
|
end
|
578
614
|
|
579
|
-
|
580
|
-
assign_distributed_trace_intrinsics
|
581
|
-
elsif is_cross_app?
|
582
|
-
assign_cross_app_intrinsics
|
583
|
-
end
|
615
|
+
distributed_tracer.assign_intrinsics
|
584
616
|
end
|
585
617
|
|
586
618
|
def calculate_gc_time
|
@@ -588,6 +620,16 @@ module NewRelic
|
|
588
620
|
NewRelic::Agent::StatsEngine::GCProfiler.record_delta(gc_start_snapshot, gc_stop_snapshot)
|
589
621
|
end
|
590
622
|
|
623
|
+
# This method returns transport_duration in seconds. Transport duration
|
624
|
+
# is stored in milliseconds on the payload, but it's needed in seconds
|
625
|
+
# for metrics and intrinsics.
|
626
|
+
def calculate_transport_duration distributed_trace_payload
|
627
|
+
return unless distributed_trace_payload
|
628
|
+
|
629
|
+
duration = (start_time.to_f * 1000 - distributed_trace_payload.timestamp) / 1000
|
630
|
+
duration < 0 ? 0 : duration
|
631
|
+
end
|
632
|
+
|
591
633
|
# The summary metrics recorded by this method all end up with a duration
|
592
634
|
# equal to the transaction itself, and an exclusive time of zero.
|
593
635
|
def record_summary_metrics(outermost_node_name)
|
@@ -614,14 +656,13 @@ module NewRelic
|
|
614
656
|
:priority => priority
|
615
657
|
}
|
616
658
|
|
617
|
-
|
618
|
-
append_distributed_trace_info(@payload)
|
659
|
+
distributed_tracer.append_payload(@payload)
|
619
660
|
append_apdex_perf_zone(@payload)
|
620
661
|
append_synthetics_to(@payload)
|
621
662
|
end
|
622
663
|
|
623
664
|
def include_guid?
|
624
|
-
is_cross_app? || is_synthetics_request?
|
665
|
+
distributed_tracer.is_cross_app? || is_synthetics_request?
|
625
666
|
end
|
626
667
|
|
627
668
|
def is_synthetics_request?
|
@@ -653,10 +694,6 @@ module NewRelic
|
|
653
694
|
info[4]
|
654
695
|
end
|
655
696
|
|
656
|
-
APDEX_S = 'S'.freeze
|
657
|
-
APDEX_T = 'T'.freeze
|
658
|
-
APDEX_F = 'F'.freeze
|
659
|
-
|
660
697
|
def append_apdex_perf_zone(payload)
|
661
698
|
if recording_web_transaction?
|
662
699
|
bucket = apdex_bucket(duration, apdex_t)
|
@@ -695,13 +732,21 @@ module NewRelic
|
|
695
732
|
options[:metric] = best_name
|
696
733
|
options[:attributes] = @attributes
|
697
734
|
|
698
|
-
|
735
|
+
span_id = options.delete :span_id
|
736
|
+
error_recorded = !!agent.error_collector.notice_error(exception, options, span_id) || error_recorded
|
699
737
|
end
|
700
738
|
payload[:error] = error_recorded if payload
|
701
739
|
end
|
702
740
|
|
703
741
|
# Do not call this. Invoke the class method instead.
|
704
742
|
def notice_error(error, options={}) # :nodoc:
|
743
|
+
|
744
|
+
# Only the last error is kept
|
745
|
+
if @current_segment
|
746
|
+
@current_segment.notice_error error, expected: options[:expected]
|
747
|
+
options[:span_id] = @current_segment.guid
|
748
|
+
end
|
749
|
+
|
705
750
|
if @exceptions[error]
|
706
751
|
@exceptions[error].merge! options
|
707
752
|
else
|
@@ -713,8 +758,6 @@ module NewRelic
|
|
713
758
|
agent.transaction_event_recorder.record payload
|
714
759
|
end
|
715
760
|
|
716
|
-
QUEUE_TIME_METRIC = 'WebFrontend/QueueTime'.freeze
|
717
|
-
|
718
761
|
def queue_time
|
719
762
|
@apdex_start ? @start_time - @apdex_start : 0
|
720
763
|
end
|
@@ -730,17 +773,9 @@ module NewRelic
|
|
730
773
|
end
|
731
774
|
end
|
732
775
|
|
733
|
-
APDEX_ALL_METRIC = 'ApdexAll'.freeze
|
734
|
-
|
735
|
-
APDEX_METRIC = 'Apdex'.freeze
|
736
|
-
APDEX_OTHER_METRIC = 'ApdexOther'.freeze
|
737
|
-
|
738
|
-
APDEX_TXN_METRIC_PREFIX = 'Apdex/'.freeze
|
739
|
-
APDEX_OTHER_TXN_METRIC_PREFIX = 'ApdexOther/Transaction/'.freeze
|
740
|
-
|
741
776
|
def had_error_affecting_apdex?
|
742
777
|
@exceptions.each do |exception, options|
|
743
|
-
ignored
|
778
|
+
ignored = NewRelic::Agent.instance.error_collector.error_is_ignored?(exception)
|
744
779
|
expected = options[:expected]
|
745
780
|
|
746
781
|
return true unless ignored || expected
|
@@ -879,7 +914,6 @@ module NewRelic
|
|
879
914
|
p.stime + p.utime
|
880
915
|
end
|
881
916
|
|
882
|
-
JRUBY_CPU_TIME_ERROR = "Error calculating JRuby CPU Time".freeze
|
883
917
|
def jruby_cpu_time
|
884
918
|
return nil unless @@java_classes_loaded
|
885
919
|
threadMBean = Java::JavaLangManagement::ManagementFactory.getThreadMXBean()
|
@@ -905,18 +939,6 @@ module NewRelic
|
|
905
939
|
def sql_sampler
|
906
940
|
agent.sql_sampler
|
907
941
|
end
|
908
|
-
|
909
|
-
HEX_DIGITS = (0..15).map{|i| i.to_s(16)}
|
910
|
-
GUID_LENGTH = 16
|
911
|
-
|
912
|
-
# generate a random 64 bit uuid
|
913
|
-
def generate_guid
|
914
|
-
guid = ''
|
915
|
-
GUID_LENGTH.times do |a|
|
916
|
-
guid << HEX_DIGITS[rand(16)]
|
917
|
-
end
|
918
|
-
guid
|
919
|
-
end
|
920
942
|
end
|
921
943
|
end
|
922
944
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
# This module was introduced and largely extracted from the transaction event aggregator
|
6
6
|
# when the synthetics container was extracted from it. Its purpose is to create the data
|
@@ -8,7 +8,8 @@
|
|
8
8
|
# the transaction event aggregator and the synthetics container.
|
9
9
|
|
10
10
|
require 'new_relic/agent/payload_metric_mapping'
|
11
|
-
require 'new_relic/agent/distributed_trace_payload'
|
11
|
+
require 'new_relic/agent/distributed_tracing/distributed_trace_payload'
|
12
|
+
require 'new_relic/agent/distributed_tracing/distributed_trace_attributes'
|
12
13
|
|
13
14
|
module NewRelic
|
14
15
|
module Agent
|
@@ -31,16 +32,17 @@ module NewRelic
|
|
31
32
|
SYNTHETICS_JOB_ID_KEY = "nr.syntheticsJobId".freeze
|
32
33
|
SYNTHETICS_MONITOR_ID_KEY = "nr.syntheticsMonitorId".freeze
|
33
34
|
PRIORITY_KEY = "priority".freeze
|
35
|
+
SPAN_ID_KEY = "spanId".freeze
|
34
36
|
|
35
|
-
def create noticed_error, payload
|
37
|
+
def create noticed_error, payload, span_id
|
36
38
|
[
|
37
|
-
intrinsic_attributes_for(noticed_error, payload),
|
39
|
+
intrinsic_attributes_for(noticed_error, payload, span_id),
|
38
40
|
noticed_error.custom_attributes,
|
39
41
|
noticed_error.agent_attributes
|
40
42
|
]
|
41
43
|
end
|
42
44
|
|
43
|
-
def intrinsic_attributes_for noticed_error, payload
|
45
|
+
def intrinsic_attributes_for noticed_error, payload, span_id
|
44
46
|
attrs = {
|
45
47
|
TYPE_KEY => SAMPLE_TYPE,
|
46
48
|
ERROR_CLASS_KEY => noticed_error.exception_class_name,
|
@@ -49,16 +51,17 @@ module NewRelic
|
|
49
51
|
TIMESTAMP_KEY => noticed_error.timestamp.to_f
|
50
52
|
}
|
51
53
|
|
54
|
+
attrs[SPAN_ID_KEY] = span_id if span_id
|
52
55
|
attrs[PORT_KEY] = noticed_error.request_port if noticed_error.request_port
|
53
56
|
|
54
57
|
if payload
|
55
58
|
attrs[NAME_KEY] = payload[:name]
|
56
59
|
attrs[DURATION_KEY] = payload[:duration]
|
57
|
-
attrs[SAMPLED_KEY] = payload[:
|
58
|
-
attrs[PRIORITY_KEY] = payload[:
|
60
|
+
attrs[SAMPLED_KEY] = payload[:sampled] if payload.key?(:sampled)
|
61
|
+
attrs[PRIORITY_KEY] = payload[:priority]
|
59
62
|
append_synthetics payload, attrs
|
60
63
|
append_cat payload, attrs
|
61
|
-
|
64
|
+
DistributedTraceAttributes.copy_to_hash payload, attrs
|
62
65
|
PayloadMetricMapping.append_mapped_metrics payload[:metrics], attrs
|
63
66
|
end
|
64
67
|
|
@@ -75,14 +78,6 @@ module NewRelic
|
|
75
78
|
sample[GUID_KEY] = payload[:guid] if payload[:guid]
|
76
79
|
sample[REFERRING_TRANSACTION_GUID_KEY] = payload[:referring_transaction_guid] if payload[:referring_transaction_guid]
|
77
80
|
end
|
78
|
-
|
79
|
-
def append_distributed_trace_intrinsics payload, sample
|
80
|
-
return unless Agent.config[:'distributed_tracing.enabled']
|
81
|
-
DistributedTracePayload::INTRINSIC_KEYS.each do |key|
|
82
|
-
value = payload[key]
|
83
|
-
sample[key] = value unless value.nil?
|
84
|
-
end
|
85
|
-
end
|
86
81
|
end
|
87
82
|
end
|
88
83
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
# encoding: utf-8
|
3
3
|
# This file is distributed under New Relic's license terms.
|
4
|
-
# See https://github.com/newrelic/
|
4
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
5
5
|
|
6
6
|
require 'newrelic_rpm' unless defined?( NewRelic )
|
7
7
|
require 'new_relic/agent' unless defined?( NewRelic::Agent )
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
|
+
# frozen_string_literal: true
|
4
5
|
|
5
6
|
# This module was introduced and largely extracted from the transaction event aggregator
|
6
7
|
# when the synthetics container was extracted from it. Its purpose is to create the data
|
@@ -8,7 +9,7 @@
|
|
8
9
|
# the transaction event aggregator and the synthetics container.
|
9
10
|
|
10
11
|
require 'new_relic/agent/payload_metric_mapping'
|
11
|
-
require 'new_relic/agent/
|
12
|
+
require 'new_relic/agent/distributed_tracing/distributed_trace_attributes'
|
12
13
|
|
13
14
|
module NewRelic
|
14
15
|
module Agent
|
@@ -16,30 +17,28 @@ module NewRelic
|
|
16
17
|
include NewRelic::Coerce
|
17
18
|
extend self
|
18
19
|
|
20
|
+
COMMA = ','
|
21
|
+
|
19
22
|
# The type field of the sample
|
20
|
-
SAMPLE_TYPE = 'Transaction'
|
23
|
+
SAMPLE_TYPE = 'Transaction'
|
21
24
|
|
22
25
|
# Strings for static keys of the sample structure
|
23
|
-
TYPE_KEY = 'type'
|
24
|
-
TIMESTAMP_KEY = 'timestamp'
|
25
|
-
NAME_KEY = 'name'
|
26
|
-
DURATION_KEY = 'duration'
|
27
|
-
ERROR_KEY = 'error'
|
28
|
-
SAMPLED_KEY = 'sampled'
|
29
|
-
PRIORITY_KEY = 'priority'
|
30
|
-
GUID_KEY = 'nr.guid'
|
31
|
-
REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'
|
32
|
-
CAT_PATH_HASH_KEY = 'nr.pathHash'
|
33
|
-
CAT_REFERRING_PATH_HASH_KEY = 'nr.referringPathHash'
|
34
|
-
CAT_ALTERNATE_PATH_HASHES_KEY = 'nr.alternatePathHashes'
|
35
|
-
APDEX_PERF_ZONE_KEY = 'nr.apdexPerfZone'
|
36
|
-
SYNTHETICS_RESOURCE_ID_KEY = "nr.syntheticsResourceId"
|
37
|
-
SYNTHETICS_JOB_ID_KEY = "nr.syntheticsJobId"
|
38
|
-
SYNTHETICS_MONITOR_ID_KEY = "nr.syntheticsMonitorId"
|
39
|
-
|
40
|
-
|
41
|
-
# To avoid allocations when we have empty custom or agent attributes
|
42
|
-
EMPTY_HASH = {}.freeze
|
26
|
+
TYPE_KEY = 'type'
|
27
|
+
TIMESTAMP_KEY = 'timestamp'
|
28
|
+
NAME_KEY = 'name'
|
29
|
+
DURATION_KEY = 'duration'
|
30
|
+
ERROR_KEY = 'error'
|
31
|
+
SAMPLED_KEY = 'sampled'
|
32
|
+
PRIORITY_KEY = 'priority'
|
33
|
+
GUID_KEY = 'nr.guid'
|
34
|
+
REFERRING_TRANSACTION_GUID_KEY = 'nr.referringTransactionGuid'
|
35
|
+
CAT_PATH_HASH_KEY = 'nr.pathHash'
|
36
|
+
CAT_REFERRING_PATH_HASH_KEY = 'nr.referringPathHash'
|
37
|
+
CAT_ALTERNATE_PATH_HASHES_KEY = 'nr.alternatePathHashes'
|
38
|
+
APDEX_PERF_ZONE_KEY = 'nr.apdexPerfZone'
|
39
|
+
SYNTHETICS_RESOURCE_ID_KEY = "nr.syntheticsResourceId"
|
40
|
+
SYNTHETICS_JOB_ID_KEY = "nr.syntheticsJobId"
|
41
|
+
SYNTHETICS_MONITOR_ID_KEY = "nr.syntheticsMonitorId"
|
43
42
|
|
44
43
|
def create(payload)
|
45
44
|
intrinsics = {
|
@@ -51,11 +50,11 @@ module NewRelic
|
|
51
50
|
PRIORITY_KEY => payload[:priority]
|
52
51
|
}
|
53
52
|
|
54
|
-
intrinsics[SAMPLED_KEY] = payload[:
|
53
|
+
intrinsics[SAMPLED_KEY] = payload[:sampled] if payload.key?(:sampled)
|
55
54
|
|
56
|
-
|
55
|
+
PayloadMetricMapping.append_mapped_metrics(payload[:metrics], intrinsics)
|
57
56
|
append_optional_attributes(intrinsics, payload)
|
58
|
-
|
57
|
+
DistributedTraceAttributes.copy_to_hash payload, intrinsics
|
59
58
|
|
60
59
|
attributes = payload[:attributes]
|
61
60
|
|
@@ -76,22 +75,12 @@ module NewRelic
|
|
76
75
|
append_cat_alternate_path_hashes(sample, payload)
|
77
76
|
end
|
78
77
|
|
79
|
-
COMMA = ','.freeze
|
80
|
-
|
81
78
|
def append_cat_alternate_path_hashes(sample, payload)
|
82
79
|
if payload.include?(:cat_alternate_path_hashes)
|
83
80
|
sample[CAT_ALTERNATE_PATH_HASHES_KEY] = payload[:cat_alternate_path_hashes].sort.join(COMMA)
|
84
81
|
end
|
85
82
|
end
|
86
83
|
|
87
|
-
def append_distributed_trace_intrinsics(sample, payload)
|
88
|
-
return unless Agent.config[:'distributed_tracing.enabled']
|
89
|
-
DistributedTracePayload::INTRINSIC_KEYS.each do |key|
|
90
|
-
value = payload[key]
|
91
|
-
sample[key] = value unless value.nil?
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
84
|
def optionally_append(sample_key, payload_key, sample, payload)
|
96
85
|
if payload.include?(payload_key)
|
97
86
|
sample[sample_key] = string(payload[payload_key])
|
@@ -100,19 +89,19 @@ module NewRelic
|
|
100
89
|
|
101
90
|
def custom_attributes attributes
|
102
91
|
if attributes
|
103
|
-
result = attributes.custom_attributes_for(
|
92
|
+
result = attributes.custom_attributes_for(AttributeFilter::DST_TRANSACTION_EVENTS)
|
104
93
|
result.freeze
|
105
94
|
else
|
106
|
-
EMPTY_HASH
|
95
|
+
NewRelic::EMPTY_HASH
|
107
96
|
end
|
108
97
|
end
|
109
98
|
|
110
99
|
def agent_attributes attributes
|
111
100
|
if attributes
|
112
|
-
result = attributes.agent_attributes_for(
|
101
|
+
result = attributes.agent_attributes_for(AttributeFilter::DST_TRANSACTION_EVENTS)
|
113
102
|
result.freeze
|
114
103
|
else
|
115
|
-
EMPTY_HASH
|
104
|
+
NewRelic::EMPTY_HASH
|
116
105
|
end
|
117
106
|
end
|
118
107
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
require 'new_relic/agent/transaction_event_aggregator'
|
5
5
|
require 'new_relic/agent/synthetics_event_aggregator'
|
6
6
|
require 'new_relic/agent/transaction_event_primitive'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
# This class represents a set of metrics that were recorded during a single
|
6
6
|
# transaction. Since the name of the transaction is not known until its end, we
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/transaction/slowest_sample_buffer'
|
6
6
|
require 'new_relic/agent/transaction/synthetics_sample_buffer'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
# This module powers the Busy calculation for the Capacity report in
|
6
6
|
# APM (https://rpm.newrelic.com/accounts/.../applications/.../optimize/capacity_analysis).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
require 'new_relic/agent/utilization/vendor'
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/
|
3
|
+
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module Agent
|