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
@@ -36,7 +36,7 @@ module NewRelic
|
|
36
36
|
def initialize
|
37
37
|
# Extend self with any any submodules of LocalEnvironment. These can override
|
38
38
|
# the discover methods to discover new framworks and dispatchers.
|
39
|
-
NewRelic::LocalEnvironment.constants.each do |
|
39
|
+
NewRelic::LocalEnvironment.constants.each do |const|
|
40
40
|
mod = NewRelic::LocalEnvironment.const_get const
|
41
41
|
self.extend mod if mod.instance_of? Module
|
42
42
|
end
|
@@ -77,13 +77,13 @@ module NewRelic
|
|
77
77
|
unicorn
|
78
78
|
]
|
79
79
|
while dispatchers.any? && @discovered_dispatcher.nil?
|
80
|
-
send 'check_for_'+(dispatchers.shift)
|
80
|
+
send 'check_for_' + (dispatchers.shift)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
def check_for_torquebox
|
85
85
|
return unless defined?(::JRuby) &&
|
86
|
-
|
86
|
+
(org.torquebox::TorqueBox rescue nil)
|
87
87
|
@discovered_dispatcher = :torquebox
|
88
88
|
end
|
89
89
|
|
@@ -147,9 +147,9 @@ module NewRelic
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def check_for_resque
|
150
|
-
has_queue
|
151
|
-
resque_rake
|
152
|
-
resque_pool_rake
|
150
|
+
has_queue = ENV['QUEUE'] || ENV['QUEUES']
|
151
|
+
resque_rake = executable == 'rake' && ARGV.include?('resque:work')
|
152
|
+
resque_pool_rake = executable == 'rake' && ARGV.include?('resque:pool')
|
153
153
|
resque_pool_executable = executable == 'resque-pool' && defined?(::Resque::Pool)
|
154
154
|
|
155
155
|
using_resque = defined?(::Resque) &&
|
@@ -192,6 +192,7 @@ module NewRelic
|
|
192
192
|
end
|
193
193
|
|
194
194
|
public
|
195
|
+
|
195
196
|
# outputs a human-readable description
|
196
197
|
def to_s
|
197
198
|
s = "LocalEnvironment["
|
@@ -202,6 +203,5 @@ module NewRelic
|
|
202
203
|
def executable
|
203
204
|
File.basename($0)
|
204
205
|
end
|
205
|
-
|
206
206
|
end
|
207
207
|
end
|
@@ -18,7 +18,7 @@ module NewRelic
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def eql?(o)
|
21
|
-
|
21
|
+
(metric_spec.eql? o.metric_spec) && (stats.eql? o.stats)
|
22
22
|
end
|
23
23
|
|
24
24
|
def original_spec
|
@@ -37,7 +37,7 @@ module NewRelic
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def to_json(*a)
|
40
|
-
|
40
|
+
%Q({"metric_spec":#{metric_spec.to_json},"stats":{"total_exclusive_time":#{stats.total_exclusive_time},"min_call_time":#{stats.min_call_time},"call_count":#{stats.call_count},"sum_of_squares":#{stats.sum_of_squares},"total_call_time":#{stats.total_call_time},"max_call_time":#{stats.max_call_time}}})
|
41
41
|
end
|
42
42
|
|
43
43
|
def to_s
|
@@ -50,9 +50,9 @@ module NewRelic
|
|
50
50
|
|
51
51
|
include NewRelic::Coerce
|
52
52
|
|
53
|
-
def to_collector_array(encoder=nil)
|
54
|
-
stat_key = {
|
55
|
-
[
|
53
|
+
def to_collector_array(encoder = nil)
|
54
|
+
stat_key = {'name' => metric_spec.name, 'scope' => metric_spec.scope}
|
55
|
+
[stat_key,
|
56
56
|
[
|
57
57
|
int(stats.call_count, stat_key),
|
58
58
|
float(stats.total_call_time, stat_key),
|
@@ -60,8 +60,7 @@ module NewRelic
|
|
60
60
|
float(stats.min_call_time, stat_key),
|
61
61
|
float(stats.max_call_time, stat_key),
|
62
62
|
float(stats.sum_of_squares, stat_key)
|
63
|
-
]
|
64
|
-
]
|
63
|
+
]]
|
65
64
|
end
|
66
65
|
end
|
67
66
|
end
|
@@ -5,14 +5,14 @@
|
|
5
5
|
# this struct uniquely defines a metric, optionally inside
|
6
6
|
# the call scope of another metric
|
7
7
|
class NewRelic::MetricSpec
|
8
|
-
attr_reader
|
8
|
+
attr_reader :name, :scope
|
9
9
|
|
10
10
|
# the maximum length of a metric name or metric scope
|
11
11
|
MAX_LENGTH = 255
|
12
12
|
LENGTH_RANGE = (0...MAX_LENGTH)
|
13
13
|
EMPTY_SCOPE = ''.freeze
|
14
14
|
|
15
|
-
def initialize(metric_name='', metric_scope=nil)
|
15
|
+
def initialize(metric_name = '', metric_scope = nil)
|
16
16
|
if metric_name.to_s.length > MAX_LENGTH
|
17
17
|
@name = metric_name.to_s[LENGTH_RANGE]
|
18
18
|
else
|
@@ -53,7 +53,7 @@ class NewRelic::MetricSpec
|
|
53
53
|
|
54
54
|
def to_json(*a)
|
55
55
|
{'name' => name,
|
56
|
-
|
56
|
+
'scope' => scope}.to_json(*a)
|
57
57
|
end
|
58
58
|
|
59
59
|
def <=>(o)
|
@@ -12,11 +12,11 @@ class NewRelic::NoticedError
|
|
12
12
|
extend NewRelic::CollectionHelper
|
13
13
|
|
14
14
|
attr_accessor :path, :timestamp, :message, :exception_class_name,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
:request_uri, :request_port, :file_name, :line_number,
|
16
|
+
:stack_trace, :attributes_from_notice_error, :attributes,
|
17
|
+
:expected
|
18
18
|
|
19
|
-
attr_reader
|
19
|
+
attr_reader :exception_id, :is_internal
|
20
20
|
|
21
21
|
STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE = "Message removed by New Relic 'strip_exception_messages' setting"
|
22
22
|
UNKNOWN_ERROR_CLASS_NAME = 'Error'
|
@@ -28,9 +28,9 @@ class NewRelic::NoticedError
|
|
28
28
|
|
29
29
|
DESTINATION = NewRelic::Agent::AttributeFilter::DST_ERROR_COLLECTOR
|
30
30
|
|
31
|
-
ERROR_PREFIX_KEY
|
32
|
-
ERROR_MESSAGE_KEY
|
33
|
-
ERROR_CLASS_KEY
|
31
|
+
ERROR_PREFIX_KEY = 'error'
|
32
|
+
ERROR_MESSAGE_KEY = "#{ERROR_PREFIX_KEY}.message"
|
33
|
+
ERROR_CLASS_KEY = "#{ERROR_PREFIX_KEY}.class"
|
34
34
|
ERROR_EXPECTED_KEY = "#{ERROR_PREFIX_KEY}.expected"
|
35
35
|
|
36
36
|
def initialize(path, exception, timestamp = Process.clock_gettime(Process::CLOCK_REALTIME), expected = false)
|
@@ -51,7 +51,7 @@ class NewRelic::NoticedError
|
|
51
51
|
|
52
52
|
# replace error message if enabled
|
53
53
|
if NewRelic::Agent.config[:'strip_exception_messages.enabled'] &&
|
54
|
-
|
54
|
+
!self.class.passes_message_allowlist(exception.class)
|
55
55
|
@message = STRIPPED_EXCEPTION_REPLACEMENT_MESSAGE
|
56
56
|
end
|
57
57
|
|
@@ -77,12 +77,12 @@ class NewRelic::NoticedError
|
|
77
77
|
|
78
78
|
include NewRelic::Coerce
|
79
79
|
|
80
|
-
def to_collector_array(encoder=nil)
|
81
|
-
[
|
80
|
+
def to_collector_array(encoder = nil)
|
81
|
+
[NewRelic::Helper.time_to_millis(timestamp),
|
82
82
|
string(path),
|
83
83
|
string(message),
|
84
84
|
string(exception_class_name),
|
85
|
-
processed_attributes
|
85
|
+
processed_attributes]
|
86
86
|
end
|
87
87
|
|
88
88
|
# Note that we process attributes lazily and store the result. This is because
|
@@ -101,9 +101,9 @@ class NewRelic::NoticedError
|
|
101
101
|
|
102
102
|
def base_parameters
|
103
103
|
params = {}
|
104
|
-
params[:file_name]
|
105
|
-
params[:line_number]
|
106
|
-
params[:stack_trace]
|
104
|
+
params[:file_name] = file_name if file_name
|
105
|
+
params[:line_number] = line_number if line_number
|
106
|
+
params[:stack_trace] = stack_trace if stack_trace
|
107
107
|
params[ERROR_EXPECTED_KEY.to_sym] = expected
|
108
108
|
params
|
109
109
|
end
|
@@ -200,5 +200,4 @@ class NewRelic::NoticedError
|
|
200
200
|
@message = exception.to_s
|
201
201
|
end
|
202
202
|
end
|
203
|
-
|
204
203
|
end
|
@@ -13,10 +13,10 @@ module NewRelic
|
|
13
13
|
|
14
14
|
attr_reader :transaction_options, :category, :target
|
15
15
|
|
16
|
-
def initialize(app, options={})
|
16
|
+
def initialize(app, options = {})
|
17
17
|
@app = app
|
18
18
|
@category = :middleware
|
19
|
-
@target
|
19
|
+
@target = self
|
20
20
|
@transaction_options = {
|
21
21
|
:transaction_name => build_transaction_name
|
22
22
|
}
|
@@ -19,15 +19,15 @@ module NewRelic::Rack
|
|
19
19
|
# examine in order to look for a RUM insertion point.
|
20
20
|
SCAN_LIMIT = 50_000
|
21
21
|
|
22
|
-
CONTENT_TYPE
|
22
|
+
CONTENT_TYPE = 'Content-Type'.freeze
|
23
23
|
CONTENT_DISPOSITION = 'Content-Disposition'.freeze
|
24
|
-
CONTENT_LENGTH
|
25
|
-
ATTACHMENT
|
26
|
-
TEXT_HTML
|
24
|
+
CONTENT_LENGTH = 'Content-Length'.freeze
|
25
|
+
ATTACHMENT = 'attachment'.freeze
|
26
|
+
TEXT_HTML = 'text/html'.freeze
|
27
27
|
|
28
|
-
BODY_START
|
29
|
-
HEAD_START
|
30
|
-
GT
|
28
|
+
BODY_START = "<body".freeze
|
29
|
+
HEAD_START = "<head".freeze
|
30
|
+
GT = ">".freeze
|
31
31
|
|
32
32
|
def traced_call(env)
|
33
33
|
result = @app.call(env)
|
@@ -79,7 +79,7 @@ module NewRelic::Rack
|
|
79
79
|
env['action_controller.instance'].class.included_modules.include?(ActionController::Live)
|
80
80
|
end
|
81
81
|
|
82
|
-
CHARSET_RE
|
82
|
+
CHARSET_RE = /<\s*meta[^>]+charset\s*=[^>]*>/im.freeze
|
83
83
|
X_UA_COMPATIBLE_RE = /<\s*meta[^>]+http-equiv\s*=\s*['"]x-ua-compatible['"][^>]*>/im.freeze
|
84
84
|
|
85
85
|
def autoinstrument_source(response, headers, js_to_inject)
|
@@ -123,7 +123,7 @@ module NewRelic::Rack
|
|
123
123
|
|
124
124
|
def gather_source(response)
|
125
125
|
source = nil
|
126
|
-
response.each {|fragment| source ? (source << fragment.to_s) : (source = fragment.to_s)}
|
126
|
+
response.each { |fragment| source ? (source << fragment.to_s) : (source = fragment.to_s) }
|
127
127
|
source
|
128
128
|
end
|
129
129
|
|
@@ -5,7 +5,6 @@
|
|
5
5
|
require 'capistrano/framework'
|
6
6
|
|
7
7
|
namespace :newrelic do
|
8
|
-
|
9
8
|
# notifies New Relic of a deployment
|
10
9
|
desc "Record a deployment in New Relic (newrelic.com)"
|
11
10
|
task :notice_deployment do
|
@@ -23,15 +22,15 @@ namespace :newrelic do
|
|
23
22
|
def send_deployment_notification_to_newrelic
|
24
23
|
environment = fetch(:newrelic_rails_env, fetch(:rack_env, fetch(:rails_env, fetch(:stage, "production"))))
|
25
24
|
|
26
|
-
require 'new_relic/cli/command
|
25
|
+
require 'new_relic/cli/command'
|
27
26
|
|
28
27
|
begin
|
29
28
|
# allow overrides to be defined for revision, description, changelog, appname, and user
|
30
|
-
rev
|
29
|
+
rev = fetch(:newrelic_revision)
|
31
30
|
description = fetch(:newrelic_desc)
|
32
|
-
changelog
|
33
|
-
appname
|
34
|
-
user
|
31
|
+
changelog = fetch(:newrelic_changelog)
|
32
|
+
appname = fetch(:newrelic_appname)
|
33
|
+
user = fetch(:newrelic_user)
|
35
34
|
license_key = fetch(:newrelic_license_key)
|
36
35
|
|
37
36
|
has_scm_from_plugin = respond_to?(:scm_plugin_installed?) && scm_plugin_installed?
|
@@ -39,17 +38,17 @@ namespace :newrelic do
|
|
39
38
|
|
40
39
|
if has_scm_from_plugin || has_scm_from_config
|
41
40
|
changelog ||= lookup_changelog
|
42
|
-
rev
|
41
|
+
rev ||= fetch(:current_revision)
|
43
42
|
end
|
44
43
|
|
45
44
|
new_revision = rev
|
46
45
|
deploy_options = {
|
47
46
|
:environment => environment,
|
48
|
-
:revision
|
49
|
-
:changelog
|
47
|
+
:revision => new_revision,
|
48
|
+
:changelog => changelog,
|
50
49
|
:description => description,
|
51
|
-
:appname
|
52
|
-
:user
|
50
|
+
:appname => appname,
|
51
|
+
:user => user,
|
53
52
|
:license_key => license_key
|
54
53
|
}
|
55
54
|
|
@@ -57,7 +56,6 @@ namespace :newrelic do
|
|
57
56
|
deployment = NewRelic::Cli::Deployments.new deploy_options
|
58
57
|
deployment.run
|
59
58
|
info "Uploaded deployment information to New Relic"
|
60
|
-
|
61
59
|
rescue NewRelic::Cli::Command::CommandFailure => e
|
62
60
|
info e.message
|
63
61
|
rescue => e
|
@@ -74,7 +72,7 @@ namespace :newrelic do
|
|
74
72
|
|
75
73
|
if Rake::Task.task_defined?("git:check")
|
76
74
|
log_command = "git --no-pager log --no-color --pretty=format:' * %an: %s' " +
|
77
|
-
|
75
|
+
"--abbrev-commit --no-merges #{previous_revision}..#{current_revision}"
|
78
76
|
`#{log_command}`
|
79
77
|
end
|
80
78
|
end
|
@@ -3,38 +3,36 @@
|
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
make_notify_task = Proc.new do
|
6
|
-
|
7
6
|
namespace :newrelic do
|
8
|
-
|
9
7
|
# on all deployments, notify New Relic
|
10
8
|
desc "Record a deployment in New Relic (newrelic.com)"
|
11
|
-
task :notice_deployment, :roles => :app, :except => {:no_release => true
|
9
|
+
task :notice_deployment, :roles => :app, :except => {:no_release => true} do
|
12
10
|
rails_env = fetch(:newrelic_rails_env, fetch(:rails_env, "production"))
|
13
11
|
|
14
12
|
require 'new_relic/cli/command'
|
15
13
|
|
16
14
|
begin
|
17
15
|
# allow overrides to be defined for revision, description, changelog, appname, and user
|
18
|
-
rev
|
19
|
-
description = fetch(:newrelic_desc)
|
20
|
-
changelog
|
21
|
-
appname
|
22
|
-
user
|
16
|
+
rev = fetch(:newrelic_revision) if exists?(:newrelic_revision)
|
17
|
+
description = fetch(:newrelic_desc) if exists?(:newrelic_desc)
|
18
|
+
changelog = fetch(:newrelic_changelog) if exists?(:newrelic_changelog)
|
19
|
+
appname = fetch(:newrelic_appname) if exists?(:newrelic_appname)
|
20
|
+
user = fetch(:newrelic_user) if exists?(:newrelic_user)
|
23
21
|
license_key = fetch(:newrelic_license_key) if exists?(:newrelic_license_key)
|
24
22
|
|
25
23
|
unless scm == :none
|
26
24
|
changelog = lookup_changelog(changelog)
|
27
|
-
rev
|
25
|
+
rev = lookup_rev(rev)
|
28
26
|
end
|
29
27
|
|
30
28
|
new_revision = rev
|
31
29
|
deploy_options = {
|
32
30
|
:environment => rails_env,
|
33
|
-
:revision
|
34
|
-
:changelog
|
31
|
+
:revision => new_revision,
|
32
|
+
:changelog => changelog,
|
35
33
|
:description => description,
|
36
|
-
:appname
|
37
|
-
:user
|
34
|
+
:appname => appname,
|
35
|
+
:user => user,
|
38
36
|
:license_key => license_key
|
39
37
|
}
|
40
38
|
|
@@ -42,7 +40,6 @@ make_notify_task = Proc.new do
|
|
42
40
|
deployment = NewRelic::Cli::Deployments.new deploy_options
|
43
41
|
deployment.run
|
44
42
|
logger.info "Uploaded deployment information to New Relic"
|
45
|
-
|
46
43
|
rescue NewRelic::Cli::Command::CommandFailure => e
|
47
44
|
logger.info e.message
|
48
45
|
rescue Capistrano::CommandError
|
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
module NewRelic
|
6
6
|
module SupportabilityHelper
|
7
|
-
|
8
7
|
API_SUPPORTABILITY_PREFIX = 'Supportability/API/'.freeze
|
9
8
|
|
10
9
|
# pre-instantiate these strings as they may be used multiple times per
|
@@ -54,7 +53,7 @@ module NewRelic
|
|
54
53
|
:trace_execution_scoped,
|
55
54
|
:trace_execution_unscoped,
|
56
55
|
:wrap
|
57
|
-
].reduce({}) do |h,o|
|
56
|
+
].reduce({}) do |h, o|
|
58
57
|
h[o] = API_SUPPORTABILITY_PREFIX + o.to_s
|
59
58
|
h
|
60
59
|
end
|
data/lib/new_relic/version.rb
CHANGED
@@ -3,23 +3,12 @@
|
|
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
|
-
|
7
6
|
module NewRelic
|
8
|
-
module VERSION
|
9
|
-
def self.build_version_string(*parts)
|
10
|
-
parts.compact.join('.')
|
11
|
-
end
|
12
|
-
|
7
|
+
module VERSION # :nodoc:
|
13
8
|
MAJOR = 8
|
14
|
-
MINOR =
|
15
|
-
TINY
|
16
|
-
|
17
|
-
begin
|
18
|
-
require File.join(File.dirname(__FILE__), 'build')
|
19
|
-
rescue LoadError
|
20
|
-
BUILD = nil
|
21
|
-
end
|
9
|
+
MINOR = 5
|
10
|
+
TINY = 0
|
22
11
|
|
23
|
-
STRING =
|
12
|
+
STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
|
24
13
|
end
|
25
14
|
end
|
@@ -3,13 +3,12 @@
|
|
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 'sequel' unless defined?(
|
7
|
-
require 'newrelic_rpm' unless defined?(
|
6
|
+
require 'sequel' unless defined?(Sequel)
|
7
|
+
require 'newrelic_rpm' unless defined?(NewRelic)
|
8
8
|
require 'new_relic/agent/instrumentation/sequel_helper'
|
9
9
|
require 'new_relic/agent/datastores/metric_helper'
|
10
10
|
|
11
11
|
module Sequel
|
12
|
-
|
13
12
|
# New Relic's Sequel instrumentation is implemented via a plugin for
|
14
13
|
# Sequel::Models, and an extension for Sequel::Databases. Every database
|
15
14
|
# handle that Sequel knows about when New Relic is loaded will automatically
|
@@ -31,7 +30,6 @@ module Sequel
|
|
31
30
|
# `disable_activerecord_instrumentation` setting.
|
32
31
|
#
|
33
32
|
module NewRelicInstrumentation
|
34
|
-
|
35
33
|
module Naming
|
36
34
|
def self.query_method_name
|
37
35
|
if Sequel::VERSION >= "4.35.0"
|
@@ -42,7 +40,7 @@ module Sequel
|
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
|
-
define_method Naming.query_method_name do |*args, &blk| #THREAD_LOCAL_ACCESS
|
43
|
+
define_method Naming.query_method_name do |*args, &blk| # THREAD_LOCAL_ACCESS
|
46
44
|
sql = args.first
|
47
45
|
|
48
46
|
product = NewRelic::Agent::Instrumentation::SequelHelper.product_name_from_adapter(self.class.adapter_scheme)
|
@@ -86,7 +84,7 @@ module Sequel
|
|
86
84
|
def explainer_for sql
|
87
85
|
Proc.new do |*|
|
88
86
|
if THREAD_SAFE_CONNECTION_POOL_CLASSES.include?(self.pool.class)
|
89
|
-
self[
|
87
|
+
self[sql].explain
|
90
88
|
else
|
91
89
|
NewRelic::Agent.logger.log_once(:info, :sequel_explain_skipped, "Not running SQL explains because Sequel is not in recognized multi-threaded mode")
|
92
90
|
nil
|
@@ -97,5 +95,4 @@ module Sequel
|
|
97
95
|
|
98
96
|
NewRelic::Agent.logger.debug "Registering the :newrelic_instrumentation extension."
|
99
97
|
Database.register_extension(:newrelic_instrumentation, NewRelicInstrumentation)
|
100
|
-
|
101
98
|
end # module Sequel
|
@@ -3,23 +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 'sequel' unless defined?(
|
7
|
-
require 'newrelic_rpm' unless defined?(
|
6
|
+
require 'sequel' unless defined?(Sequel)
|
7
|
+
require 'newrelic_rpm' unless defined?(NewRelic)
|
8
8
|
require 'new_relic/agent/instrumentation/sequel_helper'
|
9
9
|
require 'new_relic/agent/datastores/metric_helper'
|
10
10
|
|
11
11
|
module Sequel
|
12
12
|
module Plugins
|
13
|
-
|
14
13
|
# Sequel::Model instrumentation for the New Relic agent.
|
15
14
|
module NewrelicInstrumentation
|
16
|
-
|
17
15
|
# Meta-programming for creating method tracers for the Sequel::Model plugin.
|
18
16
|
module MethodWrapping
|
19
17
|
# Install a method named +method_name+ that will trace execution
|
20
18
|
# with a metric name derived from +operation_name+ (or +method_name+ if +operation_name+
|
21
19
|
# isn't specified).
|
22
|
-
def wrap_sequel_method(method_name, operation_name=method_name)
|
20
|
+
def wrap_sequel_method(method_name, operation_name = method_name)
|
23
21
|
define_method(method_name) do |*args, &block|
|
24
22
|
klass = self.is_a?(Class) ? self : self.class
|
25
23
|
product = NewRelic::Agent::Instrumentation::SequelHelper.product_name_from_adapter(db.adapter_scheme)
|
@@ -36,7 +34,6 @@ module Sequel
|
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
39
|
-
|
40
37
|
end # module MethodTracer
|
41
38
|
|
42
39
|
# Methods to be added to Sequel::Model instances.
|
@@ -51,10 +48,8 @@ module Sequel
|
|
51
48
|
wrap_sequel_method :update_fields
|
52
49
|
wrap_sequel_method :update_only
|
53
50
|
wrap_sequel_method :save
|
54
|
-
|
55
51
|
end # module InstanceMethods
|
56
52
|
|
57
|
-
|
58
53
|
# Methods to be added to Sequel::Model classes.
|
59
54
|
module ClassMethods
|
60
55
|
extend Sequel::Plugins::NewrelicInstrumentation::MethodWrapping
|
@@ -64,7 +59,6 @@ module Sequel
|
|
64
59
|
wrap_sequel_method :first
|
65
60
|
wrap_sequel_method :create
|
66
61
|
end # module ClassMethods
|
67
|
-
|
68
62
|
end # module NewRelicInstrumentation
|
69
63
|
end # module Plugins
|
70
64
|
end # module Sequel
|
data/lib/tasks/all.rb
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
|
4
4
|
|
5
5
|
# This is required to load in task definitions
|
6
|
-
Dir.glob(File.join(File.dirname(__FILE__),'*.rake')) do |file|
|
6
|
+
Dir.glob(File.join(File.dirname(__FILE__), '*.rake')) do |file|
|
7
7
|
load file
|
8
8
|
end
|
data/lib/tasks/config.rake
CHANGED
@@ -2,22 +2,22 @@ namespace :newrelic do
|
|
2
2
|
namespace :config do
|
3
3
|
desc "Describe available New Relic configuration settings."
|
4
4
|
|
5
|
-
GENERAL
|
6
|
-
DISABLING
|
5
|
+
GENERAL = "general"
|
6
|
+
DISABLING = "disabling"
|
7
7
|
ATTRIBUTES = "attributes"
|
8
8
|
|
9
9
|
SECTION_DESCRIPTIONS = {
|
10
|
-
GENERAL
|
11
|
-
DISABLING
|
12
|
-
ATTRIBUTES
|
10
|
+
GENERAL => 'These settings are available for agent configuration. Some settings depend on your New Relic subscription level.',
|
11
|
+
DISABLING => 'Use these settings to toggle instrumentation types during agent startup.',
|
12
|
+
ATTRIBUTES => '[Attributes](/docs/features/agent-attributes) are key-value pairs containing information that determines the properties of an event or transaction. These key-value pairs can be viewed within transaction traces in APM, traced errors in APM, transaction events in dashboards, and page views in dashboards. You can customize exactly which attributes will be sent to each of these destinations',
|
13
13
|
"transaction_tracer" => 'The [transaction traces](/docs/apm/traces/transaction-traces/transaction-traces) feature collects detailed information from a selection of transactions, including a summary of the calling sequence, a breakdown of time spent, and a list of SQL queries and their query plans (on mysql and postgresql). Available features depend on your New Relic subscription level.',
|
14
|
-
"error_collector"
|
14
|
+
"error_collector" => 'The agent collects and reports all uncaught exceptions by default. These configuration options allow you to customize the error collection.',
|
15
15
|
"browser_monitoring" => 'The Browser monitoring [page load timing](/docs/browser/new-relic-browser/page-load-timing/page-load-timing-process) feature (sometimes referred to as real user monitoring or RUM) gives you insight into the performance real users are experiencing with your website. This is accomplished by measuring the time it takes for your users\' browsers to download and render your web pages by injecting a small amount of JavaScript code into the header and footer of each page.',
|
16
|
-
"analytics_events"
|
16
|
+
"analytics_events" => '[New Relic dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-new-relic-one-dashboards) is a resource to gather and visualize data about your software and what it says about your business. With it you can quickly and easily create real-time dashboards to get immediate answers about end-user experiences, clickstreams, mobile activities, and server transactions.'
|
17
17
|
}
|
18
18
|
|
19
19
|
NAME_OVERRIDES = {
|
20
|
-
"slow_sql"
|
20
|
+
"slow_sql" => "Slow SQL"
|
21
21
|
}
|
22
22
|
|
23
23
|
def output(format)
|
@@ -29,7 +29,7 @@ namespace :newrelic do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def build_config_hash
|
32
|
-
sections = Hash.new {|hash, key| hash[key] = []}
|
32
|
+
sections = Hash.new { |hash, key| hash[key] = [] }
|
33
33
|
NewRelic::Agent::Configuration::DEFAULTS.each do |key, value|
|
34
34
|
next unless value[:public]
|
35
35
|
|
@@ -37,20 +37,20 @@ namespace :newrelic do
|
|
37
37
|
key = key.to_s
|
38
38
|
components = key.split(".")
|
39
39
|
|
40
|
-
if key.match(/^disable_/)
|
40
|
+
if key.match(/^disable_/) # "disable_httpclient"
|
41
41
|
section_key = DISABLING
|
42
|
-
elsif components.length == 2
|
42
|
+
elsif components.length == 2 # "analytics_events.enabled"
|
43
43
|
section_key = components.first
|
44
44
|
elsif components[1] == "attributes" # "transaction_tracer.attributes.enabled"
|
45
45
|
section_key = ATTRIBUTES
|
46
46
|
end
|
47
47
|
|
48
48
|
sections[section_key] << {
|
49
|
-
:key
|
50
|
-
:type
|
49
|
+
:key => key,
|
50
|
+
:type => format_type(value[:type]),
|
51
51
|
:description => format_description(value),
|
52
|
-
:default
|
53
|
-
:env_var
|
52
|
+
:default => format_default_value(value),
|
53
|
+
:env_var => format_env_var(key)
|
54
54
|
}
|
55
55
|
end
|
56
56
|
sections
|
@@ -60,10 +60,10 @@ namespace :newrelic do
|
|
60
60
|
sections = []
|
61
61
|
sections << pluck(GENERAL, config_hash)
|
62
62
|
sections << pluck("transaction_tracer", config_hash)
|
63
|
-
sections << pluck("error_collector",
|
63
|
+
sections << pluck("error_collector", config_hash)
|
64
64
|
sections << pluck("browser_monitoring", config_hash)
|
65
|
-
sections << pluck("analytics_events",
|
66
|
-
sections.concat(config_hash.to_a.sort_by { |a| a.first})
|
65
|
+
sections << pluck("analytics_events", config_hash)
|
66
|
+
sections.concat(config_hash.to_a.sort_by { |a| a.first })
|
67
67
|
|
68
68
|
add_data_to_sections(sections)
|
69
69
|
|
@@ -82,9 +82,9 @@ namespace :newrelic do
|
|
82
82
|
name = NAME_OVERRIDES[key]
|
83
83
|
return name if name
|
84
84
|
|
85
|
-
key.split("_")
|
86
|
-
|
87
|
-
|
85
|
+
key.split("_")
|
86
|
+
.each { |fragment| fragment[0] = fragment[0].upcase }
|
87
|
+
.join(" ")
|
88
88
|
end
|
89
89
|
|
90
90
|
def format_type(type)
|
data/lib/tasks/multiverse.rb
CHANGED
@@ -42,10 +42,9 @@ namespace :test do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
namespace :multiverse do
|
45
|
-
|
46
45
|
def remove_local_multiverse_databases
|
47
|
-
list_databases_command = %
|
48
|
-
databases = `#{list_databases_command}`.chomp!.split("\n").select{|s| s =~ /multiverse/}
|
46
|
+
list_databases_command = %(echo "show databases" | mysql -u root)
|
47
|
+
databases = `#{list_databases_command}`.chomp!.split("\n").select { |s| s =~ /multiverse/ }
|
49
48
|
databases.each do |database|
|
50
49
|
puts "Dropping #{database}"
|
51
50
|
`echo "drop database #{database}" | mysql -u root`
|
@@ -58,7 +57,7 @@ namespace :test do
|
|
58
57
|
def remove_generated_gemfiles
|
59
58
|
file_path = File.expand_path "test/multiverse/suites"
|
60
59
|
Dir.glob(File.join file_path, "**", "Gemfile*").each do |fn|
|
61
|
-
puts "Removing #{fn.gsub(file_path,'.../suites')}"
|
60
|
+
puts "Removing #{fn.gsub(file_path, '.../suites')}"
|
62
61
|
FileUtils.rm fn
|
63
62
|
end
|
64
63
|
end
|
@@ -66,7 +65,7 @@ namespace :test do
|
|
66
65
|
def remove_generated_gemfile_lockfiles
|
67
66
|
file_path = File.expand_path "test/environments"
|
68
67
|
Dir.glob(File.join file_path, "**", "Gemfile.lock").each do |fn|
|
69
|
-
puts "Removing #{fn.gsub(file_path,'.../environments')}"
|
68
|
+
puts "Removing #{fn.gsub(file_path, '.../environments')}"
|
70
69
|
FileUtils.rm fn
|
71
70
|
end
|
72
71
|
end
|
@@ -99,6 +98,5 @@ namespace :test do
|
|
99
98
|
task :prime, [:suite] => [:env] do |_, args|
|
100
99
|
Multiverse::Runner.prime(args.suite, Multiverse::Runner.parse_args(args))
|
101
100
|
end
|
102
|
-
|
103
101
|
end
|
104
102
|
end
|