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
@@ -33,7 +33,7 @@ module NewRelic
|
|
33
33
|
"trusted_account_key"
|
34
34
|
]
|
35
35
|
|
36
|
-
def initialize(connect_reply, existing_config={})
|
36
|
+
def initialize(connect_reply, existing_config = {})
|
37
37
|
merged_settings = {}
|
38
38
|
|
39
39
|
merge_top_level_keys(merged_settings, connect_reply)
|
@@ -76,12 +76,12 @@ module NewRelic
|
|
76
76
|
end
|
77
77
|
|
78
78
|
EVENT_HARVEST_CONFIG_SUPPORTABILITY_METRIC_NAMES = {
|
79
|
-
:'
|
79
|
+
:'transaction_events.max_samples_stored' => 'Supportability/EventHarvest/AnalyticEventData/HarvestLimit',
|
80
80
|
:'custom_insights_events.max_samples_stored' => 'Supportability/EventHarvest/CustomEventData/HarvestLimit',
|
81
|
-
:'error_collector.max_event_samples_stored'=> 'Supportability/EventHarvest/ErrorEventData/HarvestLimit',
|
81
|
+
:'error_collector.max_event_samples_stored' => 'Supportability/EventHarvest/ErrorEventData/HarvestLimit',
|
82
82
|
:'span_events.max_samples_stored' => 'Supportability/SpanEvent/Limit',
|
83
83
|
:event_report_period => 'Supportability/EventHarvest/ReportPeriod',
|
84
|
-
:'event_report_period.span_event_data' => 'Supportability/SpanEvent/ReportPeriod'
|
84
|
+
:'event_report_period.span_event_data' => 'Supportability/SpanEvent/ReportPeriod'
|
85
85
|
}
|
86
86
|
|
87
87
|
def add_event_harvest_config(merged_settings, connect_reply)
|
@@ -133,19 +133,19 @@ module NewRelic
|
|
133
133
|
# do the real enforcement there.
|
134
134
|
def apply_feature_gates(merged_settings, connect_reply, existing_config)
|
135
135
|
gated_features = {
|
136
|
-
'transaction_tracer.enabled'
|
137
|
-
'slow_sql.enabled'
|
138
|
-
'error_collector.enabled'
|
139
|
-
'
|
136
|
+
'transaction_tracer.enabled' => 'collect_traces',
|
137
|
+
'slow_sql.enabled' => 'collect_traces',
|
138
|
+
'error_collector.enabled' => 'collect_errors',
|
139
|
+
'transaction_events.enabled' => 'collect_analytics_events',
|
140
140
|
'custom_insights_events.enabled' => 'collect_custom_events',
|
141
141
|
'error_collector.capture_events' => 'collect_error_events',
|
142
|
-
'span_events.enabled'
|
142
|
+
'span_events.enabled' => 'collect_span_events'
|
143
143
|
}
|
144
144
|
gated_features.each do |config_key, gate_key|
|
145
145
|
if connect_reply.has_key?(gate_key)
|
146
146
|
allowed_by_server = connect_reply[gate_key]
|
147
|
-
requested_value
|
148
|
-
effective_value
|
147
|
+
requested_value = ungated_value(config_key, merged_settings, existing_config)
|
148
|
+
effective_value = (allowed_by_server && requested_value)
|
149
149
|
merged_settings[config_key] = effective_value
|
150
150
|
end
|
151
151
|
end
|
@@ -17,7 +17,7 @@ module NewRelic
|
|
17
17
|
|
18
18
|
def initialize(path, env)
|
19
19
|
@path = path
|
20
|
-
config
|
20
|
+
config = {}
|
21
21
|
@failures = []
|
22
22
|
|
23
23
|
# These are needed in process_erb for populating the newrelic.yml via
|
@@ -34,7 +34,7 @@ module NewRelic
|
|
34
34
|
::NewRelic::Agent.logger.info("Reading configuration from #{path} (#{Dir.pwd})")
|
35
35
|
raw_file = File.read(@file_path)
|
36
36
|
erb_file = process_erb(raw_file)
|
37
|
-
config
|
37
|
+
config = process_yaml(erb_file, env, config, @file_path)
|
38
38
|
rescue ScriptError, StandardError => e
|
39
39
|
log_failure("Failed to read or parse configuration file at #{path}", e)
|
40
40
|
end
|
@@ -63,8 +63,8 @@ module NewRelic
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def warn_missing_config_file(path)
|
66
|
-
based_on
|
67
|
-
source
|
66
|
+
based_on = 'unknown'
|
67
|
+
source = ::NewRelic::Agent.config.source(:config_path)
|
68
68
|
candidate_paths = [path]
|
69
69
|
|
70
70
|
case source
|
@@ -104,10 +104,10 @@ module NewRelic
|
|
104
104
|
def process_yaml(file, env, config, path)
|
105
105
|
if file
|
106
106
|
confighash = if YAML.respond_to?(:unsafe_load)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
107
|
+
YAML.unsafe_load(file)
|
108
|
+
else
|
109
|
+
YAML.load(file)
|
110
|
+
end
|
111
111
|
|
112
112
|
unless confighash.key?(env)
|
113
113
|
log_failure("Config file at #{path} doesn't include a '#{env}' section!")
|
@@ -151,7 +151,7 @@ module NewRelic
|
|
151
151
|
messages.each { |message| @failures << message }
|
152
152
|
end
|
153
153
|
|
154
|
-
def dot_flattened(nested_hash, names=[], result={})
|
154
|
+
def dot_flattened(nested_hash, names = [], result = {})
|
155
155
|
nested_hash.each do |key, val|
|
156
156
|
next if val == nil
|
157
157
|
if val.respond_to?(:has_key?) && !CONFIG_WITH_HASH_VALUE.include?(key)
|
@@ -8,9 +8,7 @@ require 'new_relic/agent/configuration/event_harvest_config'
|
|
8
8
|
module NewRelic
|
9
9
|
module Agent
|
10
10
|
module Connect
|
11
|
-
|
12
11
|
class RequestBuilder
|
13
|
-
|
14
12
|
def initialize(new_relic_service, config, event_harvest_config, environment_report)
|
15
13
|
@service = new_relic_service
|
16
14
|
@config = config
|
@@ -18,24 +16,23 @@ module NewRelic
|
|
18
16
|
@environment_report = sanitize_environment_report(environment_report)
|
19
17
|
end
|
20
18
|
|
21
|
-
|
22
19
|
# Initializes the hash of settings that we send to the
|
23
20
|
# server. Returns a literal hash containing the options
|
24
21
|
def connect_payload
|
25
22
|
{
|
26
|
-
:pid
|
27
|
-
:host
|
28
|
-
:display_host
|
29
|
-
:app_name
|
30
|
-
:language
|
31
|
-
:labels
|
23
|
+
:pid => $$,
|
24
|
+
:host => local_host,
|
25
|
+
:display_host => Agent.config[:'process_host.display_name'],
|
26
|
+
:app_name => Agent.config[:app_name],
|
27
|
+
:language => 'ruby',
|
28
|
+
:labels => Agent.config.parsed_labels,
|
32
29
|
:agent_version => NewRelic::VERSION::STRING,
|
33
|
-
:environment
|
34
|
-
:metadata
|
35
|
-
:settings
|
30
|
+
:environment => @environment_report,
|
31
|
+
:metadata => environment_metadata,
|
32
|
+
:settings => Agent.config.to_collector_hash,
|
36
33
|
:high_security => Agent.config[:high_security],
|
37
|
-
:utilization
|
38
|
-
:identifier
|
34
|
+
:utilization => UtilizationData.new.to_collector_hash,
|
35
|
+
:identifier => "ruby:#{local_host}:#{Agent.config[:app_name].sort.join(',')}",
|
39
36
|
:event_harvest_config => @event_harvest_config
|
40
37
|
}
|
41
38
|
end
|
@@ -48,9 +45,9 @@ module NewRelic
|
|
48
45
|
environment_report
|
49
46
|
end
|
50
47
|
|
51
|
-
def environment_metadata
|
48
|
+
def environment_metadata
|
52
49
|
env_copy = {}
|
53
|
-
ENV.keys.each {|k| env_copy[k] = ENV[k] if k =~ /^NEW_RELIC_METADATA_/}
|
50
|
+
ENV.keys.each { |k| env_copy[k] = ENV[k] if k =~ /^NEW_RELIC_METADATA_/ }
|
54
51
|
env_copy
|
55
52
|
end
|
56
53
|
|
@@ -2,13 +2,10 @@
|
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
|
-
|
6
5
|
module NewRelic
|
7
6
|
module Agent
|
8
7
|
module Connect
|
9
|
-
|
10
8
|
class ResponseHandler
|
11
|
-
|
12
9
|
def initialize(agent, config)
|
13
10
|
@agent = agent
|
14
11
|
@config = config
|
@@ -10,9 +10,9 @@ module NewRelic
|
|
10
10
|
class CustomEventAggregator < EventAggregator
|
11
11
|
include NewRelic::Coerce
|
12
12
|
|
13
|
-
TYPE
|
14
|
-
TIMESTAMP
|
15
|
-
PRIORITY
|
13
|
+
TYPE = 'type'.freeze
|
14
|
+
TIMESTAMP = 'timestamp'.freeze
|
15
|
+
PRIORITY = 'priority'.freeze
|
16
16
|
EVENT_TYPE_REGEX = /^[a-zA-Z0-9:_ ]+$/.freeze
|
17
17
|
|
18
18
|
named :CustomEventAggregator
|
@@ -46,10 +46,9 @@ module NewRelic
|
|
46
46
|
|
47
47
|
def create_event(type, priority, attributes)
|
48
48
|
[
|
49
|
-
{
|
50
|
-
|
51
|
-
|
52
|
-
},
|
49
|
+
{TYPE => type,
|
50
|
+
TIMESTAMP => Process.clock_gettime(Process::CLOCK_REALTIME).to_i,
|
51
|
+
PRIORITY => priority},
|
53
52
|
AttributeProcessing.flatten_and_coerce(attributes)
|
54
53
|
]
|
55
54
|
end
|
@@ -72,9 +71,9 @@ module NewRelic
|
|
72
71
|
|
73
72
|
def record_supportability_metrics total_count, captured_count, dropped_count
|
74
73
|
engine = NewRelic::Agent.instance.stats_engine
|
75
|
-
engine.tl_record_supportability_metric_count("Events/Customer/Seen"
|
76
|
-
engine.tl_record_supportability_metric_count("Events/Customer/Sent"
|
77
|
-
engine.tl_record_supportability_metric_count("Events/Customer/Dropped",
|
74
|
+
engine.tl_record_supportability_metric_count("Events/Customer/Seen", total_count)
|
75
|
+
engine.tl_record_supportability_metric_count("Events/Customer/Sent", captured_count)
|
76
|
+
engine.tl_record_supportability_metric_count("Events/Customer/Dropped", dropped_count)
|
78
77
|
end
|
79
78
|
|
80
79
|
def note_dropped_event(type)
|
@@ -9,7 +9,6 @@ module NewRelic
|
|
9
9
|
module Agent
|
10
10
|
module Database
|
11
11
|
module ExplainPlanHelpers
|
12
|
-
|
13
12
|
SUPPORTED_ADAPTERS_FOR_EXPLAIN = [:postgres, :mysql2, :mysql, :sqlite]
|
14
13
|
SELECT = 'select'.freeze
|
15
14
|
|
@@ -97,7 +96,7 @@ module NewRelic
|
|
97
96
|
|
98
97
|
def process_explain_results_mysql(results)
|
99
98
|
headers = []
|
100
|
-
values
|
99
|
+
values = []
|
101
100
|
if results.is_a?(Array)
|
102
101
|
# We're probably using the jdbc-mysql gem for JRuby, which will give
|
103
102
|
# us an array of hashes.
|
@@ -118,7 +117,7 @@ module NewRelic
|
|
118
117
|
|
119
118
|
def process_explain_results_mysql2(results)
|
120
119
|
headers = results.fields
|
121
|
-
values
|
120
|
+
values = []
|
122
121
|
results.each { |row| values << row }
|
123
122
|
[headers, values]
|
124
123
|
end
|
@@ -127,7 +126,7 @@ module NewRelic
|
|
127
126
|
|
128
127
|
def process_explain_results_sqlite(results)
|
129
128
|
headers = SQLITE_EXPLAIN_COLUMNS
|
130
|
-
values
|
129
|
+
values = []
|
131
130
|
results.each do |row|
|
132
131
|
values << headers.map { |h| row[h] }
|
133
132
|
end
|
@@ -20,17 +20,17 @@ module NewRelic
|
|
20
20
|
}
|
21
21
|
|
22
22
|
DIALECT_COMPONENTS = {
|
23
|
-
:fallback
|
24
|
-
:mysql
|
25
|
-
|
26
|
-
:postgres
|
27
|
-
|
28
|
-
:sqlite
|
29
|
-
|
30
|
-
:oracle
|
31
|
-
|
32
|
-
:cassandra
|
33
|
-
|
23
|
+
:fallback => COMPONENTS_REGEX_MAP.keys,
|
24
|
+
:mysql => [:single_quotes, :double_quotes, :numeric_literals, :boolean_literals,
|
25
|
+
:hexadecimal_literals, :comments, :multi_line_comments],
|
26
|
+
:postgres => [:single_quotes, :dollar_quotes, :uuids, :numeric_literals,
|
27
|
+
:boolean_literals, :comments, :multi_line_comments],
|
28
|
+
:sqlite => [:single_quotes, :numeric_literals, :boolean_literals, :hexadecimal_literals,
|
29
|
+
:comments, :multi_line_comments],
|
30
|
+
:oracle => [:single_quotes, :oracle_quoted_strings, :numeric_literals, :comments,
|
31
|
+
:multi_line_comments],
|
32
|
+
:cassandra => [:single_quotes, :uuids, :numeric_literals, :boolean_literals,
|
33
|
+
:hexadecimal_literals, :comments, :multi_line_comments]
|
34
34
|
}
|
35
35
|
|
36
36
|
# We use these to check whether the query contains any quote characters
|
@@ -58,7 +58,7 @@ module NewRelic
|
|
58
58
|
|
59
59
|
def self.generate_regex(dialect)
|
60
60
|
components = DIALECT_COMPONENTS[dialect]
|
61
|
-
Regexp.union(components.map{|component| COMPONENTS_REGEX_MAP[component]})
|
61
|
+
Regexp.union(components.map { |component| COMPONENTS_REGEX_MAP[component] })
|
62
62
|
end
|
63
63
|
|
64
64
|
MYSQL_COMPONENTS_REGEX = self.generate_regex(:mysql)
|
@@ -12,7 +12,7 @@ module NewRelic
|
|
12
12
|
# Database::Obfuscator class because here we don't look for
|
13
13
|
# backslash-escaped strings.
|
14
14
|
QUOTED_STRINGS_REGEX = /'(?:[^']|'')*'|"(?:[^"]|"")*"/
|
15
|
-
LABEL_LINE_REGEX
|
15
|
+
LABEL_LINE_REGEX = /^([^:\n]*:\s+).*$/.freeze
|
16
16
|
|
17
17
|
def obfuscate(explain)
|
18
18
|
# First, we replace all single-quoted strings.
|
@@ -35,7 +35,7 @@ module NewRelic
|
|
35
35
|
# All parts of the query that can appear in the explain output are
|
36
36
|
# prefixed with "<label>: ", so we want to preserve the label, but
|
37
37
|
# remove the rest of the line.
|
38
|
-
explain.gsub!(LABEL_LINE_REGEX,
|
38
|
+
explain.gsub!(LABEL_LINE_REGEX, '\1?')
|
39
39
|
explain
|
40
40
|
end
|
41
41
|
end
|
@@ -9,17 +9,17 @@ require 'new_relic/agent/database/obfuscator'
|
|
9
9
|
module NewRelic
|
10
10
|
# columns for a mysql explain plan
|
11
11
|
MYSQL_EXPLAIN_COLUMNS = [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
"Id",
|
13
|
+
"Select Type",
|
14
|
+
"Table",
|
15
|
+
"Type",
|
16
|
+
"Possible Keys",
|
17
|
+
"Key",
|
18
|
+
"Key Length",
|
19
|
+
"Ref",
|
20
|
+
"Rows",
|
21
|
+
"Extra"
|
22
|
+
].freeze
|
23
23
|
|
24
24
|
module Agent
|
25
25
|
module Database
|
@@ -57,7 +57,7 @@ module NewRelic
|
|
57
57
|
Obfuscator.instance.set_sql_obfuscator(type, &block)
|
58
58
|
end
|
59
59
|
|
60
|
-
def record_sql_method(config_section
|
60
|
+
def record_sql_method(config_section = :transaction_tracer)
|
61
61
|
key = record_sql_method_key(config_section)
|
62
62
|
|
63
63
|
case Agent.config[key].to_s
|
@@ -87,11 +87,11 @@ module NewRelic
|
|
87
87
|
|
88
88
|
RECORD_FOR = [:raw, :obfuscated].freeze
|
89
89
|
|
90
|
-
def should_record_sql?(config_section
|
90
|
+
def should_record_sql?(config_section = :transaction_tracer)
|
91
91
|
RECORD_FOR.include?(record_sql_method(config_section))
|
92
92
|
end
|
93
93
|
|
94
|
-
def should_collect_explain_plans?(config_section
|
94
|
+
def should_collect_explain_plans?(config_section = :transaction_tracer)
|
95
95
|
should_record_sql?(config_section) &&
|
96
96
|
Agent.config["#{config_section}.explain_enabled".to_sym]
|
97
97
|
end
|
@@ -185,7 +185,7 @@ module NewRelic
|
|
185
185
|
|
186
186
|
DEFAULT_QUERY_NAME = "SQL".freeze
|
187
187
|
|
188
|
-
def initialize(sql, config={}, explainer=nil, binds=nil, name=DEFAULT_QUERY_NAME, host=nil, port_path_or_id=nil, database_name=nil)
|
188
|
+
def initialize(sql, config = {}, explainer = nil, binds = nil, name = DEFAULT_QUERY_NAME, host = nil, port_path_or_id = nil, database_name = nil)
|
189
189
|
@sql = Database.capture_query(sql)
|
190
190
|
@config = config
|
191
191
|
@explainer = explainer
|
@@ -205,9 +205,7 @@ module NewRelic
|
|
205
205
|
Database.obfuscate_sql(self)
|
206
206
|
when :raw
|
207
207
|
sql.to_s
|
208
|
-
|
209
|
-
nil
|
210
|
-
end
|
208
|
+
end
|
211
209
|
end
|
212
210
|
|
213
211
|
# This takes a connection config hash from ActiveRecord or Sequel and
|
@@ -220,8 +218,6 @@ module NewRelic
|
|
220
218
|
elsif @config[:uri] && @config[:uri].to_s =~ /^jdbc:([^:]+):/
|
221
219
|
# This case is for Sequel with the jdbc-mysql, jdbc-postgres, or jdbc-sqlite3 gems.
|
222
220
|
symbolized_adapter($1)
|
223
|
-
else
|
224
|
-
nil
|
225
221
|
end
|
226
222
|
end
|
227
223
|
|
@@ -247,11 +243,11 @@ module NewRelic
|
|
247
243
|
|
248
244
|
private
|
249
245
|
|
250
|
-
POSTGIS_PREFIX
|
246
|
+
POSTGIS_PREFIX = 'postgis'.freeze
|
251
247
|
POSTGRES_PREFIX = 'postgres'.freeze
|
252
|
-
MYSQL_PREFIX
|
253
|
-
MYSQL2_PREFIX
|
254
|
-
SQLITE_PREFIX
|
248
|
+
MYSQL_PREFIX = 'mysql'.freeze
|
249
|
+
MYSQL2_PREFIX = 'mysql2'.freeze
|
250
|
+
SQLITE_PREFIX = 'sqlite'.freeze
|
255
251
|
|
256
252
|
def symbolized_adapter(adapter)
|
257
253
|
if adapter.start_with?(POSTGRES_PREFIX) || adapter == POSTGIS_PREFIX
|
@@ -6,9 +6,9 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
module Datastores
|
8
8
|
module MetricHelper
|
9
|
-
ROLLUP_METRIC
|
10
|
-
WEB_ROLLUP_METRIC
|
11
|
-
OTHER_ROLLUP_METRIC
|
9
|
+
ROLLUP_METRIC = "Datastore/all".freeze
|
10
|
+
WEB_ROLLUP_METRIC = "Datastore/allWeb".freeze
|
11
|
+
OTHER_ROLLUP_METRIC = "Datastore/allOther".freeze
|
12
12
|
DEFAULT_PRODUCT_NAME = "ActiveRecord".freeze
|
13
13
|
OTHER = "Other".freeze
|
14
14
|
|
@@ -48,7 +48,7 @@ module NewRelic
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.scoped_metric_for product, operation, collection=nil
|
51
|
+
def self.scoped_metric_for product, operation, collection = nil
|
52
52
|
if collection
|
53
53
|
statement_metric_for product, collection, operation
|
54
54
|
else
|
@@ -56,7 +56,7 @@ module NewRelic
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def self.unscoped_metrics_for product, operation, collection=nil, host=nil, port_path_or_id=nil
|
59
|
+
def self.unscoped_metrics_for product, operation, collection = nil, host = nil, port_path_or_id = nil
|
60
60
|
suffix = all_suffix
|
61
61
|
|
62
62
|
metrics = [
|
@@ -74,17 +74,17 @@ module NewRelic
|
|
74
74
|
metrics
|
75
75
|
end
|
76
76
|
|
77
|
-
def self.product_operation_collection_for product, operation, collection=nil, generic_product = nil
|
77
|
+
def self.product_operation_collection_for product, operation, collection = nil, generic_product = nil
|
78
78
|
if overrides = overridden_operation_and_collection
|
79
79
|
if should_override?(overrides, product, generic_product)
|
80
|
-
operation
|
80
|
+
operation = overrides[0] || operation
|
81
81
|
collection = overrides[1] || collection
|
82
82
|
end
|
83
83
|
end
|
84
84
|
[product, operation, collection]
|
85
85
|
end
|
86
86
|
|
87
|
-
def self.metrics_for(product, operation, collection = nil, generic_product = nil, host=nil, port_path_or_id=nil)
|
87
|
+
def self.metrics_for(product, operation, collection = nil, generic_product = nil, host = nil, port_path_or_id = nil)
|
88
88
|
product, operation, collection = product_operation_collection_for(product, operation, collection, generic_product)
|
89
89
|
|
90
90
|
# Order of these metrics matters--the first metric in the list will
|
@@ -106,8 +106,8 @@ module NewRelic
|
|
106
106
|
|
107
107
|
# Allow Transaction#with_database_metric_name to override our
|
108
108
|
# collection and operation
|
109
|
-
def self.overridden_operation_and_collection #THREAD_LOCAL_ACCESS
|
110
|
-
txn
|
109
|
+
def self.overridden_operation_and_collection # THREAD_LOCAL_ACCESS
|
110
|
+
txn = Tracer.current_transaction
|
111
111
|
txn ? txn.instrumentation_state[:datastore_override] : nil
|
112
112
|
end
|
113
113
|
|
@@ -8,12 +8,11 @@ module NewRelic
|
|
8
8
|
module Datastores
|
9
9
|
module Mongo
|
10
10
|
module EventFormatter
|
11
|
-
|
12
11
|
# Keys that will get their values replaced with '?'.
|
13
|
-
OBFUSCATE_KEYS = [
|
12
|
+
OBFUSCATE_KEYS = ['filter', 'query', 'pipeline'].freeze
|
14
13
|
|
15
14
|
# Keys that will get completely removed from the statement.
|
16
|
-
DENYLISTED_KEYS = [
|
15
|
+
DENYLISTED_KEYS = ['deletes', 'documents', 'updates'].freeze
|
17
16
|
|
18
17
|
def self.format(command_name, database_name, command)
|
19
18
|
return nil unless NewRelic::Agent.config[:'mongo.capture_queries']
|
@@ -15,8 +15,8 @@ module NewRelic
|
|
15
15
|
|
16
16
|
if collection_in_selector?(payload)
|
17
17
|
command_key = command_key_from_selector(payload)
|
18
|
-
name
|
19
|
-
collection
|
18
|
+
name = get_name_from_selector(command_key, payload)
|
19
|
+
collection = get_collection_from_selector(command_key, payload)
|
20
20
|
else
|
21
21
|
collection = payload[:collection]
|
22
22
|
end
|
@@ -79,7 +79,7 @@ module NewRelic
|
|
79
79
|
|
80
80
|
:collstats,
|
81
81
|
:renameCollection,
|
82
|
-
:drop
|
82
|
+
:drop
|
83
83
|
]
|
84
84
|
|
85
85
|
def self.command_key_from_selector(payload)
|
@@ -176,9 +176,7 @@ module NewRelic
|
|
176
176
|
parts.shift
|
177
177
|
parts.join('.')
|
178
178
|
end
|
179
|
-
|
180
179
|
end
|
181
|
-
|
182
180
|
end
|
183
181
|
end
|
184
182
|
end
|
@@ -7,7 +7,6 @@ module NewRelic
|
|
7
7
|
module Datastores
|
8
8
|
module Mongo
|
9
9
|
module Obfuscator
|
10
|
-
|
11
10
|
ALLOWLIST = [:operation].freeze
|
12
11
|
|
13
12
|
def self.obfuscate_statement(source, allowlist = ALLOWLIST)
|
@@ -32,7 +31,7 @@ module NewRelic
|
|
32
31
|
if value.is_a?(Hash)
|
33
32
|
obfuscate_statement(value, allowlist)
|
34
33
|
elsif value.is_a?(Array)
|
35
|
-
value.map {|v| obfuscate_value(v, allowlist)}
|
34
|
+
value.map { |v| obfuscate_value(v, allowlist) }
|
36
35
|
else
|
37
36
|
QUESTION_MARK
|
38
37
|
end
|
@@ -10,7 +10,7 @@ module NewRelic
|
|
10
10
|
|
11
11
|
MAXIMUM_COMMAND_LENGTH = 1000
|
12
12
|
MAXIMUM_ARGUMENT_LENGTH = 64
|
13
|
-
CHUNK_SIZE
|
13
|
+
CHUNK_SIZE = (MAXIMUM_ARGUMENT_LENGTH - 5) / 2
|
14
14
|
PREFIX_RANGE = (0...CHUNK_SIZE)
|
15
15
|
SUFFIX_RANGE = (-CHUNK_SIZE..-1)
|
16
16
|
|
@@ -32,8 +32,6 @@ module NewRelic
|
|
32
32
|
trim_result(result) if result.length >= MAXIMUM_COMMAND_LENGTH
|
33
33
|
result.strip!
|
34
34
|
result
|
35
|
-
else
|
36
|
-
nil
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
@@ -117,7 +115,7 @@ module NewRelic
|
|
117
115
|
end
|
118
116
|
|
119
117
|
def self.trim_result(result)
|
120
|
-
result.slice!((MAXIMUM_COMMAND_LENGTH-ELLIPSES.length)..-1)
|
118
|
+
result.slice!((MAXIMUM_COMMAND_LENGTH - ELLIPSES.length)..-1)
|
121
119
|
result.strip!
|
122
120
|
result << ELLIPSES
|
123
121
|
end
|
@@ -13,7 +13,6 @@ module NewRelic
|
|
13
13
|
#
|
14
14
|
# @api public
|
15
15
|
module Datastores
|
16
|
-
|
17
16
|
# @!group Tracing query methods
|
18
17
|
|
19
18
|
# Add Datastore tracing to a method. This properly generates the metrics
|
@@ -40,7 +39,7 @@ module NewRelic
|
|
40
39
|
method_name_without_newrelic = "#{method_name}_without_newrelic"
|
41
40
|
|
42
41
|
if NewRelic::Helper.instance_methods_include?(klass, method_name) &&
|
43
|
-
|
42
|
+
!NewRelic::Helper.instance_methods_include?(klass, method_name_without_newrelic)
|
44
43
|
|
45
44
|
visibility = NewRelic::Helper.instance_method_visibility(klass, method_name)
|
46
45
|
|
@@ -202,7 +201,6 @@ module NewRelic
|
|
202
201
|
end
|
203
202
|
nil
|
204
203
|
end
|
205
|
-
|
206
204
|
end
|
207
205
|
end
|
208
206
|
end
|
@@ -8,20 +8,20 @@ module NewRelic
|
|
8
8
|
attr_reader :id, :transaction, :referring_guid, :referring_trip_id, :referring_path_hash
|
9
9
|
|
10
10
|
def initialize(id, transaction, transaction_info)
|
11
|
-
@id
|
12
|
-
@transaction
|
11
|
+
@id = id
|
12
|
+
@transaction = transaction
|
13
13
|
|
14
14
|
transaction_info ||= []
|
15
|
-
@referring_guid
|
15
|
+
@referring_guid = transaction_info[0]
|
16
16
|
# unused_flag = transaction_info[1]
|
17
|
-
@referring_trip_id
|
17
|
+
@referring_trip_id = string_or_false_for(transaction_info[2])
|
18
18
|
@referring_path_hash = string_or_false_for(transaction_info[3])
|
19
19
|
end
|
20
20
|
|
21
21
|
def as_json_array(content_length)
|
22
22
|
queue_time_in_seconds = [transaction.queue_time, 0.0].max
|
23
23
|
start_time_in_seconds = [transaction.start_time, 0.0].max
|
24
|
-
app_time_in_seconds
|
24
|
+
app_time_in_seconds = Process.clock_gettime(Process::CLOCK_REALTIME) - start_time_in_seconds
|
25
25
|
|
26
26
|
[
|
27
27
|
NewRelic::Agent.config[:cross_process_id],
|