ghazel-newrelic_rpm 3.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +525 -0
- data/LICENSE +37 -0
- data/README.rdoc +179 -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/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 +423 -0
- data/lib/new_relic/agent/agent.rb +1040 -0
- data/lib/new_relic/agent/beacon_configuration.rb +61 -0
- data/lib/new_relic/agent/browser_monitoring.rb +83 -0
- data/lib/new_relic/agent/busy_calculator.rb +91 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/error_collector.rb +203 -0
- data/lib/new_relic/agent/instrumentation.rb +9 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +21 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +62 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +13 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +413 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +232 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +44 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +56 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +36 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +23 -0
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +326 -0
- data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +84 -0
- data/lib/new_relic/agent/instrumentation/net.rb +23 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +34 -0
- data/lib/new_relic/agent/instrumentation/queue_time.rb +210 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +83 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +36 -0
- data/lib/new_relic/agent/instrumentation/rails/active_record_instrumentation.rb +108 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +36 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +60 -0
- data/lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb +112 -0
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +31 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +54 -0
- data/lib/new_relic/agent/instrumentation/sunspot.rb +23 -0
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +16 -0
- data/lib/new_relic/agent/method_tracer.rb +422 -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_lock_sampler.rb +40 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +144 -0
- data/lib/new_relic/agent/samplers/object_sampler.rb +26 -0
- data/lib/new_relic/agent/shim_agent.rb +29 -0
- data/lib/new_relic/agent/stats_engine.rb +24 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +182 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +89 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +184 -0
- data/lib/new_relic/agent/transaction_sample_builder.rb +101 -0
- data/lib/new_relic/agent/transaction_sampler.rb +378 -0
- data/lib/new_relic/agent/worker_loop.rb +81 -0
- data/lib/new_relic/collection_helper.rb +69 -0
- data/lib/new_relic/command.rb +85 -0
- data/lib/new_relic/commands/deployments.rb +105 -0
- data/lib/new_relic/commands/install.rb +91 -0
- data/lib/new_relic/control.rb +48 -0
- data/lib/new_relic/control/class_methods.rb +47 -0
- data/lib/new_relic/control/configuration.rb +157 -0
- data/lib/new_relic/control/frameworks/external.rb +16 -0
- data/lib/new_relic/control/frameworks/merb.rb +30 -0
- data/lib/new_relic/control/frameworks/rails.rb +151 -0
- data/lib/new_relic/control/frameworks/rails3.rb +70 -0
- data/lib/new_relic/control/frameworks/ruby.rb +42 -0
- data/lib/new_relic/control/frameworks/sinatra.rb +23 -0
- data/lib/new_relic/control/instance_methods.rb +154 -0
- data/lib/new_relic/control/instrumentation.rb +81 -0
- data/lib/new_relic/control/logging_methods.rb +88 -0
- data/lib/new_relic/control/profiling.rb +25 -0
- data/lib/new_relic/control/server_methods.rb +104 -0
- data/lib/new_relic/data_serialization.rb +84 -0
- data/lib/new_relic/delayed_job_injection.rb +38 -0
- data/lib/new_relic/histogram.rb +91 -0
- data/lib/new_relic/local_environment.rb +391 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +46 -0
- data/lib/new_relic/metric_spec.rb +73 -0
- data/lib/new_relic/metrics.rb +9 -0
- data/lib/new_relic/noticed_error.rb +24 -0
- data/lib/new_relic/rack/browser_monitoring.rb +68 -0
- data/lib/new_relic/rack/developer_mode.rb +267 -0
- data/lib/new_relic/rack/metric_app.rb +65 -0
- data/lib/new_relic/rack/mongrel_rpm.ru +28 -0
- data/lib/new_relic/rack/newrelic.yml +27 -0
- data/lib/new_relic/rack_app.rb +6 -0
- data/lib/new_relic/recipes.rb +73 -0
- data/lib/new_relic/stats.rb +378 -0
- data/lib/new_relic/timer_lib.rb +27 -0
- data/lib/new_relic/transaction_analysis.rb +76 -0
- data/lib/new_relic/transaction_analysis/segment_summary.rb +47 -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 +251 -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 +55 -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 +19 -0
- data/newrelic.yml +265 -0
- data/newrelic_rpm.gemspec +330 -0
- data/recipes/newrelic.rb +6 -0
- data/test/active_record_fixtures.rb +77 -0
- data/test/config/newrelic.yml +48 -0
- data/test/config/test_control.rb +48 -0
- data/test/new_relic/agent/agent/connect_test.rb +316 -0
- data/test/new_relic/agent/agent/start_test.rb +340 -0
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +155 -0
- data/test/new_relic/agent/agent_test.rb +173 -0
- data/test/new_relic/agent/agent_test_controller.rb +77 -0
- data/test/new_relic/agent/agent_test_controller_test.rb +366 -0
- data/test/new_relic/agent/apdex_from_server_test.rb +9 -0
- data/test/new_relic/agent/beacon_configuration_test.rb +104 -0
- data/test/new_relic/agent/browser_monitoring_test.rb +274 -0
- data/test/new_relic/agent/busy_calculator_test.rb +81 -0
- data/test/new_relic/agent/error_collector/notice_error_test.rb +257 -0
- data/test/new_relic/agent/error_collector_test.rb +168 -0
- data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +522 -0
- data/test/new_relic/agent/instrumentation/controller_instrumentation_test.rb +36 -0
- data/test/new_relic/agent/instrumentation/instrumentation_test.rb +11 -0
- data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +179 -0
- data/test/new_relic/agent/instrumentation/metric_frame_test.rb +50 -0
- data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +84 -0
- data/test/new_relic/agent/instrumentation/queue_time_test.rb +387 -0
- data/test/new_relic/agent/instrumentation/rack_test.rb +35 -0
- data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +184 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +107 -0
- data/test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb +164 -0
- data/test/new_relic/agent/method_tracer/instance_methods/trace_execution_scoped_test.rb +234 -0
- data/test/new_relic/agent/method_tracer_test.rb +386 -0
- data/test/new_relic/agent/mock_scope_listener.rb +23 -0
- data/test/new_relic/agent/rpm_agent_test.rb +149 -0
- data/test/new_relic/agent/sampler_test.rb +19 -0
- data/test/new_relic/agent/shim_agent_test.rb +20 -0
- data/test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb +150 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +81 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +99 -0
- data/test/new_relic/agent/stats_engine_test.rb +185 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +945 -0
- data/test/new_relic/agent/worker_loop_test.rb +66 -0
- data/test/new_relic/collection_helper_test.rb +127 -0
- data/test/new_relic/command/deployments_test.rb +68 -0
- data/test/new_relic/control/class_methods_test.rb +62 -0
- data/test/new_relic/control/logging_methods_test.rb +157 -0
- data/test/new_relic/control_test.rb +195 -0
- data/test/new_relic/data_serialization_test.rb +70 -0
- data/test/new_relic/local_environment_test.rb +72 -0
- data/test/new_relic/metric_data_test.rb +125 -0
- data/test/new_relic/metric_spec_test.rb +95 -0
- data/test/new_relic/rack/all_test.rb +11 -0
- data/test/new_relic/rack/browser_monitoring_test.rb +84 -0
- data/test/new_relic/rack/developer_mode_test.rb +43 -0
- data/test/new_relic/stats_test.rb +426 -0
- data/test/new_relic/transaction_analysis/segment_summary_test.rb +77 -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 +454 -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 +170 -0
- data/test/new_relic/version_number_test.rb +89 -0
- data/test/test_contexts.rb +29 -0
- data/test/test_helper.rb +144 -0
- data/ui/helpers/developer_mode_helper.rb +351 -0
- data/ui/helpers/google_pie_chart.rb +49 -0
- data/ui/views/layouts/newrelic_default.rhtml +47 -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 +53 -0
- data/vendor/gems/dependency_detection-0.0.1.build/LICENSE +19 -0
- data/vendor/gems/dependency_detection-0.0.1.build/README +0 -0
- data/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb +57 -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/LICENSE +0 -0
- data/vendor/gems/metric_parser-0.1.0.pre1/README +0 -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 +122 -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/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 +66 -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 +399 -0
@@ -0,0 +1,251 @@
|
|
1
|
+
require 'new_relic/transaction_sample'
|
2
|
+
module NewRelic
|
3
|
+
class TransactionSample
|
4
|
+
class Segment
|
5
|
+
attr_reader :entry_timestamp
|
6
|
+
# The exit timestamp will be relative except for the outermost sample which will
|
7
|
+
# have a timestamp.
|
8
|
+
attr_reader :exit_timestamp
|
9
|
+
attr_reader :parent_segment
|
10
|
+
attr_reader :metric_name
|
11
|
+
attr_reader :segment_id
|
12
|
+
|
13
|
+
def initialize(timestamp, metric_name, segment_id)
|
14
|
+
@entry_timestamp = timestamp
|
15
|
+
@metric_name = metric_name || '<unknown>'
|
16
|
+
@segment_id = segment_id || object_id
|
17
|
+
end
|
18
|
+
|
19
|
+
def end_trace(timestamp)
|
20
|
+
@exit_timestamp = timestamp
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_called_segment(s)
|
24
|
+
@called_segments ||= []
|
25
|
+
@called_segments << s
|
26
|
+
s.parent_segment = self
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
to_debug_str(0)
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_json
|
34
|
+
hash = {
|
35
|
+
:entry_timestamp => @entry_timestamp,
|
36
|
+
:exit_timestamp => @exit_timestamp,
|
37
|
+
:metric_name => @metric_name,
|
38
|
+
:segment_id => @segment_id,
|
39
|
+
}
|
40
|
+
|
41
|
+
hash[:called_segments] = called_segments if !called_segments.empty?
|
42
|
+
hash[:params] = @params if @params && !@params.empty?
|
43
|
+
|
44
|
+
hash.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
def path_string
|
48
|
+
"#{metric_name}[#{called_segments.collect {|segment| segment.path_string }.join('')}]"
|
49
|
+
end
|
50
|
+
def to_s_compact
|
51
|
+
str = ""
|
52
|
+
str << metric_name
|
53
|
+
if called_segments.any?
|
54
|
+
str << "{#{called_segments.map { | cs | cs.to_s_compact }.join(",")}}"
|
55
|
+
end
|
56
|
+
str
|
57
|
+
end
|
58
|
+
def to_debug_str(depth)
|
59
|
+
tab = " " * depth
|
60
|
+
s = tab.clone
|
61
|
+
s << ">> #{'%3i ms' % (@entry_timestamp*1000)} [#{self.class.name.split("::").last}] #{metric_name} \n"
|
62
|
+
unless params.empty?
|
63
|
+
params.each do |k,v|
|
64
|
+
s << "#{tab} -#{'%-16s' % k}: #{v.to_s[0..80]}\n"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
called_segments.each do |cs|
|
68
|
+
s << cs.to_debug_str(depth + 1)
|
69
|
+
end
|
70
|
+
s << tab + "<< "
|
71
|
+
s << case @exit_timestamp
|
72
|
+
when nil then ' n/a'
|
73
|
+
when Numeric then '%3i ms' % (@exit_timestamp*1000)
|
74
|
+
else @exit_timestamp.to_s
|
75
|
+
end
|
76
|
+
s << " #{metric_name}\n"
|
77
|
+
end
|
78
|
+
|
79
|
+
def called_segments
|
80
|
+
@called_segments || []
|
81
|
+
end
|
82
|
+
|
83
|
+
# return the total duration of this segment
|
84
|
+
def duration
|
85
|
+
(@exit_timestamp - @entry_timestamp).to_f
|
86
|
+
end
|
87
|
+
|
88
|
+
# return the duration of this segment without
|
89
|
+
# including the time in the called segments
|
90
|
+
def exclusive_duration
|
91
|
+
d = duration
|
92
|
+
|
93
|
+
called_segments.each do |segment|
|
94
|
+
d -= segment.duration
|
95
|
+
end
|
96
|
+
d
|
97
|
+
end
|
98
|
+
def count_segments
|
99
|
+
count = 1
|
100
|
+
called_segments.each { | seg | count += seg.count_segments }
|
101
|
+
count
|
102
|
+
end
|
103
|
+
# Walk through the tree and truncate the segments
|
104
|
+
def truncate(max)
|
105
|
+
return 1 unless @called_segments
|
106
|
+
total, self.called_segments = truncate_each_child(max - 1)
|
107
|
+
total+1
|
108
|
+
end
|
109
|
+
|
110
|
+
def truncate_each_child(max)
|
111
|
+
total = 0
|
112
|
+
accumulator = []
|
113
|
+
called_segments.each { | s |
|
114
|
+
if total == max
|
115
|
+
true
|
116
|
+
else
|
117
|
+
total += s.truncate(max - total)
|
118
|
+
accumulator << s
|
119
|
+
end
|
120
|
+
}
|
121
|
+
total
|
122
|
+
[total, accumulator]
|
123
|
+
end
|
124
|
+
|
125
|
+
def []=(key, value)
|
126
|
+
# only create a parameters field if a parameter is set; this will save
|
127
|
+
# bandwidth etc as most segments have no parameters
|
128
|
+
params[key] = value
|
129
|
+
end
|
130
|
+
|
131
|
+
def [](key)
|
132
|
+
params[key]
|
133
|
+
end
|
134
|
+
|
135
|
+
def params
|
136
|
+
@params ||= {}
|
137
|
+
end
|
138
|
+
|
139
|
+
# call the provided block for this segment and each
|
140
|
+
# of the called segments
|
141
|
+
def each_segment(&block)
|
142
|
+
block.call self
|
143
|
+
|
144
|
+
if @called_segments
|
145
|
+
@called_segments.each do |segment|
|
146
|
+
segment.each_segment(&block)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def find_segment(id)
|
152
|
+
return self if @segment_id == id
|
153
|
+
called_segments.each do |segment|
|
154
|
+
found = segment.find_segment(id)
|
155
|
+
return found if found
|
156
|
+
end
|
157
|
+
nil
|
158
|
+
end
|
159
|
+
|
160
|
+
# Perform this in the runtime environment of a managed
|
161
|
+
# application, to explain the sql statement(s) executed within a
|
162
|
+
# segment of a transaction sample. Returns an array of
|
163
|
+
# explanations (which is an array rows consisting of an array of
|
164
|
+
# strings for each column returned by the the explain query)
|
165
|
+
# Note this happens only for statements whose execution time
|
166
|
+
# exceeds a threshold (e.g. 500ms) and only within the slowest
|
167
|
+
# transaction in a report period, selected for shipment to New
|
168
|
+
# Relic
|
169
|
+
def explain_sql
|
170
|
+
sql = params[:sql]
|
171
|
+
return nil unless sql && params[:connection_config]
|
172
|
+
statements = sql.split(";\n")
|
173
|
+
statements.map! do |statement|
|
174
|
+
# a small sleep to make sure we yield back to the parent
|
175
|
+
# thread regularly, if there are many explains
|
176
|
+
sleep(0.0001)
|
177
|
+
explain_statement(statement, params[:connection_config])
|
178
|
+
end
|
179
|
+
statements.compact!
|
180
|
+
statements
|
181
|
+
end
|
182
|
+
|
183
|
+
def explain_statement(statement, config)
|
184
|
+
if is_select?(statement)
|
185
|
+
handle_exception_in_explain do
|
186
|
+
connection = NewRelic::TransactionSample.get_connection(config)
|
187
|
+
process_resultset(connection.execute("EXPLAIN #{statement}")) if connection
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def is_select?(statement)
|
193
|
+
# split the string into at most two segments on the
|
194
|
+
# system-defined field separator character
|
195
|
+
first_word, rest_of_statement = statement.split($;, 2)
|
196
|
+
(first_word.upcase == 'SELECT')
|
197
|
+
end
|
198
|
+
|
199
|
+
def process_resultset(items)
|
200
|
+
# The resultset type varies for different drivers. Only thing you can count on is
|
201
|
+
# that it implements each. Also: can't use select_rows because the native postgres
|
202
|
+
# driver doesn't know that method.
|
203
|
+
|
204
|
+
if items.respond_to?(:each)
|
205
|
+
rows = []
|
206
|
+
items.each do |row|
|
207
|
+
columns = []
|
208
|
+
row.each do |column|
|
209
|
+
columns << column.to_s
|
210
|
+
end
|
211
|
+
rows << columns
|
212
|
+
end
|
213
|
+
rows
|
214
|
+
else
|
215
|
+
[items]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
|
220
|
+
def handle_exception_in_explain
|
221
|
+
yield
|
222
|
+
rescue Exception => e
|
223
|
+
begin
|
224
|
+
# guarantees no throw from explain_sql
|
225
|
+
NewRelic::Control.instance.log.error("Error getting explain plan: #{e.message}")
|
226
|
+
NewRelic::Control.instance.log.debug(e.backtrace.join("\n"))
|
227
|
+
rescue Exception
|
228
|
+
# double exception. throw up your hands
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
def params=(p)
|
234
|
+
@params = p
|
235
|
+
end
|
236
|
+
|
237
|
+
def obfuscated_sql
|
238
|
+
TransactionSample.obfuscate_sql(params[:sql])
|
239
|
+
end
|
240
|
+
|
241
|
+
def called_segments=(segments)
|
242
|
+
@called_segments = segments
|
243
|
+
end
|
244
|
+
|
245
|
+
protected
|
246
|
+
def parent_segment=(s)
|
247
|
+
@parent_segment = s
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'new_relic/transaction_sample'
|
2
|
+
require 'new_relic/transaction_sample/segment'
|
3
|
+
module NewRelic
|
4
|
+
class TransactionSample
|
5
|
+
class SummarySegment < Segment
|
6
|
+
def initialize(segment)
|
7
|
+
super segment.entry_timestamp, segment.metric_name, nil
|
8
|
+
|
9
|
+
add_segments segment.called_segments
|
10
|
+
|
11
|
+
end_trace segment.exit_timestamp
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_segments(segments)
|
15
|
+
segments.collect do |segment|
|
16
|
+
SummarySegment.new(segment)
|
17
|
+
end.each {|segment| add_called_segment(segment)}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Represents url mapping rules stored on the server. These rules should be applied
|
2
|
+
# to URLs which are not normalized into controller class/action by Rails routes.
|
3
|
+
# Insantiated strictly by Marshal.
|
4
|
+
class NewRelic::UrlRule
|
5
|
+
attr_reader :match_expression, :replacement, :eval_order, :terminate_chain
|
6
|
+
|
7
|
+
def apply url
|
8
|
+
return nil
|
9
|
+
end
|
10
|
+
|
11
|
+
class RuleSet
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
module NewRelic
|
3
|
+
module VERSION #:nodoc:
|
4
|
+
MAJOR = 3
|
5
|
+
MINOR = 1
|
6
|
+
TINY = 0
|
7
|
+
BUILD = nil #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
|
8
|
+
STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Helper class for managing version comparisons
|
12
|
+
class VersionNumber
|
13
|
+
attr_reader :parts
|
14
|
+
include Comparable
|
15
|
+
def initialize(version_string)
|
16
|
+
version_string ||= '1.0.0'
|
17
|
+
@parts = version_string.split('.').map{|n| n =~ /^\d+$/ ? n.to_i : n}
|
18
|
+
end
|
19
|
+
def major_version; @parts[0]; end
|
20
|
+
def minor_version; @parts[1]; end
|
21
|
+
def tiny_version; @parts[2]; end
|
22
|
+
|
23
|
+
def <=>(other)
|
24
|
+
other = self.class.new(other) if other.is_a? String
|
25
|
+
self.class.compare(self.parts, other.parts)
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_s
|
29
|
+
@parts.join(".")
|
30
|
+
end
|
31
|
+
|
32
|
+
def hash
|
33
|
+
@parts.hash
|
34
|
+
end
|
35
|
+
|
36
|
+
def eql? other
|
37
|
+
(self <=> other) == 0
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def self.compare(parts1, parts2)
|
42
|
+
a, b = parts1.first, parts2.first
|
43
|
+
case
|
44
|
+
when a.nil? && b.nil? then 0
|
45
|
+
when a.nil? then b.is_a?(Fixnum) ? -1 : 1
|
46
|
+
when b.nil? then -compare(parts2, parts1)
|
47
|
+
when a.to_s == b.to_s then compare(parts1[1..-1], parts2[1..-1])
|
48
|
+
when a.is_a?(String) then b.is_a?(Fixnum) ? -1 : (a <=> b)
|
49
|
+
when b.is_a?(String) then -compare(parts2, parts1)
|
50
|
+
else # they are both fixnums, not nil
|
51
|
+
a <=> b
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/newrelic_rpm.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# == New Relic Initialization
|
2
|
+
#
|
3
|
+
# When installed as a gem, you can activate the New Relic agent one of the following ways:
|
4
|
+
#
|
5
|
+
# For Rails, add:
|
6
|
+
# config.gem 'newrelic_rpm'
|
7
|
+
# to your initialization sequence.
|
8
|
+
#
|
9
|
+
# For merb, do
|
10
|
+
# dependency 'newrelic_rpm'
|
11
|
+
# in the Merb config/init.rb
|
12
|
+
#
|
13
|
+
# For Sinatra, do
|
14
|
+
# require 'newrelic_rpm'
|
15
|
+
# after requiring 'sinatra'.
|
16
|
+
#
|
17
|
+
# For other frameworks, or to manage the agent manually, invoke NewRelic::Agent#manual_start
|
18
|
+
# directly.
|
19
|
+
#
|
20
|
+
require 'new_relic/control'
|
21
|
+
if defined? Merb
|
22
|
+
module NewRelic
|
23
|
+
class MerbBootLoader < Merb::BootLoader
|
24
|
+
after Merb::BootLoader::ChooseAdapter
|
25
|
+
def self.run
|
26
|
+
NewRelic::Control.instance.init_plugin
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
elsif defined? Rails
|
31
|
+
if Rails.respond_to?(:version) && Rails.version =~ /^3/
|
32
|
+
module NewRelic
|
33
|
+
class Railtie < Rails::Railtie
|
34
|
+
|
35
|
+
initializer "newrelic_rpm.start_plugin" do |app|
|
36
|
+
NewRelic::Control.instance.init_plugin(:config => app.config)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
else
|
41
|
+
# After verison 2.0 of Rails we can access the configuration directly.
|
42
|
+
# We need it to add dev mode routes after initialization finished.
|
43
|
+
config = nil
|
44
|
+
config = Rails.configuration if Rails.respond_to?(:configuration)
|
45
|
+
NewRelic::Control.instance.init_plugin :config => config
|
46
|
+
end
|
47
|
+
else
|
48
|
+
NewRelic::Control.instance.init_plugin
|
49
|
+
end
|
data/lib/tasks/all.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# run unit tests for the NewRelic Agent
|
2
|
+
begin
|
3
|
+
require 'rake/test_task'
|
4
|
+
rescue LoadError => e
|
5
|
+
end
|
6
|
+
|
7
|
+
if defined? Rake::TestTask
|
8
|
+
namespace :test do
|
9
|
+
AGENT_HOME = File.expand_path(File.join(File.dirname(__FILE__), "..",".."))
|
10
|
+
Rake::TestTask.new(:newrelic) do |t|
|
11
|
+
t.libs << "#{AGENT_HOME}/test"
|
12
|
+
t.libs << "#{AGENT_HOME}/lib"
|
13
|
+
t.pattern = "#{AGENT_HOME}/test/**/*_test.rb"
|
14
|
+
t.verbose = true
|
15
|
+
end
|
16
|
+
Rake::Task['test:newrelic'].comment = "Run the unit tests for the Agent"
|
17
|
+
task :newrelic => :environment
|
18
|
+
end
|
19
|
+
end
|
data/newrelic.yml
ADDED
@@ -0,0 +1,265 @@
|
|
1
|
+
#
|
2
|
+
# This file configures the New Relic Ruby Agent, New Relic monitors
|
3
|
+
# Rails applications with deep visibility and low overhead. For more
|
4
|
+
# information, visit www.newrelic.com
|
5
|
+
#
|
6
|
+
# Generated <%= Time.now.strftime('%B %d, %Y') %>, for version <%= NewRelic::VERSION::STRING %>
|
7
|
+
#
|
8
|
+
# <%= generated_for_user %>
|
9
|
+
|
10
|
+
|
11
|
+
# Here are the settings that are common to all environments
|
12
|
+
common: &default_settings
|
13
|
+
# ============================== LICENSE KEY ===============================
|
14
|
+
|
15
|
+
# You must specify the license key associated with your New Relic
|
16
|
+
# account. This key binds your Agent's data to your account in the
|
17
|
+
# New Relic service.
|
18
|
+
license_key: '<%= license_key %>'
|
19
|
+
|
20
|
+
# Agent Enabled (Rails Only)
|
21
|
+
# Use this setting to force the agent to run or not run.
|
22
|
+
# Default is 'auto' which means the agent will install and run only
|
23
|
+
# if a valid dispatcher such as Mongrel is running. This prevents
|
24
|
+
# it from running with Rake or the console. Set to false to
|
25
|
+
# completely turn the agent off regardless of the other settings.
|
26
|
+
# Valid values are true, false and auto.
|
27
|
+
#
|
28
|
+
# agent_enabled: auto
|
29
|
+
|
30
|
+
# Application Name Set this to be the name of your application as
|
31
|
+
# you'd like it show up in New Relic. The service will then auto-map
|
32
|
+
# instances of your application into an "application" on your
|
33
|
+
# dashboard page. If you want to map this instance into multiple
|
34
|
+
# apps, like "AJAX Requests" and "All UI" then specify a semicolon
|
35
|
+
# separated list of up to three distinct names, or a yaml list.
|
36
|
+
# Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
|
37
|
+
# Production, Staging, etc)
|
38
|
+
#
|
39
|
+
# Example:
|
40
|
+
#
|
41
|
+
# app_name:
|
42
|
+
# - Ajax Service
|
43
|
+
# - All Services
|
44
|
+
#
|
45
|
+
app_name: <%= @app_name %>
|
46
|
+
|
47
|
+
# When "true", the agent collects performance data about your
|
48
|
+
# application and reports this data to the New Relic service at
|
49
|
+
# newrelic.com. This global switch is normally overridden for each
|
50
|
+
# environment below. (formerly called 'enabled')
|
51
|
+
monitor_mode: true
|
52
|
+
|
53
|
+
# Developer mode should be off in every environment but
|
54
|
+
# development as it has very high overhead in memory.
|
55
|
+
developer_mode: false
|
56
|
+
|
57
|
+
# The newrelic agent generates its own log file to keep its logging
|
58
|
+
# information separate from that of your application. Specify its
|
59
|
+
# log level here.
|
60
|
+
log_level: info
|
61
|
+
|
62
|
+
# Optionally set the path to the log file This is expanded from the
|
63
|
+
# root directory (may be relative or absolute, e.g. 'log/' or
|
64
|
+
# '/var/log/') The agent will attempt to create this directory if it
|
65
|
+
# does not exist.
|
66
|
+
# log_file_path: 'log/'
|
67
|
+
|
68
|
+
# Optionally set the name of the log file, defaults to 'newrelic_agent.log'
|
69
|
+
# log_file_name: 'newrelic_agent.log'
|
70
|
+
|
71
|
+
# The newrelic agent communicates with the service via http by
|
72
|
+
# default. If you want to communicate via https to increase
|
73
|
+
# security, then turn on SSL by setting this value to true. Note,
|
74
|
+
# this will result in increased CPU overhead to perform the
|
75
|
+
# encryption involved in SSL communication, but this work is done
|
76
|
+
# asynchronously to the threads that process your application code,
|
77
|
+
# so it should not impact response times.
|
78
|
+
ssl: false
|
79
|
+
|
80
|
+
# EXPERIMENTAL: enable verification of the SSL certificate sent by
|
81
|
+
# the server. This setting has no effect unless SSL is enabled
|
82
|
+
# above. This may block your application. Only enable it if the data
|
83
|
+
# you send us needs end-to-end verified certificates.
|
84
|
+
#
|
85
|
+
# This means we cannot cache the DNS lookup, so each request to the
|
86
|
+
# service will perform a lookup. It also means that we cannot
|
87
|
+
# use a non-blocking lookup, so in a worst case, if you have DNS
|
88
|
+
# problems, your app may block indefinitely.
|
89
|
+
# verify_certificate: true
|
90
|
+
|
91
|
+
# Set your application's Apdex threshold value with the 'apdex_t'
|
92
|
+
# setting, in seconds. The apdex_t value determines the buckets used
|
93
|
+
# to compute your overall Apdex score.
|
94
|
+
# Requests that take less than apdex_t seconds to process will be
|
95
|
+
# classified as Satisfying transactions; more than apdex_t seconds
|
96
|
+
# as Tolerating transactions; and more than four times the apdex_t
|
97
|
+
# value as Frustrating transactions.
|
98
|
+
# For more about the Apdex standard, see
|
99
|
+
# http://support.newrelic.com/faqs/general/apdex
|
100
|
+
|
101
|
+
apdex_t: 0.5
|
102
|
+
|
103
|
+
#============================== Browser Monitoring ===============================
|
104
|
+
# New Relic Real User Monitoring gives you insight into the performance real users are
|
105
|
+
# experiencing with your website. This is accomplished by measuring the time it takes for
|
106
|
+
# your users' browsers to download and render your web pages by injecting a small amount
|
107
|
+
# of JavaScript code into the header and footer of each page.
|
108
|
+
browser_monitoring:
|
109
|
+
# By default the agent automatically injects the monitoring JavaScript
|
110
|
+
# into web pages. Set this attribute to false to turn off this behavior.
|
111
|
+
auto_instrument: true
|
112
|
+
|
113
|
+
# Proxy settings for connecting to the service.
|
114
|
+
#
|
115
|
+
# If a proxy is used, the host setting is required. Other settings
|
116
|
+
# are optional. Default port is 8080.
|
117
|
+
#
|
118
|
+
# proxy_host: hostname
|
119
|
+
# proxy_port: 8080
|
120
|
+
# proxy_user:
|
121
|
+
# proxy_pass:
|
122
|
+
|
123
|
+
|
124
|
+
# Tells transaction tracer and error collector (when enabled)
|
125
|
+
# whether or not to capture HTTP params. When true, frameworks can
|
126
|
+
# exclude HTTP parameters from being captured.
|
127
|
+
# Rails: the RoR filter_parameter_logging excludes parameters
|
128
|
+
# Java: create a config setting called "ignored_params" and set it to
|
129
|
+
# a comma separated list of HTTP parameter names.
|
130
|
+
# ex: ignored_params: credit_card, ssn, password
|
131
|
+
capture_params: false
|
132
|
+
|
133
|
+
|
134
|
+
# Transaction tracer captures deep information about slow
|
135
|
+
# transactions and sends this to the service once a
|
136
|
+
# minute. Included in the transaction is the exact call sequence of
|
137
|
+
# the transactions including any SQL statements issued.
|
138
|
+
transaction_tracer:
|
139
|
+
|
140
|
+
# Transaction tracer is enabled by default. Set this to false to
|
141
|
+
# turn it off. This feature is only available at the Professional
|
142
|
+
# and above product levels.
|
143
|
+
enabled: true
|
144
|
+
|
145
|
+
# Threshold in seconds for when to collect a transaction
|
146
|
+
# trace. When the response time of a controller action exceeds
|
147
|
+
# this threshold, a transaction trace will be recorded and sent to
|
148
|
+
# the service. Valid values are any float value, or (default)
|
149
|
+
# "apdex_f", which will use the threshold for an dissatisfying
|
150
|
+
# Apdex controller action - four times the Apdex T value.
|
151
|
+
transaction_threshold: apdex_f
|
152
|
+
|
153
|
+
# When transaction tracer is on, SQL statements can optionally be
|
154
|
+
# recorded. The recorder has three modes, "off" which sends no
|
155
|
+
# SQL, "raw" which sends the SQL statement in its original form,
|
156
|
+
# and "obfuscated", which strips out numeric and string literals
|
157
|
+
record_sql: obfuscated
|
158
|
+
|
159
|
+
# Threshold in seconds for when to collect stack trace for a SQL
|
160
|
+
# call. In other words, when SQL statements exceed this threshold,
|
161
|
+
# then capture and send the current stack trace. This is
|
162
|
+
# helpful for pinpointing where long SQL calls originate from
|
163
|
+
stack_trace_threshold: 0.500
|
164
|
+
|
165
|
+
# Determines whether the agent will capture query plans for slow
|
166
|
+
# SQL queries. Only supported in mysql and postgres. Should be
|
167
|
+
# set to false when using other adapters.
|
168
|
+
# explain_enabled: true
|
169
|
+
|
170
|
+
# Threshold for query execution time below which query plans will not
|
171
|
+
# not be captured. Relevant only when `explain_enabled` is true.
|
172
|
+
# explain_threshold: 0.5
|
173
|
+
|
174
|
+
# Error collector captures information about uncaught exceptions and
|
175
|
+
# sends them to the service for viewing
|
176
|
+
error_collector:
|
177
|
+
|
178
|
+
# Error collector is enabled by default. Set this to false to turn
|
179
|
+
# it off. This feature is only available at the Professional and above
|
180
|
+
# product levels
|
181
|
+
enabled: true
|
182
|
+
|
183
|
+
# Rails Only - tells error collector whether or not to capture a
|
184
|
+
# source snippet around the place of the error when errors are View
|
185
|
+
# related.
|
186
|
+
capture_source: true
|
187
|
+
|
188
|
+
# To stop specific errors from reporting to New Relic, set this property
|
189
|
+
# to comma separated values. Default is to ignore routing errors
|
190
|
+
# which are how 404's get triggered.
|
191
|
+
#
|
192
|
+
ignore_errors: ActionController::RoutingError
|
193
|
+
|
194
|
+
# (Advanced) Uncomment this to ensure the cpu and memory samplers
|
195
|
+
# won't run. Useful when you are using the agent to monitor an
|
196
|
+
# external resource
|
197
|
+
# disable_samplers: true
|
198
|
+
|
199
|
+
# If you aren't interested in visibility in these areas, you can
|
200
|
+
# disable the instrumentation to reduce overhead.
|
201
|
+
#
|
202
|
+
# disable_view_instrumentation: true
|
203
|
+
# disable_activerecord_instrumentation: true
|
204
|
+
# disable_memcache_instrumentation: true
|
205
|
+
# disable_dj: true
|
206
|
+
|
207
|
+
# If you're interested in capturing memcache keys as though they
|
208
|
+
# were SQL uncomment this flag. Note that this does increase
|
209
|
+
# overhead slightly on every memcached call, and can have security
|
210
|
+
# implications if your memcached keys are sensitive
|
211
|
+
# capture_memcache_keys: true
|
212
|
+
|
213
|
+
# Certain types of instrumentation such as GC stats will not work if
|
214
|
+
# you are running multi-threaded. Please let us know.
|
215
|
+
# multi_threaded = false
|
216
|
+
|
217
|
+
# Application Environments
|
218
|
+
# ------------------------------------------
|
219
|
+
# Environment specific settings are in this section.
|
220
|
+
# For Rails applications, RAILS_ENV is used to determine the environment
|
221
|
+
# For Java applications, pass -Dnewrelic.environment <environment> to set
|
222
|
+
# the environment
|
223
|
+
|
224
|
+
# NOTE if your application has other named environments, you should
|
225
|
+
# provide newrelic configuration settings for these environments here.
|
226
|
+
|
227
|
+
development:
|
228
|
+
<<: *default_settings
|
229
|
+
# Turn off communication to New Relic service in development mode (also
|
230
|
+
# 'enabled').
|
231
|
+
# NOTE: for initial evaluation purposes, you may want to temporarily
|
232
|
+
# turn the agent on in development mode.
|
233
|
+
monitor_mode: false
|
234
|
+
|
235
|
+
# Rails Only - when running in Developer Mode, the New Relic Agent will
|
236
|
+
# present performance information on the last 100 transactions you have
|
237
|
+
# executed since starting the mongrel.
|
238
|
+
# NOTE: There is substantial overhead when running in developer mode.
|
239
|
+
# Do not use for production or load testing.
|
240
|
+
developer_mode: true
|
241
|
+
|
242
|
+
# Enable textmate links
|
243
|
+
# textmate: true
|
244
|
+
|
245
|
+
test:
|
246
|
+
<<: *default_settings
|
247
|
+
# It almost never makes sense to turn on the agent when running
|
248
|
+
# unit, functional or integration tests or the like.
|
249
|
+
monitor_mode: false
|
250
|
+
|
251
|
+
# Turn on the agent in production for 24x7 monitoring. NewRelic
|
252
|
+
# testing shows an average performance impact of < 5 ms per
|
253
|
+
# transaction, you you can leave this on all the time without
|
254
|
+
# incurring any user-visible performance degradation.
|
255
|
+
production:
|
256
|
+
<<: *default_settings
|
257
|
+
monitor_mode: true
|
258
|
+
|
259
|
+
# Many applications have a staging environment which behaves
|
260
|
+
# identically to production. Support for that environment is provided
|
261
|
+
# here. By default, the staging environment has the agent turned on.
|
262
|
+
staging:
|
263
|
+
<<: *default_settings
|
264
|
+
monitor_mode: true
|
265
|
+
app_name: <%= @app_name %> (Staging)
|