sundawg_newrelic_rpm 3.5.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.project +23 -0
- data/.travis.yml +9 -0
- data/CHANGELOG +969 -0
- data/GUIDELINES_FOR_CONTRIBUTING.md +76 -0
- data/Gemfile +20 -0
- data/LICENSE +87 -0
- data/README.md +195 -0
- data/Rakefile +58 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic +13 -0
- data/bin/newrelic_cmd +5 -0
- data/cert/cacert.pem +118 -0
- data/cert/oldsite.pem +28 -0
- data/cert/site.pem +27 -0
- data/config.dot +290 -0
- data/config/database.yml +5 -0
- data/gem-public_cert.pem +20 -0
- data/init.rb +31 -0
- data/install.rb +9 -0
- data/lib/conditional_vendored_dependency_detection.rb +3 -0
- data/lib/conditional_vendored_metric_parser.rb +5 -0
- data/lib/new_relic/agent.rb +488 -0
- data/lib/new_relic/agent/agent.rb +1069 -0
- data/lib/new_relic/agent/agent_logger.rb +173 -0
- data/lib/new_relic/agent/audit_logger.rb +72 -0
- data/lib/new_relic/agent/beacon_configuration.rb +107 -0
- data/lib/new_relic/agent/browser_monitoring.rb +195 -0
- data/lib/new_relic/agent/busy_calculator.rb +112 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/configuration.rb +74 -0
- data/lib/new_relic/agent/configuration/defaults.rb +132 -0
- data/lib/new_relic/agent/configuration/environment_source.rb +49 -0
- data/lib/new_relic/agent/configuration/manager.rb +148 -0
- data/lib/new_relic/agent/configuration/mask_defaults.rb +11 -0
- data/lib/new_relic/agent/configuration/server_source.rb +31 -0
- data/lib/new_relic/agent/configuration/yaml_source.rb +67 -0
- data/lib/new_relic/agent/cross_app_monitor.rb +239 -0
- data/lib/new_relic/agent/cross_app_tracing.rb +281 -0
- data/lib/new_relic/agent/database.rb +254 -0
- data/lib/new_relic/agent/error_collector.rb +266 -0
- data/lib/new_relic/agent/event_listener.rb +43 -0
- data/lib/new_relic/agent/instrumentation.rb +9 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +29 -0
- data/lib/new_relic/agent/instrumentation/active_record.rb +134 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +68 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +19 -0
- data/lib/new_relic/agent/instrumentation/browser_monitoring_timings.rb +51 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +485 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +230 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +52 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +80 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +41 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +29 -0
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +356 -0
- data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +80 -0
- data/lib/new_relic/agent/instrumentation/net.rb +31 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +23 -0
- data/lib/new_relic/agent/instrumentation/queue_time.rb +68 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +114 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +42 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +42 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +180 -0
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +41 -0
- data/lib/new_relic/agent/instrumentation/rails4/action_controller.rb +145 -0
- data/lib/new_relic/agent/instrumentation/rails4/errors.rb +45 -0
- data/lib/new_relic/agent/instrumentation/resque.rb +81 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +107 -0
- data/lib/new_relic/agent/instrumentation/sunspot.rb +29 -0
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +22 -0
- data/lib/new_relic/agent/method_tracer.rb +530 -0
- data/lib/new_relic/agent/new_relic_service.rb +513 -0
- data/lib/new_relic/agent/pipe_channel_manager.rb +175 -0
- data/lib/new_relic/agent/pipe_service.rb +63 -0
- data/lib/new_relic/agent/rules_engine.rb +72 -0
- data/lib/new_relic/agent/sampler.rb +50 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +58 -0
- data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +86 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +141 -0
- data/lib/new_relic/agent/samplers/object_sampler.rb +26 -0
- data/lib/new_relic/agent/shim_agent.rb +28 -0
- data/lib/new_relic/agent/sql_sampler.rb +251 -0
- data/lib/new_relic/agent/stats.rb +149 -0
- data/lib/new_relic/agent/stats_engine.rb +30 -0
- data/lib/new_relic/agent/stats_engine/gc_profiler.rb +116 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +161 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +97 -0
- data/lib/new_relic/agent/stats_engine/stats_hash.rb +58 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +145 -0
- data/lib/new_relic/agent/thread.rb +32 -0
- data/lib/new_relic/agent/thread_profiler.rb +319 -0
- data/lib/new_relic/agent/transaction_info.rb +119 -0
- data/lib/new_relic/agent/transaction_sample_builder.rb +126 -0
- data/lib/new_relic/agent/transaction_sampler.rb +459 -0
- data/lib/new_relic/agent/worker_loop.rb +96 -0
- data/lib/new_relic/coerce.rb +37 -0
- data/lib/new_relic/collection_helper.rb +77 -0
- data/lib/new_relic/command.rb +85 -0
- data/lib/new_relic/commands/deployments.rb +114 -0
- data/lib/new_relic/commands/install.rb +80 -0
- data/lib/new_relic/control.rb +44 -0
- data/lib/new_relic/control/class_methods.rb +58 -0
- data/lib/new_relic/control/frameworks.rb +10 -0
- data/lib/new_relic/control/frameworks/external.rb +16 -0
- data/lib/new_relic/control/frameworks/merb.rb +25 -0
- data/lib/new_relic/control/frameworks/rails.rb +173 -0
- data/lib/new_relic/control/frameworks/rails3.rb +71 -0
- data/lib/new_relic/control/frameworks/rails4.rb +23 -0
- data/lib/new_relic/control/frameworks/ruby.rb +21 -0
- data/lib/new_relic/control/frameworks/sinatra.rb +20 -0
- data/lib/new_relic/control/instance_methods.rb +145 -0
- data/lib/new_relic/control/instrumentation.rb +95 -0
- data/lib/new_relic/control/profiling.rb +25 -0
- data/lib/new_relic/control/server_methods.rb +80 -0
- data/lib/new_relic/delayed_job_injection.rb +51 -0
- data/lib/new_relic/helper.rb +66 -0
- data/lib/new_relic/language_support.rb +92 -0
- data/lib/new_relic/latest_changes.rb +31 -0
- data/lib/new_relic/local_environment.rb +385 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +70 -0
- data/lib/new_relic/metric_spec.rb +80 -0
- data/lib/new_relic/metrics.rb +9 -0
- data/lib/new_relic/noticed_error.rb +59 -0
- data/lib/new_relic/okjson.rb +599 -0
- data/lib/new_relic/rack.rb +4 -0
- data/lib/new_relic/rack/agent_hooks.rb +20 -0
- data/lib/new_relic/rack/browser_monitoring.rb +85 -0
- data/lib/new_relic/rack/developer_mode.rb +271 -0
- data/lib/new_relic/rack/error_collector.rb +66 -0
- data/lib/new_relic/recipes.rb +99 -0
- data/lib/new_relic/timer_lib.rb +27 -0
- data/lib/new_relic/transaction_analysis.rb +77 -0
- data/lib/new_relic/transaction_analysis/segment_summary.rb +49 -0
- data/lib/new_relic/transaction_sample.rb +272 -0
- data/lib/new_relic/transaction_sample/composite_segment.rb +27 -0
- data/lib/new_relic/transaction_sample/fake_segment.rb +9 -0
- data/lib/new_relic/transaction_sample/segment.rb +205 -0
- data/lib/new_relic/transaction_sample/summary_segment.rb +21 -0
- data/lib/new_relic/url_rule.rb +14 -0
- data/lib/new_relic/version.rb +66 -0
- data/lib/newrelic_rpm.rb +49 -0
- data/lib/tasks/all.rb +4 -0
- data/lib/tasks/install.rake +7 -0
- data/lib/tasks/tests.rake +17 -0
- data/newrelic.yml +227 -0
- data/newrelic_rpm.gemspec +50 -0
- data/recipes/newrelic.rb +6 -0
- data/test/active_record_fixtures.rb +77 -0
- data/test/config/newrelic.yml +49 -0
- data/test/config/test_control.rb +48 -0
- data/test/fixtures/proc_cpuinfo.txt +575 -0
- data/test/intentional_fail.rb +10 -0
- data/test/multiverse/.gitignore +11 -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 +164 -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 +9 -0
- data/test/multiverse/suites/agent_only/audit_log_test.rb +97 -0
- data/test/multiverse/suites/agent_only/config/newrelic.yml +23 -0
- data/test/multiverse/suites/agent_only/cross_application_tracing_test.rb +56 -0
- data/test/multiverse/suites/agent_only/http_response_code_test.rb +53 -0
- data/test/multiverse/suites/agent_only/key_transactions_test.rb +66 -0
- data/test/multiverse/suites/agent_only/logging_test.rb +163 -0
- data/test/multiverse/suites/agent_only/marshaling_test.rb +96 -0
- data/test/multiverse/suites/agent_only/method_visibility_test.rb +98 -0
- data/test/multiverse/suites/agent_only/no_dns_resolv.rb +17 -0
- data/test/multiverse/suites/agent_only/pipe_manager_test.rb +33 -0
- data/test/multiverse/suites/agent_only/rename_rule_test.rb +57 -0
- data/test/multiverse/suites/agent_only/rum_instrumentation_test.rb +81 -0
- data/test/multiverse/suites/agent_only/service_timeout_test.rb +32 -0
- data/test/multiverse/suites/agent_only/ssl_test.rb +22 -0
- data/test/multiverse/suites/agent_only/start_up_test.rb +21 -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/testing_app.rb +17 -0
- data/test/multiverse/suites/agent_only/thread_profiling_test.rb +92 -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/rails/Envfile +18 -0
- data/test/multiverse/suites/rails/app.rb +49 -0
- data/test/multiverse/suites/rails/app/views/foos/_foo.html.haml +1 -0
- data/test/multiverse/suites/rails/app/views/views/_a_partial.html.erb +1 -0
- data/test/multiverse/suites/rails/app/views/views/_mid_partial.html.erb +1 -0
- data/test/multiverse/suites/rails/app/views/views/_top_partial.html.erb +3 -0
- data/test/multiverse/suites/rails/app/views/views/deep_partial.html.erb +3 -0
- data/test/multiverse/suites/rails/app/views/views/haml_view.html.haml +6 -0
- data/test/multiverse/suites/rails/app/views/views/index.html.erb +4 -0
- data/test/multiverse/suites/rails/config/newrelic.yml +32 -0
- data/test/multiverse/suites/rails/error_tracing_test.rb +211 -0
- data/test/multiverse/suites/rails/gc_instrumentation_test.rb +79 -0
- data/test/multiverse/suites/rails/queue_time_test.rb +55 -0
- data/test/multiverse/suites/rails/view_instrumentation_test.rb +205 -0
- data/test/multiverse/suites/resque/Envfile +24 -0
- data/test/multiverse/suites/resque/Rakefile +8 -0
- data/test/multiverse/suites/resque/config/newrelic.yml +22 -0
- data/test/multiverse/suites/resque/instrumentation_test.rb +151 -0
- data/test/multiverse/suites/resque/resque_setup.rb +15 -0
- data/test/multiverse/suites/sinatra/Envfile +15 -0
- data/test/multiverse/suites/sinatra/config/newrelic.yml +24 -0
- data/test/multiverse/suites/sinatra/sinatra_error_tracing_test.rb +38 -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 +139 -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 +295 -0
- data/test/new_relic/agent/agent/start_test.rb +205 -0
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +88 -0
- data/test/new_relic/agent/agent_logger_test.rb +153 -0
- data/test/new_relic/agent/agent_test.rb +301 -0
- data/test/new_relic/agent/agent_test_controller.rb +77 -0
- data/test/new_relic/agent/agent_test_controller_test.rb +381 -0
- data/test/new_relic/agent/apdex_from_server_test.rb +9 -0
- data/test/new_relic/agent/audit_logger_test.rb +105 -0
- data/test/new_relic/agent/beacon_configuration_test.rb +107 -0
- data/test/new_relic/agent/browser_monitoring_test.rb +395 -0
- data/test/new_relic/agent/busy_calculator_test.rb +96 -0
- data/test/new_relic/agent/configuration/environment_source_test.rb +79 -0
- data/test/new_relic/agent/configuration/manager_test.rb +232 -0
- data/test/new_relic/agent/configuration/server_source_test.rb +50 -0
- data/test/new_relic/agent/configuration/yaml_source_test.rb +85 -0
- data/test/new_relic/agent/cross_app_monitor_test.rb +237 -0
- data/test/new_relic/agent/database_test.rb +194 -0
- data/test/new_relic/agent/error_collector/notice_error_test.rb +268 -0
- data/test/new_relic/agent/error_collector_test.rb +246 -0
- data/test/new_relic/agent/event_listener_test.rb +67 -0
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +606 -0
- data/test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb +66 -0
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +107 -0
- data/test/new_relic/agent/instrumentation/instrumentation_test.rb +11 -0
- data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +171 -0
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +151 -0
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +461 -0
- data/test/new_relic/agent/instrumentation/queue_time_test.rb +97 -0
- data/test/new_relic/agent/instrumentation/rack_test.rb +35 -0
- data/test/new_relic/agent/instrumentation/sinatra_test.rb +25 -0
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +182 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +143 -0
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +158 -0
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +222 -0
- data/test/new_relic/agent/method_tracer_test.rb +389 -0
- data/test/new_relic/agent/mock_scope_listener.rb +26 -0
- data/test/new_relic/agent/new_relic_service_test.rb +571 -0
- data/test/new_relic/agent/pipe_channel_manager_test.rb +131 -0
- data/test/new_relic/agent/pipe_service_test.rb +133 -0
- data/test/new_relic/agent/rpm_agent_test.rb +115 -0
- data/test/new_relic/agent/rules_engine_test.rb +82 -0
- data/test/new_relic/agent/sampler_test.rb +19 -0
- data/test/new_relic/agent/shim_agent_test.rb +16 -0
- data/test/new_relic/agent/sql_sampler_test.rb +244 -0
- data/test/new_relic/agent/stats_engine/gc_profiler_test.rb +85 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +180 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +99 -0
- data/test/new_relic/agent/stats_engine_test.rb +184 -0
- data/test/new_relic/agent/stats_hash_test.rb +93 -0
- data/test/new_relic/agent/stats_test.rb +197 -0
- data/test/new_relic/agent/thread_profiler_test.rb +582 -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 +106 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +227 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +968 -0
- data/test/new_relic/agent/worker_loop_test.rb +84 -0
- data/test/new_relic/agent_test.rb +296 -0
- data/test/new_relic/coerce_test.rb +65 -0
- data/test/new_relic/collection_helper_test.rb +148 -0
- data/test/new_relic/command/deployments_test.rb +84 -0
- data/test/new_relic/control/class_methods_test.rb +44 -0
- data/test/new_relic/control/frameworks/rails_test.rb +26 -0
- data/test/new_relic/control_test.rb +194 -0
- data/test/new_relic/delayed_job_injection_test.rb +21 -0
- data/test/new_relic/dispatcher_test.rb +54 -0
- data/test/new_relic/fake_collector.rb +389 -0
- data/test/new_relic/framework_test.rb +53 -0
- data/test/new_relic/helper_test.rb +24 -0
- data/test/new_relic/load_test.rb +13 -0
- data/test/new_relic/local_environment_test.rb +85 -0
- data/test/new_relic/metric_data_test.rb +183 -0
- data/test/new_relic/metric_parser/metric_parser_test.rb +11 -0
- data/test/new_relic/metric_spec_test.rb +95 -0
- data/test/new_relic/noticed_error_test.rb +32 -0
- data/test/new_relic/rack/agent_hooks_test.rb +30 -0
- data/test/new_relic/rack/all_test.rb +11 -0
- data/test/new_relic/rack/browser_monitoring_test.rb +152 -0
- data/test/new_relic/rack/developer_mode_helper_test.rb +141 -0
- data/test/new_relic/rack/developer_mode_test.rb +80 -0
- data/test/new_relic/rack/error_collector_test.rb +90 -0
- data/test/new_relic/transaction_analysis/segment_summary_test.rb +91 -0
- data/test/new_relic/transaction_analysis_test.rb +121 -0
- data/test/new_relic/transaction_sample/composite_segment_test.rb +35 -0
- data/test/new_relic/transaction_sample/fake_segment_test.rb +17 -0
- data/test/new_relic/transaction_sample/segment_test.rb +415 -0
- data/test/new_relic/transaction_sample/summary_segment_test.rb +31 -0
- data/test/new_relic/transaction_sample_subtest_test.rb +56 -0
- data/test/new_relic/transaction_sample_test.rb +250 -0
- data/test/new_relic/version_number_test.rb +97 -0
- data/test/script/build_test_gem.sh +57 -0
- data/test/script/ci.sh +168 -0
- data/test/script/ci_agent-tests_runner.sh +82 -0
- data/test/script/ci_bench.sh +52 -0
- data/test/script/ci_multiverse_runner.sh +63 -0
- data/test/test_contexts.rb +30 -0
- data/test/test_helper.rb +240 -0
- data/ui/helpers/developer_mode_helper.rb +367 -0
- data/ui/helpers/google_pie_chart.rb +49 -0
- data/ui/views/layouts/newrelic_default.rhtml +48 -0
- data/ui/views/newrelic/_explain_plans.rhtml +27 -0
- data/ui/views/newrelic/_sample.rhtml +20 -0
- data/ui/views/newrelic/_segment.rhtml +28 -0
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
- data/ui/views/newrelic/_segment_row.rhtml +12 -0
- data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
- data/ui/views/newrelic/_sql_row.rhtml +16 -0
- data/ui/views/newrelic/_stack_trace.rhtml +15 -0
- data/ui/views/newrelic/_table.rhtml +12 -0
- data/ui/views/newrelic/explain_sql.rhtml +43 -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/file/images/new-relic-rpm-desktop.gif +0 -0
- data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/file/images/textmate.png +0 -0
- data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
- data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
- data/ui/views/newrelic/file/stylesheets/style.css +490 -0
- data/ui/views/newrelic/index.rhtml +71 -0
- data/ui/views/newrelic/sample_not_found.rhtml +2 -0
- data/ui/views/newrelic/show_sample.rhtml +80 -0
- data/ui/views/newrelic/show_source.rhtml +3 -0
- data/ui/views/newrelic/threads.rhtml +45 -0
- data/vendor/gems/dependency_detection-0.0.1.build/LICENSE +5 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +67 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection/version.rb +3 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/.specification +116 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/metric_parser.rb +1 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser.rb +64 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/action_mailer.rb +14 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_merchant.rb +31 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/active_record.rb +33 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/apdex.rb +89 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/background_transaction.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/client.rb +46 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller.rb +67 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_cpu.rb +43 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/controller_ext.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database.rb +48 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/database_pool.rb +24 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net.rb +28 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/dot_net_parser.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/errors.rb +11 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/external.rb +55 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/frontend.rb +40 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/gc.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/hibernate_session.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java.rb +31 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/java_parser.rb +17 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp.rb +34 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/jsp_tag.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/mem_cache.rb +55 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/metric_parser.rb +135 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/orm.rb +27 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/other_transaction.rb +40 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_context_listener.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_filter.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/servlet_init.rb +7 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr.rb +27 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/solr_request_handler.rb +15 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring.rb +54 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_controller.rb +6 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/spring_view.rb +6 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_action.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/struts_result.rb +20 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/version.rb +5 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/view.rb +70 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_frontend.rb +18 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_service.rb +14 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/lib/new_relic/metric_parser/web_transaction.rb +133 -0
- metadata +494 -0
@@ -0,0 +1,175 @@
|
|
1
|
+
require 'base64'
|
2
|
+
|
3
|
+
module NewRelic
|
4
|
+
module Agent
|
5
|
+
|
6
|
+
#--
|
7
|
+
# Manages the registering and servicing of pipes used by child
|
8
|
+
# processes to report data to their parent, rather than directly
|
9
|
+
# to the collector.
|
10
|
+
module PipeChannelManager
|
11
|
+
extend self
|
12
|
+
|
13
|
+
def register_report_channel(id)
|
14
|
+
listener.register_pipe(id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def channels
|
18
|
+
listener.pipes
|
19
|
+
end
|
20
|
+
|
21
|
+
def listener
|
22
|
+
@listener ||= Listener.new
|
23
|
+
end
|
24
|
+
|
25
|
+
class Pipe
|
26
|
+
attr_accessor :in, :out
|
27
|
+
attr_reader :last_read
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@out, @in = IO.pipe
|
31
|
+
if defined?(::Encoding::ASCII_8BIT)
|
32
|
+
@in.set_encoding(::Encoding::ASCII_8BIT)
|
33
|
+
end
|
34
|
+
@last_read = Time.now
|
35
|
+
end
|
36
|
+
|
37
|
+
def close
|
38
|
+
@out.close unless @out.closed?
|
39
|
+
@in.close unless @in.closed?
|
40
|
+
end
|
41
|
+
|
42
|
+
def write(data)
|
43
|
+
@out.close unless @out.closed?
|
44
|
+
@in << NewRelic::LanguageSupport.with_cautious_gc do
|
45
|
+
Marshal.dump(data)
|
46
|
+
end
|
47
|
+
@in << "\n\n"
|
48
|
+
end
|
49
|
+
|
50
|
+
def read
|
51
|
+
@in.close unless @in.closed?
|
52
|
+
@last_read = Time.now
|
53
|
+
@out.gets("\n\n")
|
54
|
+
end
|
55
|
+
|
56
|
+
def closed?
|
57
|
+
@out.closed? && @in.closed?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class Listener
|
62
|
+
attr_reader :thread
|
63
|
+
attr_accessor :pipes, :timeout, :select_timeout
|
64
|
+
|
65
|
+
def initialize
|
66
|
+
@pipes = {}
|
67
|
+
@timeout = 360
|
68
|
+
@select_timeout = 60
|
69
|
+
end
|
70
|
+
|
71
|
+
def register_pipe(id)
|
72
|
+
@pipes[id] = Pipe.new
|
73
|
+
wake.in << '.'
|
74
|
+
end
|
75
|
+
|
76
|
+
def start
|
77
|
+
return if @started == true
|
78
|
+
@started = true
|
79
|
+
@thread = NewRelic::Agent::AgentThread.new('Pipe Channel Manager') do
|
80
|
+
now = nil
|
81
|
+
loop do
|
82
|
+
clean_up_pipes
|
83
|
+
pipes_to_listen_to = @pipes.values.map{|pipe| pipe.out} + [wake.out]
|
84
|
+
NewRelic::Agent.instance.stats_engine \
|
85
|
+
.get_stats_no_scope('Supportability/Listeners') \
|
86
|
+
.record_data_point((Time.now - now).to_f) if now
|
87
|
+
if ready = IO.select(pipes_to_listen_to, [], [], @select_timeout)
|
88
|
+
now = Time.now
|
89
|
+
pipe = ready[0][0]
|
90
|
+
if pipe == wake.out
|
91
|
+
pipe.read(1)
|
92
|
+
else
|
93
|
+
merge_data_from_pipe(pipe)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
break if !should_keep_listening?
|
98
|
+
end
|
99
|
+
end
|
100
|
+
sleep 0.001 # give time for the thread to spawn
|
101
|
+
end
|
102
|
+
|
103
|
+
def stop
|
104
|
+
return unless @started == true
|
105
|
+
@started = false
|
106
|
+
wake.in << '.' unless wake.in.closed?
|
107
|
+
@thread.join # make sure we wait for the thread to exit
|
108
|
+
close_all_pipes
|
109
|
+
@wake.close
|
110
|
+
@wake = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
def close_all_pipes
|
114
|
+
@pipes.each do |id, pipe|
|
115
|
+
pipe.close if pipe
|
116
|
+
end
|
117
|
+
@pipes = {}
|
118
|
+
end
|
119
|
+
|
120
|
+
def wake
|
121
|
+
@wake ||= Pipe.new
|
122
|
+
end
|
123
|
+
|
124
|
+
def started?
|
125
|
+
@started
|
126
|
+
end
|
127
|
+
|
128
|
+
protected
|
129
|
+
|
130
|
+
def merge_data_from_pipe(pipe_handle)
|
131
|
+
pipe = find_pipe_for_handle(pipe_handle)
|
132
|
+
got = pipe.read
|
133
|
+
|
134
|
+
if got && !got.empty?
|
135
|
+
payload = unmarshal(got)
|
136
|
+
if payload == 'EOF'
|
137
|
+
pipe.close
|
138
|
+
elsif payload
|
139
|
+
NewRelic::Agent.agent.merge_data_from([payload[:stats],
|
140
|
+
payload[:transaction_traces],
|
141
|
+
payload[:error_traces]])
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def unmarshal(data)
|
147
|
+
NewRelic::LanguageSupport.with_cautious_gc do
|
148
|
+
Marshal.load(data)
|
149
|
+
end
|
150
|
+
rescue StandardError => e
|
151
|
+
msg = "#{e.class.name} '#{e.message}' trying to load #{Base64.encode64(data)}"
|
152
|
+
::NewRelic::Agent.logger.debug(msg)
|
153
|
+
nil
|
154
|
+
end
|
155
|
+
|
156
|
+
def should_keep_listening?
|
157
|
+
@started || @pipes.values.find{|pipe| !pipe.in.closed?}
|
158
|
+
end
|
159
|
+
|
160
|
+
def clean_up_pipes
|
161
|
+
@pipes.values.each do |pipe|
|
162
|
+
if pipe.last_read.to_f + @timeout < Time.now.to_f
|
163
|
+
pipe.close unless pipe.closed?
|
164
|
+
end
|
165
|
+
end
|
166
|
+
@pipes.reject! {|id, pipe| pipe.out.closed? }
|
167
|
+
end
|
168
|
+
|
169
|
+
def find_pipe_for_handle(out_handle)
|
170
|
+
@pipes.values.find{|pipe| pipe.out == out_handle }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
class PipeService
|
4
|
+
attr_reader :channel_id, :buffer
|
5
|
+
attr_accessor :request_timeout, :agent_id, :collector
|
6
|
+
|
7
|
+
def initialize(channel_id)
|
8
|
+
@channel_id = channel_id
|
9
|
+
@collector = NewRelic::Control::Server.new(:name => 'parent',
|
10
|
+
:port => 0)
|
11
|
+
end
|
12
|
+
|
13
|
+
def connect(config)
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_agent_commands
|
18
|
+
[]
|
19
|
+
end
|
20
|
+
|
21
|
+
def metric_data(last_harvest_time, now, unsent_timeslice_data)
|
22
|
+
write_to_pipe(:stats => unsent_timeslice_data)
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
|
26
|
+
def transaction_sample_data(transactions)
|
27
|
+
write_to_pipe(:transaction_traces => transactions) if transactions
|
28
|
+
end
|
29
|
+
|
30
|
+
def error_data(errors)
|
31
|
+
write_to_pipe(:error_traces => errors) if errors
|
32
|
+
end
|
33
|
+
|
34
|
+
def sql_trace_data(sql)
|
35
|
+
write_to_pipe(:sql_traces => sql) if sql
|
36
|
+
end
|
37
|
+
|
38
|
+
def shutdown(time)
|
39
|
+
write_to_pipe('EOF')
|
40
|
+
NewRelic::Agent::PipeChannelManager.channels[@channel_id].close
|
41
|
+
end
|
42
|
+
|
43
|
+
# Invokes the block it is passed. This is used to implement HTTP
|
44
|
+
# keep-alive in the NewRelicService, and is a required interface for any
|
45
|
+
# Service class.
|
46
|
+
def session
|
47
|
+
yield
|
48
|
+
end
|
49
|
+
|
50
|
+
def reset_metric_id_cache
|
51
|
+
# we don't cache metric IDs, so nothing to do
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def write_to_pipe(data)
|
57
|
+
NewRelic::Agent::PipeChannelManager.channels[@channel_id].write(data)
|
58
|
+
rescue => e
|
59
|
+
NewRelic::Agent.logger.error("#{e.message}: Unable to send data to parent process, please see https://newrelic.com/docs/ruby/resque-instrumentation for more information.")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module NewRelic
|
2
|
+
module Agent
|
3
|
+
class RulesEngine
|
4
|
+
include Enumerable
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@rules, :size, :<<, :inspect, :each
|
8
|
+
|
9
|
+
attr_accessor :rules
|
10
|
+
|
11
|
+
def initialize(rules=[])
|
12
|
+
@rules = rules
|
13
|
+
end
|
14
|
+
|
15
|
+
def rename(original_string)
|
16
|
+
@rules.sort.inject(original_string) do |string,rule|
|
17
|
+
if rule.each_segment
|
18
|
+
result, matched = rule.map_to_list(string.split('/'))
|
19
|
+
result = result.join('/')
|
20
|
+
else
|
21
|
+
result, matched = rule.apply(string)
|
22
|
+
end
|
23
|
+
|
24
|
+
break result if matched && rule.terminate_chain
|
25
|
+
result
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Rule
|
30
|
+
attr_reader(:terminate_chain, :each_segment, :ignore, :replace_all, :eval_order,
|
31
|
+
:match_expression, :replacement)
|
32
|
+
|
33
|
+
def initialize(options)
|
34
|
+
if !options['match_expression']
|
35
|
+
raise ArgumentError.new('missing required match_expression')
|
36
|
+
end
|
37
|
+
if !options['replacement'] && !options['ignore']
|
38
|
+
raise ArgumentError.new('must specify replacement when ignore is false')
|
39
|
+
end
|
40
|
+
|
41
|
+
@match_expression = Regexp.new(options['match_expression'])
|
42
|
+
@replacement = options['replacement']
|
43
|
+
@ignore = options['ignore'] || false
|
44
|
+
@eval_order = options['eval_order'] || 0
|
45
|
+
@replace_all = options['replace_all'] || false
|
46
|
+
@each_segment = options['each_segment'] || false
|
47
|
+
@terminate_chain = options['terminate_chain'] || false
|
48
|
+
end
|
49
|
+
|
50
|
+
def apply(string)
|
51
|
+
method = @replace_all ? :gsub : :sub
|
52
|
+
result = string.send(method, @match_expression, @replacement)
|
53
|
+
[result, result != string]
|
54
|
+
end
|
55
|
+
|
56
|
+
def map_to_list(list)
|
57
|
+
matched = false
|
58
|
+
result = list.map do |string|
|
59
|
+
str_result, str_match = apply(string)
|
60
|
+
matched ||= str_match
|
61
|
+
str_result
|
62
|
+
end
|
63
|
+
[result, matched]
|
64
|
+
end
|
65
|
+
|
66
|
+
def <=>(other)
|
67
|
+
eval_order <=> other.eval_order
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# A Sampler is used to capture meaningful metrics in a background thread
|
2
|
+
# periodically. They will either be invoked once a minute just before the
|
3
|
+
# data is sent to the agent (default) or every 10 seconds, when #use_harvest_sampler?
|
4
|
+
# returns false.
|
5
|
+
#
|
6
|
+
# Samplers can be added to New Relic by subclassing NewRelic::Agent::Sampler.
|
7
|
+
# Instances are created when the agent is enabled and installed. Subclasses
|
8
|
+
# are registered for instantiation automatically.
|
9
|
+
module NewRelic
|
10
|
+
module Agent
|
11
|
+
class Sampler
|
12
|
+
|
13
|
+
# Exception denotes a sampler is not available and it will not be registered.
|
14
|
+
class Unsupported < StandardError; end
|
15
|
+
|
16
|
+
attr_accessor :stats_engine
|
17
|
+
attr_reader :id
|
18
|
+
@sampler_classes = []
|
19
|
+
|
20
|
+
def self.inherited(subclass)
|
21
|
+
@sampler_classes << subclass
|
22
|
+
end
|
23
|
+
|
24
|
+
# Override with check. Called before instantiating.
|
25
|
+
def self.supported_on_this_platform?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
# Override to use the periodic sampler instead of running the sampler on the
|
30
|
+
# minute during harvests.
|
31
|
+
def self.use_harvest_sampler?
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.sampler_classes
|
36
|
+
@sampler_classes
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(id)
|
40
|
+
@id = id
|
41
|
+
end
|
42
|
+
|
43
|
+
def poll
|
44
|
+
raise "Implement in the subclass"
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'new_relic/agent/sampler'
|
2
|
+
|
3
|
+
module NewRelic
|
4
|
+
module Agent
|
5
|
+
module Samplers
|
6
|
+
class CpuSampler < NewRelic::Agent::Sampler
|
7
|
+
attr_reader :last_time
|
8
|
+
def initialize
|
9
|
+
super :cpu
|
10
|
+
poll
|
11
|
+
end
|
12
|
+
|
13
|
+
def user_util_stats
|
14
|
+
stats_engine.get_stats_no_scope("CPU/User/Utilization")
|
15
|
+
end
|
16
|
+
def system_util_stats
|
17
|
+
stats_engine.get_stats_no_scope("CPU/System/Utilization")
|
18
|
+
end
|
19
|
+
def usertime_stats
|
20
|
+
stats_engine.get_stats_no_scope("CPU/User Time")
|
21
|
+
end
|
22
|
+
def systemtime_stats
|
23
|
+
stats_engine.get_stats_no_scope("CPU/System Time")
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.supported_on_this_platform?
|
27
|
+
# Process.times on JRuby reports wall clock elapsed time,
|
28
|
+
# not actual cpu time used, so we cannot use this sampler there.
|
29
|
+
not defined?(JRuby)
|
30
|
+
end
|
31
|
+
|
32
|
+
def poll
|
33
|
+
now = Time.now
|
34
|
+
t = Process.times
|
35
|
+
if @last_time
|
36
|
+
elapsed = now - @last_time
|
37
|
+
return if elapsed < 1 # Causing some kind of math underflow
|
38
|
+
num_processors = NewRelic::Control.instance.local_env.processors || 1
|
39
|
+
usertime = t.utime - @last_utime
|
40
|
+
systemtime = t.stime - @last_stime
|
41
|
+
|
42
|
+
systemtime_stats.record_data_point(systemtime) if systemtime >= 0
|
43
|
+
usertime_stats.record_data_point(usertime) if usertime >= 0
|
44
|
+
|
45
|
+
# Calculate the true utilization by taking cpu times and dividing by
|
46
|
+
# elapsed time X num_processors.
|
47
|
+
user_util_stats.record_data_point usertime / (elapsed * num_processors)
|
48
|
+
system_util_stats.record_data_point systemtime / (elapsed * num_processors)
|
49
|
+
end
|
50
|
+
@last_utime = t.utime
|
51
|
+
@last_stime = t.stime
|
52
|
+
@last_time = now
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'new_relic/agent/sampler'
|
2
|
+
require 'new_relic/delayed_job_injection'
|
3
|
+
|
4
|
+
module NewRelic
|
5
|
+
module Agent
|
6
|
+
module Samplers
|
7
|
+
# This sampler records the status of your delayed job table once a minute.
|
8
|
+
# It assumes jobs are cleared after being run, and failed jobs are not (otherwise
|
9
|
+
# the failed job metric is useless).
|
10
|
+
#
|
11
|
+
# In earlier versions it will break out the queue length by priority. In later
|
12
|
+
# versions of DJ where distinct queues are supported, it breaks it out by queue name.
|
13
|
+
#
|
14
|
+
class DelayedJobSampler < NewRelic::Agent::Sampler
|
15
|
+
def initialize
|
16
|
+
super :delayed_job_queue
|
17
|
+
raise Unsupported, "DJ instrumentation disabled" if Agent.config[:disable_dj]
|
18
|
+
raise Unsupported, "No DJ worker present" unless NewRelic::DelayedJobInjection.worker_name
|
19
|
+
end
|
20
|
+
|
21
|
+
def error_stats
|
22
|
+
stats_engine.get_stats("Workers/DelayedJob/failed_jobs", false)
|
23
|
+
end
|
24
|
+
def locked_job_stats
|
25
|
+
stats_engine.get_stats("Workers/DelayedJob/locked_jobs", false)
|
26
|
+
end
|
27
|
+
|
28
|
+
def local_env
|
29
|
+
NewRelic::Control.instance.local_env
|
30
|
+
end
|
31
|
+
|
32
|
+
def worker_name
|
33
|
+
local_env.dispatcher_instance_id
|
34
|
+
end
|
35
|
+
|
36
|
+
def failed_jobs
|
37
|
+
Delayed::Job.count(:conditions => 'failed_at is not NULL')
|
38
|
+
end
|
39
|
+
def locked_jobs
|
40
|
+
Delayed::Job.count(:conditions => 'locked_by is not NULL')
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.supported_on_this_platform?
|
44
|
+
defined?(Delayed::Job)
|
45
|
+
end
|
46
|
+
|
47
|
+
def poll
|
48
|
+
record error_stats, failed_jobs
|
49
|
+
record locked_job_stats, locked_jobs
|
50
|
+
|
51
|
+
if @queue
|
52
|
+
record_queue_length_across_dimension('queue')
|
53
|
+
else
|
54
|
+
record_queue_length_across_dimension('priority')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def record_queue_length_across_dimension(column)
|
61
|
+
all_count = 0
|
62
|
+
Delayed::Job.count(:group => column, :conditions => ['run_at < ? and failed_at is NULL', Time.now]).each do | column_val, count |
|
63
|
+
all_count += count
|
64
|
+
record stats_engine.get_stats("Workers/DelayedJob/queue_length/#{column == 'queue' ? 'name' : column}/#{column_val}", false), count
|
65
|
+
end
|
66
|
+
record(stats_engine.get_stats("Workers/DelayedJob/queue_length/all", false), all_count)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Figure out if we get the queues.
|
70
|
+
def setup
|
71
|
+
return unless @queue.nil?
|
72
|
+
@setup = true
|
73
|
+
columns = Delayed::Job.columns
|
74
|
+
columns.each do | c |
|
75
|
+
@queue = true if c.name.to_s == 'priority'
|
76
|
+
end
|
77
|
+
@queue ||= false
|
78
|
+
end
|
79
|
+
|
80
|
+
def record(stat, size)
|
81
|
+
stat.record_data_point size
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|