wd_newrelic_rpm 3.3.4.1 → 3.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/.project +23 -0
- data/.travis.yml +9 -0
- data/CHANGELOG +317 -39
- data/GUIDELINES_FOR_CONTRIBUTING.md +76 -0
- data/Gemfile +16 -0
- data/LICENSE +1 -1
- data/{README.rdoc → README.md} +71 -55
- data/Rakefile +62 -0
- data/bin/mongrel_rpm +1 -1
- data/config.dot +290 -0
- data/config/database.yml +5 -0
- data/init.rb +31 -0
- data/lib/new_relic/agent.rb +31 -60
- data/lib/new_relic/agent/agent.rb +277 -502
- data/lib/new_relic/agent/agent_logger.rb +165 -0
- data/lib/new_relic/agent/audit_logger.rb +72 -0
- data/lib/new_relic/agent/beacon_configuration.rb +36 -50
- data/lib/new_relic/agent/browser_monitoring.rb +114 -61
- data/lib/new_relic/agent/busy_calculator.rb +14 -6
- data/lib/new_relic/agent/configuration.rb +74 -0
- data/lib/new_relic/agent/configuration/defaults.rb +126 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +49 -0
- data/lib/new_relic/agent/configuration/manager.rb +136 -0
- data/lib/new_relic/agent/configuration/mask_defaults.rb +10 -0
- data/lib/new_relic/agent/configuration/server_source.rb +27 -0
- data/lib/new_relic/agent/configuration/yaml_source.rb +63 -0
- data/lib/new_relic/agent/cross_process_monitoring.rb +43 -0
- data/lib/new_relic/agent/database.rb +39 -26
- data/lib/new_relic/agent/error_collector.rb +48 -49
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +1 -1
- data/lib/new_relic/agent/instrumentation/active_record.rb +4 -7
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +1 -1
- data/lib/new_relic/agent/instrumentation/authlogic.rb +1 -1
- data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +41 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +35 -12
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +4 -12
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +6 -6
- 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/metric_frame.rb +4 -14
- data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +1 -1
- data/lib/new_relic/agent/instrumentation/net.rb +1 -1
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +6 -20
- data/lib/new_relic/agent/instrumentation/queue_time.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rack.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +7 -7
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +1 -1
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +5 -5
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +6 -2
- data/lib/new_relic/agent/instrumentation/resque.rb +81 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +21 -10
- data/lib/new_relic/agent/instrumentation/sunspot.rb +1 -1
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +5 -4
- data/lib/new_relic/agent/method_tracer.rb +11 -9
- data/lib/new_relic/agent/new_relic_service.rb +379 -0
- data/lib/new_relic/agent/pipe_channel_manager.rb +175 -0
- data/lib/new_relic/agent/pipe_service.rb +58 -0
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +86 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +6 -8
- data/lib/new_relic/agent/sql_sampler.rb +31 -74
- data/lib/new_relic/agent/stats_engine.rb +0 -5
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +40 -24
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +89 -14
- data/lib/new_relic/agent/stats_engine/samplers.rb +9 -7
- data/lib/new_relic/agent/stats_engine/transactions.rb +20 -12
- data/lib/new_relic/agent/thread.rb +32 -0
- data/lib/new_relic/agent/thread_profiler.rb +306 -0
- data/lib/new_relic/agent/transaction_info.rb +24 -4
- data/lib/new_relic/agent/transaction_sample_builder.rb +12 -13
- data/lib/new_relic/agent/transaction_sampler.rb +49 -65
- data/lib/new_relic/agent/worker_loop.rb +31 -25
- data/lib/new_relic/collection_helper.rb +1 -1
- data/lib/new_relic/commands/deployments.rb +19 -10
- data/lib/new_relic/control.rb +1 -3
- data/lib/new_relic/control/class_methods.rb +10 -5
- data/lib/new_relic/control/frameworks/merb.rb +0 -6
- data/lib/new_relic/control/frameworks/rails.rb +30 -45
- data/lib/new_relic/control/frameworks/rails3.rb +23 -18
- data/lib/new_relic/control/frameworks/rails4.rb +23 -0
- data/lib/new_relic/control/frameworks/ruby.rb +2 -23
- data/lib/new_relic/control/instance_methods.rb +35 -73
- data/lib/new_relic/control/instrumentation.rb +7 -12
- data/lib/new_relic/control/server_methods.rb +17 -19
- data/lib/new_relic/delayed_job_injection.rb +2 -2
- data/lib/new_relic/helper.rb +34 -0
- data/lib/new_relic/language_support.rb +56 -37
- data/lib/new_relic/local_environment.rb +32 -67
- data/lib/new_relic/metric_data.rb +10 -2
- data/lib/new_relic/metric_spec.rb +7 -3
- data/lib/new_relic/noticed_error.rb +32 -9
- data/lib/new_relic/rack.rb +4 -0
- data/lib/new_relic/rack/browser_monitoring.rb +34 -25
- data/lib/new_relic/rack/developer_mode.rb +3 -0
- data/lib/new_relic/rack/error_collector.rb +56 -0
- data/lib/new_relic/stats.rb +9 -7
- data/lib/new_relic/transaction_sample.rb +19 -18
- data/lib/new_relic/transaction_sample/segment.rb +13 -15
- data/lib/new_relic/version.rb +19 -3
- data/lib/newrelic_rpm.rb +1 -1
- data/lib/tasks/tests.rake +6 -8
- data/newrelic.yml +15 -32
- data/newrelic_rpm.gemspec +224 -43
- data/newrelic_rpm.gemspec.erb +54 -0
- data/test/config/newrelic.yml +4 -3
- data/test/config/test_control.rb +18 -18
- data/test/fixtures/gemspec_no_build.rb +442 -0
- data/test/fixtures/gemspec_with_build.rb +442 -0
- data/test/fixtures/gemspec_with_build_and_stage.rb +442 -0
- data/test/intentional_fail.rb +10 -0
- data/test/multiverse/.gitignore +10 -0
- data/test/multiverse/README.md +85 -0
- data/test/multiverse/lib/multiverse/color.rb +13 -0
- data/test/multiverse/lib/multiverse/envfile.rb +66 -0
- data/test/multiverse/lib/multiverse/environment.rb +16 -0
- data/test/multiverse/lib/multiverse/output_collector.rb +29 -0
- data/test/multiverse/lib/multiverse/runner.rb +44 -0
- data/test/multiverse/lib/multiverse/suite.rb +162 -0
- data/test/multiverse/script/run_one +3 -0
- data/test/multiverse/script/runner +9 -0
- data/test/multiverse/suites/active_record/Envfile +13 -0
- data/test/multiverse/suites/active_record/ar_method_aliasing.rb +94 -0
- data/test/multiverse/suites/active_record/config/newrelic.yml +22 -0
- data/test/multiverse/suites/active_record/encoding_test.rb +26 -0
- data/test/multiverse/suites/agent_only/Envfile +4 -0
- data/test/multiverse/suites/agent_only/audit_log_test.rb +99 -0
- data/test/multiverse/suites/agent_only/config/newrelic.yml +22 -0
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +53 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +109 -0
- data/test/multiverse/suites/agent_only/method_visibility_test.rb +98 -0
- data/test/multiverse/suites/agent_only/pipe_manager_test.rb +33 -0
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +29 -0
- data/test/multiverse/suites/agent_only/test_trace_method_with_punctuation.rb +30 -0
- data/test/multiverse/suites/agent_only/test_trace_transaction_with_punctuation.rb +32 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +80 -0
- data/test/multiverse/suites/config_file_loading/Envfile +7 -0
- data/test/multiverse/suites/config_file_loading/config_file_loading_test.rb +106 -0
- data/test/multiverse/suites/datamapper/Envfile +8 -0
- data/test/multiverse/suites/datamapper/config/newrelic.yml +22 -0
- data/test/multiverse/suites/datamapper/encoding_test.rb +36 -0
- data/test/multiverse/suites/logging/Envfile +4 -0
- data/test/multiverse/suites/logging/config/newrelic.yml +22 -0
- data/test/multiverse/suites/logging/logging_test.rb +143 -0
- data/test/multiverse/suites/monitor_mode_false/Envfile +2 -0
- data/test/multiverse/suites/monitor_mode_false/config/newrelic.yml +25 -0
- data/test/multiverse/suites/monitor_mode_false/no_dns_resolv.rb +29 -0
- data/test/multiverse/suites/no_load/Envfile +2 -0
- data/test/multiverse/suites/no_load/config/newrelic.yml +22 -0
- data/test/multiverse/suites/no_load/start_up_test.rb +14 -0
- data/test/multiverse/suites/rails_3_error_tracing/Envfile +15 -0
- data/test/multiverse/suites/rails_3_error_tracing/config/newrelic.yml +165 -0
- data/test/multiverse/suites/rails_3_error_tracing/error_tracing_test.rb +236 -0
- data/test/multiverse/suites/rails_3_gc/Envfile +8 -0
- data/test/multiverse/suites/rails_3_gc/config/newrelic.yml +167 -0
- data/test/multiverse/suites/rails_3_gc/instrumentation_test.rb +92 -0
- data/test/multiverse/suites/rails_3_queue_time/Envfile +15 -0
- data/test/multiverse/suites/rails_3_queue_time/config/newrelic.yml +165 -0
- data/test/multiverse/suites/rails_3_queue_time/queue_time_test.rb +75 -0
- data/test/multiverse/suites/rails_3_views/.gitignore +3 -0
- data/test/multiverse/suites/rails_3_views/Envfile +16 -0
- data/test/multiverse/suites/rails_3_views/app/views/foos/_foo.html.haml +1 -0
- data/test/multiverse/suites/rails_3_views/app/views/test/_a_partial.html.erb +1 -0
- data/test/multiverse/suites/rails_3_views/app/views/test/_mid_partial.html.erb +1 -0
- data/test/multiverse/suites/rails_3_views/app/views/test/_top_partial.html.erb +3 -0
- data/test/multiverse/suites/rails_3_views/app/views/test/deep_partial.html.erb +3 -0
- data/test/multiverse/suites/rails_3_views/app/views/test/haml_view.html.haml +6 -0
- data/test/multiverse/suites/rails_3_views/app/views/test/index.html.erb +4 -0
- data/test/multiverse/suites/rails_3_views/config/newrelic.yml +164 -0
- data/test/multiverse/suites/rails_3_views/view_instrumentation_test.rb +245 -0
- data/test/multiverse/suites/resque/Envfile +21 -0
- data/test/multiverse/suites/resque/config/newrelic.yml +22 -0
- data/test/multiverse/suites/resque/dump.rdb +0 -0
- data/test/multiverse/suites/resque/instrumentation_test.rb +73 -0
- data/test/multiverse/suites/rum_auto_instrumentation/Envfile +4 -0
- data/test/multiverse/suites/rum_auto_instrumentation/config/newrelic.yml +24 -0
- data/test/multiverse/suites/rum_auto_instrumentation/responses/worst_case_small.html +5000 -0
- data/test/multiverse/suites/rum_auto_instrumentation/sanity_test.rb +102 -0
- data/test/multiverse/suites/sinatra/Envfile +13 -0
- data/test/multiverse/suites/sinatra/config/newrelic.yml +24 -0
- data/test/multiverse/suites/sinatra/sinatra_metric_explosion_test.rb +77 -0
- data/test/multiverse/suites/sinatra/sinatra_routes_test.rb +46 -0
- data/test/multiverse/suites/sinatra/sinatra_test.rb +55 -0
- data/test/multiverse/test/multiverse_test.rb +55 -0
- data/test/multiverse/test/suite_examples/one/a/Envfile +3 -0
- data/test/multiverse/test/suite_examples/one/a/a_test.rb +11 -0
- data/test/multiverse/test/suite_examples/one/a/config/newrelic.yml +24 -0
- data/test/multiverse/test/suite_examples/one/b/Envfile +3 -0
- data/test/multiverse/test/suite_examples/one/b/b_test.rb +11 -0
- data/test/multiverse/test/suite_examples/one/b/config/newrelic.yml +24 -0
- data/test/multiverse/test/suite_examples/three/a/Envfile +2 -0
- data/test/multiverse/test/suite_examples/three/a/fail_test.rb +6 -0
- data/test/multiverse/test/suite_examples/three/b/Envfile +2 -0
- data/test/multiverse/test/suite_examples/three/b/win_test.rb +6 -0
- data/test/multiverse/test/suite_examples/two/a/Envfile +1 -0
- data/test/multiverse/test/suite_examples/two/a/fail_test.rb +6 -0
- data/test/new_relic/agent/agent/connect_test.rb +151 -227
- data/test/new_relic/agent/agent/start_test.rb +68 -118
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +12 -74
- data/test/new_relic/agent/agent_logger_test.rb +153 -0
- data/test/new_relic/agent/agent_test.rb +116 -30
- data/test/new_relic/agent/agent_test_controller.rb +1 -1
- data/test/new_relic/agent/agent_test_controller_test.rb +42 -10
- data/test/new_relic/agent/audit_logger_test.rb +105 -0
- data/test/new_relic/agent/beacon_configuration_test.rb +63 -67
- data/test/new_relic/agent/browser_monitoring_test.rb +151 -79
- data/test/new_relic/agent/busy_calculator_test.rb +7 -0
- data/test/new_relic/agent/configuration/environment_source_test.rb +79 -0
- data/test/new_relic/agent/configuration/manager_test.rb +204 -0
- data/test/new_relic/agent/configuration/server_source_test.rb +45 -0
- data/test/new_relic/agent/configuration/yaml_source_test.rb +75 -0
- data/test/new_relic/agent/cross_process_monitoring_test.rb +77 -0
- data/test/new_relic/agent/database_test.rb +12 -11
- data/test/new_relic/agent/error_collector/notice_error_test.rb +64 -53
- data/test/new_relic/agent/error_collector_test.rb +33 -19
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +60 -30
- data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +39 -0
- data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +1 -1
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +6 -0
- data/test/new_relic/agent/instrumentation/queue_time_test.rb +14 -0
- data/test/new_relic/agent/instrumentation/sinatra_test.rb +25 -0
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +2 -2
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +4 -10
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +3 -15
- data/test/new_relic/agent/method_tracer_test.rb +7 -6
- data/test/new_relic/agent/mock_scope_listener.rb +3 -0
- data/test/new_relic/agent/new_relic_service_test.rb +376 -0
- data/test/new_relic/agent/pipe_channel_manager_test.rb +131 -0
- data/test/new_relic/agent/pipe_service_test.rb +113 -0
- data/test/new_relic/agent/rpm_agent_test.rb +27 -50
- data/test/new_relic/agent/sql_sampler_test.rb +81 -56
- data/test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb +3 -20
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +12 -1
- data/test/new_relic/agent/stats_engine_test.rb +17 -8
- data/test/new_relic/agent/thread_profiler_test.rb +537 -0
- data/test/new_relic/agent/thread_test.rb +89 -0
- data/test/new_relic/agent/threaded_test.rb +65 -0
- data/test/new_relic/agent/transaction_info_test.rb +45 -4
- data/test/new_relic/agent/transaction_sample_builder_test.rb +8 -7
- data/test/new_relic/agent/transaction_sampler_test.rb +193 -204
- data/test/new_relic/agent/worker_loop_test.rb +26 -11
- data/test/new_relic/agent_test.rb +113 -33
- data/test/new_relic/collection_helper_test.rb +7 -8
- data/test/new_relic/command/deployments_test.rb +18 -2
- data/test/new_relic/control/class_methods_test.rb +0 -18
- data/test/new_relic/control/frameworks/rails_test.rb +26 -0
- data/test/new_relic/control_test.rb +96 -137
- data/test/new_relic/delayed_job_injection_test.rb +6 -1
- data/test/new_relic/dispatcher_test.rb +54 -0
- data/test/new_relic/fake_collector.rb +283 -0
- data/test/new_relic/fake_service.rb +53 -0
- data/test/new_relic/fakes_sending_data.rb +30 -0
- data/test/new_relic/framework_test.rb +53 -0
- data/test/new_relic/load_test.rb +13 -0
- data/test/new_relic/local_environment_test.rb +11 -11
- data/test/new_relic/metric_data_test.rb +45 -16
- data/test/new_relic/noticed_error_test.rb +24 -0
- data/test/new_relic/rack/browser_monitoring_test.rb +20 -10
- data/test/new_relic/rack/developer_mode_test.rb +13 -7
- data/test/new_relic/rack/error_collector_test.rb +74 -0
- data/test/new_relic/stats_test.rb +10 -0
- data/test/new_relic/transaction_sample/segment_test.rb +23 -4
- data/test/new_relic/transaction_sample_test.rb +47 -2
- data/test/new_relic/version_number_test.rb +32 -0
- data/test/script/build_test_gem.sh +9 -3
- data/test/script/ci.sh +108 -35
- data/test/script/ci_agent-tests_runner.sh +82 -0
- data/test/script/ci_multiverse_runner.sh +63 -0
- data/test/test_contexts.rb +1 -0
- data/test/test_helper.rb +68 -18
- data/ui/helpers/developer_mode_helper.rb +21 -11
- data/ui/views/layouts/newrelic_default.rhtml +1 -0
- data/ui/views/newrelic/file/images/arrow-close.png +0 -0
- data/ui/views/newrelic/file/images/arrow-open.png +0 -0
- data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/file/images/file_icon.png +0 -0
- data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
- data/ui/views/newrelic/show_sample.rhtml +1 -1
- data/ui/views/newrelic/threads.rhtml +2 -10
- data/vendor/gems/metric_parser-0.1.0.pre1/.specification +116 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_init.rb +7 -0
- metadata +191 -65
- data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +0 -40
- data/lib/new_relic/control/configuration.rb +0 -206
- data/lib/new_relic/control/logging_methods.rb +0 -143
- data/lib/new_relic/data_serialization.rb +0 -151
- data/test/new_relic/control/configuration_test.rb +0 -84
- data/test/new_relic/control/logging_methods_test.rb +0 -185
- data/test/new_relic/data_serialization_test.rb +0 -208
@@ -18,7 +18,8 @@ module NewRelic
|
|
18
18
|
end
|
19
19
|
|
20
20
|
sql, name, binds = args
|
21
|
-
metric = metric_for_name(name) ||
|
21
|
+
metric = metric_for_name(NewRelic::Helper.correctly_encoded(name)) ||
|
22
|
+
metric_for_sql(NewRelic::Helper.correctly_encoded(sql))
|
22
23
|
|
23
24
|
if !metric
|
24
25
|
log_without_newrelic_instrumentation(*args, &block)
|
@@ -99,15 +100,11 @@ DependencyDetection.defer do
|
|
99
100
|
end
|
100
101
|
|
101
102
|
depends_on do
|
102
|
-
!NewRelic::
|
103
|
-
end
|
104
|
-
|
105
|
-
depends_on do
|
106
|
-
!NewRelic::Control.instance['disable_activerecord_instrumentation']
|
103
|
+
!NewRelic::Agent.config[:disable_activerecord_instrumentation]
|
107
104
|
end
|
108
105
|
|
109
106
|
executes do
|
110
|
-
NewRelic::Agent.logger.
|
107
|
+
::NewRelic::Agent.logger.info 'Installing ActiveRecord instrumentation'
|
111
108
|
end
|
112
109
|
|
113
110
|
executes do
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
module Instrumentation
|
4
|
+
class BrowserMonitoringTimings
|
5
|
+
|
6
|
+
def initialize(queue_time_in_seconds, transaction)
|
7
|
+
if transaction.nil?
|
8
|
+
@start_time_in_seconds = 0.0
|
9
|
+
else
|
10
|
+
@transaction_name = transaction.transaction_name
|
11
|
+
@start_time_in_seconds = transaction.start_time
|
12
|
+
end
|
13
|
+
|
14
|
+
@queue_time_in_seconds = queue_time_in_seconds
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :transaction_name
|
18
|
+
|
19
|
+
def start_time_in_millis
|
20
|
+
convert_to_milliseconds(@start_time_in_seconds)
|
21
|
+
end
|
22
|
+
|
23
|
+
def queue_time_in_millis
|
24
|
+
convert_to_milliseconds(@queue_time_in_seconds)
|
25
|
+
end
|
26
|
+
|
27
|
+
def app_time_in_millis
|
28
|
+
convert_to_milliseconds(Time.now - @start_time_in_seconds)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def convert_to_milliseconds(value)
|
34
|
+
value = (value.to_f * 1000.0).round
|
35
|
+
return 0.0 if value < 0
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -26,6 +26,7 @@ module NewRelic
|
|
26
26
|
module ClassMethodsShim # :nodoc:
|
27
27
|
def newrelic_ignore(*args); end
|
28
28
|
def newrelic_ignore_apdex(*args); end
|
29
|
+
def newrelic_ignore_enduser(*args); end
|
29
30
|
end
|
30
31
|
|
31
32
|
module Shim # :nodoc:
|
@@ -51,11 +52,15 @@ module NewRelic
|
|
51
52
|
newrelic_ignore_aspect('ignore_apdex', specifiers)
|
52
53
|
end
|
53
54
|
|
55
|
+
def newrelic_ignore_enduser(specifiers={})
|
56
|
+
newrelic_ignore_aspect('ignore_enduser', specifiers)
|
57
|
+
end
|
58
|
+
|
54
59
|
def newrelic_ignore_aspect(property, specifiers={}) # :nodoc:
|
55
60
|
if specifiers.empty?
|
56
61
|
self.newrelic_write_attr property, true
|
57
62
|
elsif ! (Hash === specifiers)
|
58
|
-
logger.error "newrelic_#{property} takes an optional hash with :only and :except lists of actions (illegal argument type '#{specifiers.class}')"
|
63
|
+
::NewRelic::Agent.logger.error "newrelic_#{property} takes an optional hash with :only and :except lists of actions (illegal argument type '#{specifiers.class}')"
|
59
64
|
else
|
60
65
|
self.newrelic_write_attr property, specifiers
|
61
66
|
end
|
@@ -138,16 +143,23 @@ module NewRelic
|
|
138
143
|
end
|
139
144
|
options_arg << %Q[:#{key} => #{valuestr}]
|
140
145
|
end
|
146
|
+
traced_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
|
147
|
+
visibility = NewRelic::Helper.instance_method_visibility self, method
|
148
|
+
|
141
149
|
class_eval <<-EOC
|
142
|
-
def #{
|
150
|
+
def #{traced_method.to_s}_with_newrelic_transaction_trace#{punctuation}(*args, &block)
|
143
151
|
perform_action_with_newrelic_trace(#{options_arg.join(',')}) do
|
144
|
-
#{
|
152
|
+
#{traced_method.to_s}_without_newrelic_transaction_trace#{punctuation}(*args, &block)
|
145
153
|
end
|
146
154
|
end
|
147
155
|
EOC
|
148
|
-
|
149
|
-
|
150
|
-
|
156
|
+
without_method_name = "#{traced_method.to_s}_without_newrelic_transaction_trace#{punctuation}"
|
157
|
+
with_method_name = "#{traced_method.to_s}_with_newrelic_transaction_trace#{punctuation}"
|
158
|
+
alias_method without_method_name, method.to_s
|
159
|
+
alias_method method.to_s, with_method_name
|
160
|
+
send visibility, method
|
161
|
+
send visibility, with_method_name
|
162
|
+
::NewRelic::Agent.logger.debug("Traced transaction: class = #{self.name}, method = #{method.to_s}, options = #{options.inspect}")
|
151
163
|
end
|
152
164
|
end
|
153
165
|
|
@@ -242,8 +254,9 @@ module NewRelic
|
|
242
254
|
return perform_action_without_newrelic_trace(*args)
|
243
255
|
end
|
244
256
|
end
|
245
|
-
|
246
|
-
|
257
|
+
|
258
|
+
control = NewRelic::Control.instance
|
259
|
+
return perform_action_with_newrelic_profile(args, &block) if control.profiling?
|
247
260
|
|
248
261
|
frame_data = _push_metric_frame(block_given? ? args : [])
|
249
262
|
begin
|
@@ -251,11 +264,17 @@ module NewRelic
|
|
251
264
|
frame_data.start_transaction
|
252
265
|
begin
|
253
266
|
NewRelic::Agent::BusyCalculator.dispatcher_start frame_data.start
|
254
|
-
if block_given?
|
267
|
+
result = if block_given?
|
255
268
|
yield
|
256
269
|
else
|
257
270
|
perform_action_without_newrelic_trace(*args)
|
258
271
|
end
|
272
|
+
if defined?(request) && request && defined?(response) && response
|
273
|
+
if !Agent.config[:disable_mobile_headers]
|
274
|
+
NewRelic::Agent::BrowserMonitoring.insert_mobile_response_header(request, response)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
result
|
259
278
|
rescue => e
|
260
279
|
frame_data.notice_error(e)
|
261
280
|
raise
|
@@ -266,8 +285,9 @@ module NewRelic
|
|
266
285
|
# Look for a metric frame in the thread local and process it.
|
267
286
|
# Clear the thread local when finished to ensure it only gets called once.
|
268
287
|
frame_data.record_apdex unless ignore_apdex?
|
269
|
-
|
270
288
|
frame_data.pop
|
289
|
+
|
290
|
+
NewRelic::Agent::TransactionInfo.get.ignore_end_user = true if ignore_enduser?
|
271
291
|
end
|
272
292
|
end
|
273
293
|
|
@@ -309,6 +329,10 @@ module NewRelic
|
|
309
329
|
def ignore_apdex?
|
310
330
|
_is_filtered?('ignore_apdex')
|
311
331
|
end
|
332
|
+
|
333
|
+
def ignore_enduser?
|
334
|
+
_is_filtered?('ignore_enduser')
|
335
|
+
end
|
312
336
|
|
313
337
|
private
|
314
338
|
|
@@ -426,8 +450,7 @@ module NewRelic
|
|
426
450
|
end
|
427
451
|
queue_start || now
|
428
452
|
rescue => e
|
429
|
-
NewRelic::
|
430
|
-
NewRelic::Control.instance.log.debug("#{e.backtrace[0..20]}")
|
453
|
+
::NewRelic::Agent.logger.error("Error detecting upstream wait time:", e)
|
431
454
|
now
|
432
455
|
end
|
433
456
|
|
@@ -57,7 +57,7 @@ DependencyDetection.defer do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
executes do
|
60
|
-
NewRelic::Agent.logger.
|
60
|
+
::NewRelic::Agent.logger.info 'Installing DataMapper instrumentation'
|
61
61
|
end
|
62
62
|
|
63
63
|
executes do
|
@@ -180,14 +180,6 @@ module NewRelic
|
|
180
180
|
module Agent
|
181
181
|
module Instrumentation
|
182
182
|
module DataMapperInstrumentation
|
183
|
-
|
184
|
-
def self.included(klass)
|
185
|
-
klass.class_eval do
|
186
|
-
alias_method :log_without_newrelic_instrumentation, :log
|
187
|
-
alias_method :log, :log_with_newrelic_instrumentation
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
183
|
# Unlike in AR, log is called in DM after the query actually ran,
|
192
184
|
# complete with metrics. Since DO has already calculated the
|
193
185
|
# duration, there's nothing more to measure, so just record and log.
|
@@ -195,9 +187,9 @@ module NewRelic
|
|
195
187
|
# We rely on the assumption that all possible entry points have been
|
196
188
|
# hooked with tracers, ensuring that notice_sql attaches this SQL to
|
197
189
|
# the proper call scope.
|
198
|
-
def
|
190
|
+
def log(msg)
|
199
191
|
return unless NewRelic::Agent.is_execution_traced?
|
200
|
-
return unless operation = case msg.query
|
192
|
+
return unless operation = case NewRelic::Helper.correctly_encoded(msg.query)
|
201
193
|
when /^\s*select/i then 'find'
|
202
194
|
when /^\s*(update|insert)/i then 'save'
|
203
195
|
when /^\s*delete/i then 'destroy'
|
@@ -216,7 +208,7 @@ module NewRelic
|
|
216
208
|
NewRelic::Agent.instance.stats_engine.get_stats_no_scope(metric).trace_call(duration)
|
217
209
|
end
|
218
210
|
ensure
|
219
|
-
|
211
|
+
super
|
220
212
|
end
|
221
213
|
|
222
214
|
end # DataMapperInstrumentation
|
@@ -4,7 +4,7 @@ DependencyDetection.defer do
|
|
4
4
|
@name = :delayed_job
|
5
5
|
|
6
6
|
depends_on do
|
7
|
-
!NewRelic::
|
7
|
+
!NewRelic::Agent.config[:disable_dj]
|
8
8
|
end
|
9
9
|
|
10
10
|
depends_on do
|
@@ -14,7 +14,7 @@ DependencyDetection.defer do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
executes do
|
17
|
-
NewRelic::Agent.logger.
|
17
|
+
::NewRelic::Agent.logger.info 'Installing DelayedJob instrumentation'
|
18
18
|
end
|
19
19
|
|
20
20
|
executes do
|
@@ -32,7 +32,7 @@ module NewRelic
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
def memcache_key_snippet(method_name)
|
35
|
-
return "" unless NewRelic::
|
35
|
+
return "" unless NewRelic::Agent.config[:capture_memcache_keys]
|
36
36
|
"NewRelic::Agent.instance.transaction_sampler.notice_nosql(args.first.inspect, (Time.now - t0).to_f) rescue nil"
|
37
37
|
end
|
38
38
|
end
|
@@ -44,7 +44,7 @@ DependencyDetection.defer do
|
|
44
44
|
@name = :memcache
|
45
45
|
|
46
46
|
depends_on do
|
47
|
-
!NewRelic::
|
47
|
+
!NewRelic::Agent.config[:disable_memcache_instrumentation]
|
48
48
|
end
|
49
49
|
|
50
50
|
depends_on do
|
@@ -57,24 +57,24 @@ DependencyDetection.defer do
|
|
57
57
|
if defined? ::MemCache
|
58
58
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::MemCache,
|
59
59
|
commands)
|
60
|
-
NewRelic::Agent.logger.
|
60
|
+
::NewRelic::Agent.logger.info 'Installing MemCache instrumentation'
|
61
61
|
end
|
62
62
|
if defined? ::Memcached
|
63
63
|
commands << 'cas'
|
64
64
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::Memcached,
|
65
65
|
commands)
|
66
|
-
NewRelic::Agent.logger.
|
66
|
+
::NewRelic::Agent.logger.info 'Installing Memcached instrumentation'
|
67
67
|
end
|
68
68
|
if defined? ::Dalli::Client
|
69
69
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::Dalli::Client,
|
70
70
|
commands)
|
71
|
-
NewRelic::Agent.logger.
|
71
|
+
::NewRelic::Agent.logger.info 'Installing Dalli Memcache instrumentation'
|
72
72
|
end
|
73
73
|
if defined? ::Spymemcached
|
74
74
|
commands << 'multiget'
|
75
75
|
NewRelic::Agent::Instrumentation::Memcache.instrument_methods(::Spymemcached,
|
76
76
|
commands)
|
77
|
-
NewRelic::Agent.logger.
|
77
|
+
::NewRelic::Agent.logger.info 'Installing Spymemcached instrumentation'
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -27,21 +27,11 @@ module NewRelic
|
|
27
27
|
attr_accessor :request
|
28
28
|
|
29
29
|
|
30
|
-
@@check_server_connection = false
|
31
|
-
def self.check_server_connection=(value)
|
32
|
-
@@check_server_connection = value
|
33
|
-
end
|
34
30
|
# Return the currently active metric frame, or nil. Call with +true+
|
35
31
|
# to create a new metric frame if one is not already on the thread.
|
36
32
|
def self.current(create_if_empty=nil)
|
37
33
|
f = Thread.current[:newrelic_metric_frame]
|
38
34
|
return f if f || !create_if_empty
|
39
|
-
|
40
|
-
# Reconnect to the server if necessary. This is only done
|
41
|
-
# for old versions of passenger that don't implement an explicit after_fork
|
42
|
-
# event.
|
43
|
-
agent.after_fork(:keep_retrying => false) if @@check_server_connection
|
44
|
-
|
45
35
|
Thread.current[:newrelic_metric_frame] = new
|
46
36
|
end
|
47
37
|
|
@@ -64,8 +54,8 @@ module NewRelic
|
|
64
54
|
if defined? JRuby
|
65
55
|
begin
|
66
56
|
require 'java'
|
67
|
-
|
68
|
-
|
57
|
+
java_import 'java.lang.management.ManagementFactory'
|
58
|
+
java_import 'com.sun.management.OperatingSystemMXBean'
|
69
59
|
@@java_classes_loaded = true
|
70
60
|
rescue => e
|
71
61
|
end
|
@@ -263,7 +253,7 @@ module NewRelic
|
|
263
253
|
end
|
264
254
|
|
265
255
|
def queue_time
|
266
|
-
|
256
|
+
start - apdex_start
|
267
257
|
end
|
268
258
|
|
269
259
|
def add_custom_parameters(p)
|
@@ -320,7 +310,7 @@ module NewRelic
|
|
320
310
|
# the apdex should be recorded as a failure regardless of duration.
|
321
311
|
def self.update_apdex(stat, duration, failed)
|
322
312
|
duration = duration.to_f
|
323
|
-
apdex_t =
|
313
|
+
apdex_t = Agent.config[:apdex_t]
|
324
314
|
case
|
325
315
|
when failed
|
326
316
|
stat.record_apdex_f
|
@@ -1,19 +1,19 @@
|
|
1
1
|
DependencyDetection.defer do
|
2
2
|
@name = :passenger
|
3
|
-
|
3
|
+
|
4
4
|
depends_on do
|
5
|
-
defined?(PhusionPassenger)
|
5
|
+
defined?(::PhusionPassenger)
|
6
6
|
end
|
7
7
|
|
8
8
|
executes do
|
9
|
-
NewRelic::Agent.logger.debug "Installing Passenger event hooks."
|
9
|
+
::NewRelic::Agent.logger.debug "Installing Passenger event hooks."
|
10
10
|
|
11
|
-
PhusionPassenger.on_event(:stopping_worker_process) do
|
12
|
-
NewRelic::Agent.logger.debug "Passenger stopping this process, shutdown the agent."
|
11
|
+
::PhusionPassenger.on_event(:stopping_worker_process) do
|
12
|
+
::NewRelic::Agent.logger.debug "Passenger stopping this process, shutdown the agent."
|
13
13
|
NewRelic::Agent.instance.shutdown
|
14
14
|
end
|
15
15
|
|
16
|
-
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
16
|
+
::PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
17
17
|
# We want to reset the stats from the stats engine in case any carried
|
18
18
|
# over into the spawned process. Don't clear them in case any were
|
19
19
|
# cached. We do this even in conservative spawning.
|
@@ -21,17 +21,3 @@ DependencyDetection.defer do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
DependencyDetection.defer do
|
26
|
-
depends_on do
|
27
|
-
defined?(::Passenger) && defined?(::Passenger::AbstractServer) || defined?(::IN_PHUSION_PASSENGER)
|
28
|
-
end
|
29
|
-
|
30
|
-
executes do
|
31
|
-
## We're on an older version of passenger
|
32
|
-
## FIXME: This warning is printing on current version of passenger
|
33
|
-
# NewRelic::Agent.logger.warn "An older version of Phusion Passenger has been detected. We recommend using at least release 2.1.1."
|
34
|
-
|
35
|
-
NewRelic::Agent::Instrumentation::MetricFrame.check_server_connection = true
|
36
|
-
end
|
37
|
-
end
|