newrelic_rpm 2.10.6 → 2.10.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of newrelic_rpm might be problematic. Click here for more details.
- data/CHANGELOG +14 -0
- data/lib/new_relic/agent.rb +5 -4
- data/lib/new_relic/agent/agent.rb +81 -101
- data/lib/new_relic/agent/error_collector.rb +1 -2
- data/lib/new_relic/agent/instrumentation/authlogic.rb +2 -2
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +2 -2
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +45 -0
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +21 -0
- data/lib/new_relic/agent/method_tracer.rb +2 -2
- data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +1 -1
- data/lib/new_relic/agent/stats_engine/samplers.rb +1 -2
- data/lib/new_relic/agent/transaction_sampler.rb +1 -1
- data/lib/new_relic/agent/worker_loop.rb +47 -86
- data/lib/new_relic/{agent/collection_helper.rb → collection_helper.rb} +2 -4
- data/lib/new_relic/control.rb +18 -2
- data/lib/new_relic/control/rails3.rb +75 -0
- data/lib/new_relic/local_environment.rb +11 -3
- data/lib/new_relic/noticed_error.rb +2 -1
- data/lib/new_relic/version.rb +10 -9
- data/newrelic_rpm.gemspec +195 -3
- data/rdoc/classes/NewRelic.html +293 -0
- data/rdoc/classes/NewRelic/Agent.html +810 -0
- data/rdoc/classes/NewRelic/Agent/Agent.html +742 -0
- data/rdoc/classes/NewRelic/Agent/BackgroundLoadingError.html +111 -0
- data/rdoc/classes/NewRelic/Agent/BusyCalculator.html +309 -0
- data/rdoc/classes/NewRelic/Agent/CollectionHelper.html +196 -0
- data/rdoc/classes/NewRelic/Agent/ErrorCollector.html +378 -0
- data/rdoc/classes/NewRelic/Agent/ForceDisconnectException.html +118 -0
- data/rdoc/classes/NewRelic/Agent/ForceRestartException.html +117 -0
- data/rdoc/classes/NewRelic/Agent/IgnoreSilentlyException.html +118 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation.html +174 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/ActiveRecordInstrumentation.html +221 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/ControllerInstrumentation.html +349 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/ControllerInstrumentation/ClassMethods.html +277 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/DelayedJobInstrumentation.html +112 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/MetricFrame.html +1007 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/Rack.html +321 -0
- data/rdoc/classes/NewRelic/Agent/Instrumentation/Sinatra.html +176 -0
- data/rdoc/classes/NewRelic/Agent/LicenseException.html +117 -0
- data/rdoc/classes/NewRelic/Agent/MethodTracer.html +150 -0
- data/rdoc/classes/NewRelic/Agent/MethodTracer/ClassMethods.html +295 -0
- data/rdoc/classes/NewRelic/Agent/MethodTracer/InstanceMethods.html +284 -0
- data/rdoc/classes/NewRelic/Agent/PostTooBigException.html +120 -0
- data/rdoc/classes/NewRelic/Agent/Sampler.html +314 -0
- data/rdoc/classes/NewRelic/Agent/Sampler/Unsupported.html +117 -0
- data/rdoc/classes/NewRelic/Agent/Samplers.html +126 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/CpuSampler.html +327 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/DelayedJobLockSampler.html +296 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler.html +321 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/Base.html +186 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/JavaHeapSampler.html +173 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/ProcStatus.html +216 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/ShellPS.html +207 -0
- data/rdoc/classes/NewRelic/Agent/Samplers/ObjectSampler.html +222 -0
- data/rdoc/classes/NewRelic/Agent/ServerError.html +117 -0
- data/rdoc/classes/NewRelic/Agent/ShimAgent.html +297 -0
- data/rdoc/classes/NewRelic/Agent/StatsEngine.html +204 -0
- data/rdoc/classes/NewRelic/Agent/StatsEngine/MetricStats.html +441 -0
- data/rdoc/classes/NewRelic/Agent/StatsEngine/Samplers.html +237 -0
- data/rdoc/classes/NewRelic/Agent/StatsEngine/ScopeStackElement.html +178 -0
- data/rdoc/classes/NewRelic/Agent/StatsEngine/Transactions.html +385 -0
- data/rdoc/classes/NewRelic/Agent/TransactionSampleBuilder.html +505 -0
- data/rdoc/classes/NewRelic/Agent/TransactionSampler.html +690 -0
- data/rdoc/classes/NewRelic/Agent/WorkerLoop.html +305 -0
- data/rdoc/classes/NewRelic/Agent/WorkerLoop/LoopTask.html +224 -0
- data/rdoc/classes/NewRelic/ApdexStats.html +196 -0
- data/rdoc/classes/NewRelic/BasicStats.html +113 -0
- data/rdoc/classes/NewRelic/ChainedCall.html +180 -0
- data/rdoc/classes/NewRelic/Commands.html +112 -0
- data/rdoc/classes/NewRelic/Commands/CommandFailure.html +167 -0
- data/rdoc/classes/NewRelic/Commands/Deployments.html +285 -0
- data/rdoc/classes/NewRelic/Control.html +1760 -0
- data/rdoc/classes/NewRelic/Control/External.html +148 -0
- data/rdoc/classes/NewRelic/Control/Merb.html +227 -0
- data/rdoc/classes/NewRelic/Control/Rails.html +542 -0
- data/rdoc/classes/NewRelic/Control/Ruby.html +266 -0
- data/rdoc/classes/NewRelic/Control/Sinatra.html +178 -0
- data/rdoc/classes/NewRelic/DelayedJobInjection.html +118 -0
- data/rdoc/classes/NewRelic/Histogram.html +226 -0
- data/rdoc/classes/NewRelic/Histogram/Bucket.html +319 -0
- data/rdoc/classes/NewRelic/Histogram/Shim.html +144 -0
- data/rdoc/classes/NewRelic/LocalEnvironment.html +572 -0
- data/rdoc/classes/NewRelic/MerbBootLoader.html +146 -0
- data/rdoc/classes/NewRelic/MethodTraceStats.html +250 -0
- data/rdoc/classes/NewRelic/MetricData.html +347 -0
- data/rdoc/classes/NewRelic/MetricParser.html +747 -0
- data/rdoc/classes/NewRelic/MetricParser/ActionMailer.html +170 -0
- data/rdoc/classes/NewRelic/MetricParser/ActiveMerchant.html +267 -0
- data/rdoc/classes/NewRelic/MetricParser/ActiveRecord.html +250 -0
- data/rdoc/classes/NewRelic/MetricParser/Controller.html +363 -0
- data/rdoc/classes/NewRelic/MetricParser/ControllerCPU.html +319 -0
- data/rdoc/classes/NewRelic/MetricParser/Errors.html +170 -0
- data/rdoc/classes/NewRelic/MetricParser/External.html +339 -0
- data/rdoc/classes/NewRelic/MetricParser/MemCache.html +340 -0
- data/rdoc/classes/NewRelic/MetricParser/OtherTransaction.html +205 -0
- data/rdoc/classes/NewRelic/MetricParser/View.html +381 -0
- data/rdoc/classes/NewRelic/MetricParser/WebFrontend.html +182 -0
- data/rdoc/classes/NewRelic/MetricParser/WebService.html +172 -0
- data/rdoc/classes/NewRelic/MetricSpec.html +406 -0
- data/rdoc/classes/NewRelic/Metrics.html +138 -0
- data/rdoc/classes/NewRelic/NoticedError.html +200 -0
- data/rdoc/classes/NewRelic/Rack.html +112 -0
- data/rdoc/classes/NewRelic/Rack/MetricApp.html +193 -0
- data/rdoc/classes/NewRelic/Rack/Status.html +165 -0
- data/rdoc/classes/NewRelic/ScopedMethodTraceStats.html +225 -0
- data/rdoc/classes/NewRelic/Stats.html +917 -0
- data/rdoc/classes/NewRelic/StatsBase.html +346 -0
- data/rdoc/classes/NewRelic/TransactionAnalysis.html +269 -0
- data/rdoc/classes/NewRelic/TransactionAnalysis/SegmentSummary.html +338 -0
- data/rdoc/classes/NewRelic/TransactionSample.html +766 -0
- data/rdoc/classes/NewRelic/TransactionSample/CompositeSegment.html +195 -0
- data/rdoc/classes/NewRelic/TransactionSample/FakeSegment.html +113 -0
- data/rdoc/classes/NewRelic/TransactionSample/IDGenerator.html +178 -0
- data/rdoc/classes/NewRelic/TransactionSample/Segment.html +920 -0
- data/rdoc/classes/NewRelic/TransactionSample/SummarySegment.html +180 -0
- data/rdoc/classes/NewRelic/VersionNumber.html +338 -0
- data/rdoc/classes/NewRelicApi.html +270 -0
- data/rdoc/classes/NewRelicApi/Account.html +178 -0
- data/rdoc/classes/NewRelicApi/Account/AccountUsage.html +111 -0
- data/rdoc/classes/NewRelicApi/Account/AccountView.html +146 -0
- data/rdoc/classes/NewRelicApi/Application.html +139 -0
- data/rdoc/classes/NewRelicApi/Application/Agent.html +119 -0
- data/rdoc/classes/NewRelicApi/Deployment.html +123 -0
- data/rdoc/classes/NewRelicApi/Subscription.html +111 -0
- data/rdoc/classes/NewRelicApi/ThresholdValue.html +174 -0
- data/rdoc/classes/NewRelicApi/User.html +111 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/CHANGELOG.html +649 -0
- data/rdoc/files/LICENSE.html +143 -0
- data/rdoc/files/lib/new_relic/agent/agent_rb.html +113 -0
- data/rdoc/files/lib/new_relic/agent/busy_calculator_rb.html +115 -0
- data/rdoc/files/lib/new_relic/agent/chained_call_rb.html +107 -0
- data/rdoc/files/lib/new_relic/agent/collection_helper_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/error_collector_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/active_merchant_rb.html +107 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/active_record_instrumentation_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/authlogic_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/controller_instrumentation_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/data_mapper_rb.html +191 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/delayed_job_instrumentation_rb.html +109 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/memcache_rb.html +152 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/merb/controller_rb.html +155 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/merb/errors_rb.html +107 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/metric_frame_rb.html +113 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/net_rb.html +172 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/passenger_instrumentation_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/rack_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/rails/action_controller_rb.html +152 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/rails/action_web_service_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/rails/errors_rb.html +167 -0
- data/rdoc/files/lib/new_relic/agent/instrumentation/sinatra_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/method_tracer_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/sampler_rb.html +116 -0
- data/rdoc/files/lib/new_relic/agent/samplers/cpu_sampler_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/samplers/delayed_job_lock_sampler_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/samplers/memory_sampler_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/samplers/object_sampler_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/shim_agent_rb.html +108 -0
- data/rdoc/files/lib/new_relic/agent/stats_engine/metric_stats_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/stats_engine/samplers_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/stats_engine/transactions_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/stats_engine_rb.html +110 -0
- data/rdoc/files/lib/new_relic/agent/transaction_sampler_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent/worker_loop_rb.html +101 -0
- data/rdoc/files/lib/new_relic/agent_rb.html +204 -0
- data/rdoc/files/lib/new_relic/commands/deployments_rb.html +119 -0
- data/rdoc/files/lib/new_relic/commands/new_relic_commands_rb.html +108 -0
- data/rdoc/files/lib/new_relic/control/external_rb.html +117 -0
- data/rdoc/files/lib/new_relic/control/merb_rb.html +101 -0
- data/rdoc/files/lib/new_relic/control/rails_rb.html +108 -0
- data/rdoc/files/lib/new_relic/control/ruby_rb.html +110 -0
- data/rdoc/files/lib/new_relic/control/sinatra_rb.html +108 -0
- data/rdoc/files/lib/new_relic/control_rb.html +116 -0
- data/rdoc/files/lib/new_relic/delayed_job_injection_rb.html +180 -0
- data/rdoc/files/lib/new_relic/histogram_rb.html +114 -0
- data/rdoc/files/lib/new_relic/local_environment_rb.html +111 -0
- data/rdoc/files/lib/new_relic/merbtasks_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_data_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/action_mailer_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/active_merchant_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/active_record_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/controller_cpu_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/controller_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/errors_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/external_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/mem_cache_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/other_transaction_rb.html +108 -0
- data/rdoc/files/lib/new_relic/metric_parser/view_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser/web_frontend_rb.html +107 -0
- data/rdoc/files/lib/new_relic/metric_parser/web_service_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_parser_rb.html +101 -0
- data/rdoc/files/lib/new_relic/metric_spec_rb.html +108 -0
- data/rdoc/files/lib/new_relic/metrics_rb.html +101 -0
- data/rdoc/files/lib/new_relic/noticed_error_rb.html +107 -0
- data/rdoc/files/lib/new_relic/rack/metric_app_rb.html +108 -0
- data/rdoc/files/lib/new_relic/rack_app_rb.html +110 -0
- data/rdoc/files/lib/new_relic/recipes_rb.html +128 -0
- data/rdoc/files/lib/new_relic/stats_rb.html +101 -0
- data/rdoc/files/lib/new_relic/transaction_analysis_rb.html +108 -0
- data/rdoc/files/lib/new_relic/transaction_sample_rb.html +101 -0
- data/rdoc/files/lib/new_relic/version_rb.html +101 -0
- data/rdoc/files/lib/new_relic_api_rb.html +145 -0
- data/rdoc/files/lib/newrelic_rpm_rb.html +147 -0
- data/rdoc/files/lib/tasks/all_rb.html +107 -0
- data/rdoc/fr_class_index.html +134 -0
- data/rdoc/fr_file_index.html +103 -0
- data/rdoc/fr_method_index.html +568 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/test/new_relic/agent/active_record_instrumentation_test.rb +16 -5
- data/test/new_relic/agent/collection_helper_test.rb +1 -1
- data/test/new_relic/agent/error_collector_test.rb +2 -4
- data/test/new_relic/agent/rpm_agent_test.rb +1 -1
- data/test/new_relic/agent/task_instrumentation_test.rb +1 -1
- data/test/new_relic/agent/worker_loop_test.rb +33 -76
- data/test/new_relic/control_test.rb +9 -2
- data/test/new_relic/stats_test.rb +29 -1
- data/test/new_relic/version_number_test.rb +13 -0
- data/ui/helpers/newrelic_helper.rb +1 -2
- metadata +196 -4
@@ -0,0 +1,1760 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: NewRelic::Control</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">NewRelic::Control</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/new_relic/control_rb.html">
|
59
|
+
lib/new_relic/control.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
The <a href="Control.html">Control</a> is a singleton responsible for the
|
84
|
+
startup and initialization sequence. The initializer uses a <a
|
85
|
+
href="LocalEnvironment.html">LocalEnvironment</a> to detect the <a
|
86
|
+
href="Control.html#M000424">framework</a> and instantiates the <a
|
87
|
+
href="Control.html#M000424">framework</a> specific subclass.
|
88
|
+
</p>
|
89
|
+
<p>
|
90
|
+
The <a href="Control.html">Control</a> also implements some of the public
|
91
|
+
API for the agent.
|
92
|
+
</p>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div id="method-list">
|
100
|
+
<h3 class="section-bar">Methods</h3>
|
101
|
+
|
102
|
+
<div class="name-list">
|
103
|
+
<a href="#M000409">[]</a>
|
104
|
+
<a href="#M000411">[]=</a>
|
105
|
+
<a href="#M000441">add_instrumentation</a>
|
106
|
+
<a href="#M000422">agent_enabled?</a>
|
107
|
+
<a href="#M000414">apdex_t</a>
|
108
|
+
<a href="#M000433">api_server</a>
|
109
|
+
<a href="#M000423">app</a>
|
110
|
+
<a href="#M000427">app_names</a>
|
111
|
+
<a href="#M000413">append_environment_info</a>
|
112
|
+
<a href="#M000444">append_environment_info</a>
|
113
|
+
<a href="#M000416">capture_params</a>
|
114
|
+
<a href="#M000449">config_file</a>
|
115
|
+
<a href="#M000445">convert_to_ip_address</a>
|
116
|
+
<a href="#M000418">developer_mode?</a>
|
117
|
+
<a href="#M000426">dispatcher</a>
|
118
|
+
<a href="#M000425">dispatcher_instance_id</a>
|
119
|
+
<a href="#M000412">fetch</a>
|
120
|
+
<a href="#M000424">framework</a>
|
121
|
+
<a href="#M000436">http_connection</a>
|
122
|
+
<a href="#M000407">init_plugin</a>
|
123
|
+
<a href="#M000442">install_instrumentation</a>
|
124
|
+
<a href="#M000440">install_shim</a>
|
125
|
+
<a href="#M000406">instance</a>
|
126
|
+
<a href="#M000415">license_key</a>
|
127
|
+
<a href="#M000455">load_instrumentation_files</a>
|
128
|
+
<a href="#M000443">load_samplers</a>
|
129
|
+
<a href="#M000438">log</a>
|
130
|
+
<a href="#M000439">log!</a>
|
131
|
+
<a href="#M000450">log_path</a>
|
132
|
+
<a href="#M000446">merge_defaults</a>
|
133
|
+
<a href="#M000417">monitor_mode?</a>
|
134
|
+
<a href="#M000419">multi_threaded?</a>
|
135
|
+
<a href="#M000452">new</a>
|
136
|
+
<a href="#M000451">new_instance</a>
|
137
|
+
<a href="#M000454">newrelic_root</a>
|
138
|
+
<a href="#M000453">newrelic_root</a>
|
139
|
+
<a href="#M000421">post_size_limit</a>
|
140
|
+
<a href="#M000405">profiling=</a>
|
141
|
+
<a href="#M000403">profiling?</a>
|
142
|
+
<a href="#M000404">profiling_available?</a>
|
143
|
+
<a href="#M000434">proxy_server</a>
|
144
|
+
<a href="#M000432">server</a>
|
145
|
+
<a href="#M000435">server_from_host</a>
|
146
|
+
<a href="#M000410">settings</a>
|
147
|
+
<a href="#M000447">setup_log</a>
|
148
|
+
<a href="#M000408">start_agent</a>
|
149
|
+
<a href="#M000437">to_s</a>
|
150
|
+
<a href="#M000448">to_stdout</a>
|
151
|
+
<a href="#M000430">use_ssl?</a>
|
152
|
+
<a href="#M000420">use_textmate?</a>
|
153
|
+
<a href="#M000428">validate_seed</a>
|
154
|
+
<a href="#M000429">validate_token</a>
|
155
|
+
<a href="#M000431">verify_certificate?</a>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
<!-- if includes -->
|
163
|
+
|
164
|
+
<div id="section">
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<div id="attribute-list">
|
171
|
+
<h3 class="section-bar">Attributes</h3>
|
172
|
+
|
173
|
+
<div class="name-list">
|
174
|
+
<table>
|
175
|
+
<tr class="top-aligned-row context-row">
|
176
|
+
<td class="context-item-name">env</td>
|
177
|
+
<td class="context-item-value"> [W] </td>
|
178
|
+
<td class="context-item-desc">
|
179
|
+
The env is the setting used to identify which section of the newrelic.yml
|
180
|
+
to load. This defaults to a <a href="Control.html#M000424">framework</a>
|
181
|
+
specific value, such as ENV[‘RAILS_ENV’] but can be overridden
|
182
|
+
as long as you set it before calling <a
|
183
|
+
href="Control.html#M000407">init_plugin</a>
|
184
|
+
|
185
|
+
</td>
|
186
|
+
</tr>
|
187
|
+
<tr class="top-aligned-row context-row">
|
188
|
+
<td class="context-item-name">local_env</td>
|
189
|
+
<td class="context-item-value"> [R] </td>
|
190
|
+
<td class="context-item-desc"></td>
|
191
|
+
</tr>
|
192
|
+
<tr class="top-aligned-row context-row">
|
193
|
+
<td class="context-item-name">log_file</td>
|
194
|
+
<td class="context-item-value"> [RW] </td>
|
195
|
+
<td class="context-item-desc"></td>
|
196
|
+
</tr>
|
197
|
+
</table>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<!-- if method_list -->
|
204
|
+
<div id="methods">
|
205
|
+
<h3 class="section-bar">Public Class methods</h3>
|
206
|
+
|
207
|
+
<div id="method-M000406" class="method-detail">
|
208
|
+
<a name="M000406"></a>
|
209
|
+
|
210
|
+
<div class="method-heading">
|
211
|
+
<a href="#M000406" class="method-signature">
|
212
|
+
<span class="method-name">instance</span><span class="method-args">()</span>
|
213
|
+
</a>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
<p>
|
218
|
+
Access the <a href="Control.html">Control</a> singleton, lazy initialized
|
219
|
+
</p>
|
220
|
+
<p><a class="source-toggle" href="#"
|
221
|
+
onclick="toggleCode('M000406-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000406-source">
|
223
|
+
<pre>
|
224
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 53</span>
|
225
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance</span>
|
226
|
+
<span class="ruby-ivar">@instance</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">new_instance</span>
|
227
|
+
<span class="ruby-keyword kw">end</span>
|
228
|
+
</pre>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="method-M000452" class="method-detail">
|
234
|
+
<a name="M000452"></a>
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<a href="#M000452" class="method-signature">
|
238
|
+
<span class="method-name">new</span><span class="method-args">(local_env)</span>
|
239
|
+
</a>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="method-description">
|
243
|
+
<p><a class="source-toggle" href="#"
|
244
|
+
onclick="toggleCode('M000452-source');return false;">[Source]</a></p>
|
245
|
+
<div class="method-source-code" id="M000452-source">
|
246
|
+
<pre>
|
247
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 457</span>
|
248
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">local_env</span>
|
249
|
+
<span class="ruby-ivar">@local_env</span> = <span class="ruby-identifier">local_env</span>
|
250
|
+
<span class="ruby-ivar">@instrumentation_files</span> = []
|
251
|
+
<span class="ruby-identifier">newrelic_file</span> = <span class="ruby-identifier">config_file</span>
|
252
|
+
<span class="ruby-comment cmt"># Next two are for populating the newrelic.yml via erb binding, necessary</span>
|
253
|
+
<span class="ruby-comment cmt"># when using the default newrelic.yml file</span>
|
254
|
+
<span class="ruby-identifier">generated_for_user</span> = <span class="ruby-value str">''</span>
|
255
|
+
<span class="ruby-identifier">license_key</span>=<span class="ruby-value str">''</span>
|
256
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">config_file</span>)
|
257
|
+
<span class="ruby-identifier">log!</span> <span class="ruby-node">"Cannot find newrelic.yml file at #{config_file}."</span>
|
258
|
+
<span class="ruby-ivar">@yaml</span> = {}
|
259
|
+
<span class="ruby-keyword kw">else</span>
|
260
|
+
<span class="ruby-ivar">@yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">config_file</span>)).<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>))
|
261
|
+
<span class="ruby-keyword kw">end</span>
|
262
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ScriptError</span>, <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
263
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>
|
264
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
265
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Error reading newrelic.yml file: #{e}"</span>
|
266
|
+
<span class="ruby-keyword kw">end</span>
|
267
|
+
</pre>
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<h3 class="section-bar">Protected Class methods</h3>
|
273
|
+
|
274
|
+
<div id="method-M000451" class="method-detail">
|
275
|
+
<a name="M000451"></a>
|
276
|
+
|
277
|
+
<div class="method-heading">
|
278
|
+
<a href="#M000451" class="method-signature">
|
279
|
+
<span class="method-name">new_instance</span><span class="method-args">()</span>
|
280
|
+
</a>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<div class="method-description">
|
284
|
+
<p>
|
285
|
+
Create the concrete class for environment specific behavior:
|
286
|
+
</p>
|
287
|
+
<p><a class="source-toggle" href="#"
|
288
|
+
onclick="toggleCode('M000451-source');return false;">[Source]</a></p>
|
289
|
+
<div class="method-source-code" id="M000451-source">
|
290
|
+
<pre>
|
291
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 443</span>
|
292
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_instance</span>
|
293
|
+
<span class="ruby-ivar">@local_env</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">LocalEnvironment</span>.<span class="ruby-identifier">new</span>
|
294
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">framework</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:test</span>
|
295
|
+
<span class="ruby-identifier">require</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">newrelic_root</span>, <span class="ruby-value str">"test"</span>, <span class="ruby-value str">"config"</span>, <span class="ruby-value str">"test_control.rb"</span>)
|
296
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Control</span><span class="ruby-operator">::</span><span class="ruby-constant">Test</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@local_env</span>
|
297
|
+
<span class="ruby-keyword kw">else</span>
|
298
|
+
<span class="ruby-keyword kw">begin</span>
|
299
|
+
<span class="ruby-identifier">require</span> <span class="ruby-node">"new_relic/control/#{@local_env.framework}.rb"</span>
|
300
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>
|
301
|
+
<span class="ruby-keyword kw">end</span>
|
302
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Control</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">framework</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>).<span class="ruby-identifier">new</span> <span class="ruby-ivar">@local_env</span>
|
303
|
+
<span class="ruby-keyword kw">end</span>
|
304
|
+
<span class="ruby-keyword kw">end</span>
|
305
|
+
</pre>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
<div id="method-M000453" class="method-detail">
|
311
|
+
<a name="M000453"></a>
|
312
|
+
|
313
|
+
<div class="method-heading">
|
314
|
+
<a href="#M000453" class="method-signature">
|
315
|
+
<span class="method-name">newrelic_root</span><span class="method-args">()</span>
|
316
|
+
</a>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
<div class="method-description">
|
320
|
+
<p>
|
321
|
+
The root directory for the plugin or gem
|
322
|
+
</p>
|
323
|
+
<p><a class="source-toggle" href="#"
|
324
|
+
onclick="toggleCode('M000453-source');return false;">[Source]</a></p>
|
325
|
+
<div class="method-source-code" id="M000453-source">
|
326
|
+
<pre>
|
327
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 478</span>
|
328
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">newrelic_root</span>
|
329
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>),<span class="ruby-value str">".."</span>,<span class="ruby-value str">".."</span>))
|
330
|
+
<span class="ruby-keyword kw">end</span>
|
331
|
+
</pre>
|
332
|
+
</div>
|
333
|
+
</div>
|
334
|
+
</div>
|
335
|
+
|
336
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
337
|
+
|
338
|
+
<div id="method-M000409" class="method-detail">
|
339
|
+
<a name="M000409"></a>
|
340
|
+
|
341
|
+
<div class="method-heading">
|
342
|
+
<a href="#M000409" class="method-signature">
|
343
|
+
<span class="method-name">[]</span><span class="method-args">(key)</span>
|
344
|
+
</a>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div class="method-description">
|
348
|
+
<p><a class="source-toggle" href="#"
|
349
|
+
onclick="toggleCode('M000409-source');return false;">[Source]</a></p>
|
350
|
+
<div class="method-source-code" id="M000409-source">
|
351
|
+
<pre>
|
352
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 121</span>
|
353
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
|
354
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>)
|
355
|
+
<span class="ruby-keyword kw">end</span>
|
356
|
+
</pre>
|
357
|
+
</div>
|
358
|
+
</div>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div id="method-M000411" class="method-detail">
|
362
|
+
<a name="M000411"></a>
|
363
|
+
|
364
|
+
<div class="method-heading">
|
365
|
+
<a href="#M000411" class="method-signature">
|
366
|
+
<span class="method-name">[]=</span><span class="method-args">(key, value)</span>
|
367
|
+
</a>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
<div class="method-description">
|
371
|
+
<p><a class="source-toggle" href="#"
|
372
|
+
onclick="toggleCode('M000411-source');return false;">[Source]</a></p>
|
373
|
+
<div class="method-source-code" id="M000411-source">
|
374
|
+
<pre>
|
375
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 142</span>
|
376
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
|
377
|
+
<span class="ruby-identifier">settings</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
|
378
|
+
<span class="ruby-keyword kw">end</span>
|
379
|
+
</pre>
|
380
|
+
</div>
|
381
|
+
</div>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
<div id="method-M000441" class="method-detail">
|
385
|
+
<a name="M000441"></a>
|
386
|
+
|
387
|
+
<div class="method-heading">
|
388
|
+
<a href="#M000441" class="method-signature">
|
389
|
+
<span class="method-name">add_instrumentation</span><span class="method-args">(pattern)</span>
|
390
|
+
</a>
|
391
|
+
</div>
|
392
|
+
|
393
|
+
<div class="method-description">
|
394
|
+
<p>
|
395
|
+
Add instrumentation. Don‘t call this directly. Use <a
|
396
|
+
href="Agent.html#M000112">NewRelic::Agent#add_instrumentation</a>. This
|
397
|
+
will load the file synchronously if we‘ve already loaded the default
|
398
|
+
instrumentation.
|
399
|
+
</p>
|
400
|
+
<p><a class="source-toggle" href="#"
|
401
|
+
onclick="toggleCode('M000441-source');return false;">[Source]</a></p>
|
402
|
+
<div class="method-source-code" id="M000441-source">
|
403
|
+
<pre>
|
404
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 319</span>
|
405
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_instrumentation</span> <span class="ruby-identifier">pattern</span>
|
406
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instrumented</span>
|
407
|
+
<span class="ruby-identifier">load_instrumentation_files</span> <span class="ruby-identifier">pattern</span>
|
408
|
+
<span class="ruby-keyword kw">else</span>
|
409
|
+
<span class="ruby-ivar">@instrumentation_files</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">pattern</span>
|
410
|
+
<span class="ruby-keyword kw">end</span>
|
411
|
+
<span class="ruby-keyword kw">end</span>
|
412
|
+
</pre>
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
|
417
|
+
<div id="method-M000422" class="method-detail">
|
418
|
+
<a name="M000422"></a>
|
419
|
+
|
420
|
+
<div class="method-heading">
|
421
|
+
<a href="#M000422" class="method-signature">
|
422
|
+
<span class="method-name">agent_enabled?</span><span class="method-args">()</span>
|
423
|
+
</a>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
<div class="method-description">
|
427
|
+
<p>
|
428
|
+
True if dev mode or monitor mode are enabled, and we are running inside a
|
429
|
+
valid <a href="Control.html#M000426">dispatcher</a> like mongrel or
|
430
|
+
passenger. Can be overridden by NEWRELIC_ENABLE env variable,
|
431
|
+
monitor_daemons config option when true, or agent_enabled config option
|
432
|
+
when true or false.
|
433
|
+
</p>
|
434
|
+
<p><a class="source-toggle" href="#"
|
435
|
+
onclick="toggleCode('M000422-source');return false;">[Source]</a></p>
|
436
|
+
<div class="method-source-code" id="M000422-source">
|
437
|
+
<pre>
|
438
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 192</span>
|
439
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">agent_enabled?</span>
|
440
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">developer_mode?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">monitor_mode?</span>
|
441
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'agent_enabled'</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/true|on|yes/i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'agent_enabled'</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'agent_enabled'</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'auto'</span>
|
442
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'NEWRELIC_ENABLE'</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/false|off|no/i</span>
|
443
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'monitor_daemons'</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/true|on|yes/i</span>
|
444
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'NEWRELIC_ENABLE'</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/true|on|yes/i</span>
|
445
|
+
<span class="ruby-comment cmt"># When in 'auto' mode the agent is enabled if there is a known</span>
|
446
|
+
<span class="ruby-comment cmt"># dispatcher running</span>
|
447
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
448
|
+
<span class="ruby-keyword kw">end</span>
|
449
|
+
</pre>
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
</div>
|
453
|
+
|
454
|
+
<div id="method-M000414" class="method-detail">
|
455
|
+
<a name="M000414"></a>
|
456
|
+
|
457
|
+
<div class="method-heading">
|
458
|
+
<a href="#M000414" class="method-signature">
|
459
|
+
<span class="method-name">apdex_t</span><span class="method-args">()</span>
|
460
|
+
</a>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
<div class="method-description">
|
464
|
+
<p>
|
465
|
+
<a href="Agent.html">Agent</a> config conveniences
|
466
|
+
</p>
|
467
|
+
<p><a class="source-toggle" href="#"
|
468
|
+
onclick="toggleCode('M000414-source');return false;">[Source]</a></p>
|
469
|
+
<div class="method-source-code" id="M000414-source">
|
470
|
+
<pre>
|
471
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 159</span>
|
472
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apdex_t</span>
|
473
|
+
<span class="ruby-comment cmt"># Always initialized with a default</span>
|
474
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'apdex_t'</span>).<span class="ruby-identifier">to_f</span>
|
475
|
+
<span class="ruby-keyword kw">end</span>
|
476
|
+
</pre>
|
477
|
+
</div>
|
478
|
+
</div>
|
479
|
+
</div>
|
480
|
+
|
481
|
+
<div id="method-M000433" class="method-detail">
|
482
|
+
<a name="M000433"></a>
|
483
|
+
|
484
|
+
<div class="method-heading">
|
485
|
+
<a href="#M000433" class="method-signature">
|
486
|
+
<span class="method-name">api_server</span><span class="method-args">()</span>
|
487
|
+
</a>
|
488
|
+
</div>
|
489
|
+
|
490
|
+
<div class="method-description">
|
491
|
+
<p><a class="source-toggle" href="#"
|
492
|
+
onclick="toggleCode('M000433-source');return false;">[Source]</a></p>
|
493
|
+
<div class="method-source-code" id="M000433-source">
|
494
|
+
<pre>
|
495
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 237</span>
|
496
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">api_server</span>
|
497
|
+
<span class="ruby-identifier">api_host</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'api_host'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'rpm.newrelic.com'</span>
|
498
|
+
<span class="ruby-ivar">@api_server</span> <span class="ruby-operator">||=</span>
|
499
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Control</span><span class="ruby-operator">::</span><span class="ruby-constant">Server</span>.<span class="ruby-identifier">new</span> \
|
500
|
+
<span class="ruby-identifier">api_host</span>,
|
501
|
+
(<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'api_port'</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'port'</span>] <span class="ruby-operator">||</span> (<span class="ruby-identifier">use_ssl?</span> <span class="ruby-value">? </span><span class="ruby-value">443</span> <span class="ruby-operator">:</span> <span class="ruby-value">80</span>)).<span class="ruby-identifier">to_i</span>,
|
502
|
+
<span class="ruby-keyword kw">nil</span>
|
503
|
+
<span class="ruby-keyword kw">end</span>
|
504
|
+
</pre>
|
505
|
+
</div>
|
506
|
+
</div>
|
507
|
+
</div>
|
508
|
+
|
509
|
+
<div id="method-M000423" class="method-detail">
|
510
|
+
<a name="M000423"></a>
|
511
|
+
|
512
|
+
<div class="method-heading">
|
513
|
+
<a href="#M000423" class="method-signature">
|
514
|
+
<span class="method-name">app</span><span class="method-args">()</span>
|
515
|
+
</a>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
<div class="method-description">
|
519
|
+
<p><a class="source-toggle" href="#"
|
520
|
+
onclick="toggleCode('M000423-source');return false;">[Source]</a></p>
|
521
|
+
<div class="method-source-code" id="M000423-source">
|
522
|
+
<pre>
|
523
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 203</span>
|
524
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">app</span>
|
525
|
+
<span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">framework</span>
|
526
|
+
<span class="ruby-keyword kw">end</span>
|
527
|
+
</pre>
|
528
|
+
</div>
|
529
|
+
</div>
|
530
|
+
</div>
|
531
|
+
|
532
|
+
<div id="method-M000427" class="method-detail">
|
533
|
+
<a name="M000427"></a>
|
534
|
+
|
535
|
+
<div class="method-heading">
|
536
|
+
<a href="#M000427" class="method-signature">
|
537
|
+
<span class="method-name">app_names</span><span class="method-args">()</span>
|
538
|
+
</a>
|
539
|
+
</div>
|
540
|
+
|
541
|
+
<div class="method-description">
|
542
|
+
<p><a class="source-toggle" href="#"
|
543
|
+
onclick="toggleCode('M000427-source');return false;">[Source]</a></p>
|
544
|
+
<div class="method-source-code" id="M000427-source">
|
545
|
+
<pre>
|
546
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 214</span>
|
547
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">app_names</span>
|
548
|
+
<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'app_name'</span>] <span class="ruby-operator">?</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'app_name'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">';'</span>) <span class="ruby-operator">:</span> []
|
549
|
+
<span class="ruby-keyword kw">end</span>
|
550
|
+
</pre>
|
551
|
+
</div>
|
552
|
+
</div>
|
553
|
+
</div>
|
554
|
+
|
555
|
+
<div id="method-M000413" class="method-detail">
|
556
|
+
<a name="M000413"></a>
|
557
|
+
|
558
|
+
<div class="method-heading">
|
559
|
+
<a href="#M000413" class="method-signature">
|
560
|
+
<span class="method-name">append_environment_info</span><span class="method-args">(name, value)</span>
|
561
|
+
</a>
|
562
|
+
</div>
|
563
|
+
|
564
|
+
<div class="method-description">
|
565
|
+
<p>
|
566
|
+
Add your own environment value to track for change detection. The name and
|
567
|
+
value should be stable and not vary across <a
|
568
|
+
href="Control.html#M000423">app</a> processes on the same host.
|
569
|
+
</p>
|
570
|
+
<p><a class="source-toggle" href="#"
|
571
|
+
onclick="toggleCode('M000413-source');return false;">[Source]</a></p>
|
572
|
+
<div class="method-source-code" id="M000413-source">
|
573
|
+
<pre>
|
574
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 152</span>
|
575
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_environment_info</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
|
576
|
+
<span class="ruby-identifier">local_env</span>.<span class="ruby-identifier">record_environment_info</span>(<span class="ruby-identifier">name</span>,<span class="ruby-identifier">value</span>)
|
577
|
+
<span class="ruby-keyword kw">end</span>
|
578
|
+
</pre>
|
579
|
+
</div>
|
580
|
+
</div>
|
581
|
+
</div>
|
582
|
+
|
583
|
+
<div id="method-M000416" class="method-detail">
|
584
|
+
<a name="M000416"></a>
|
585
|
+
|
586
|
+
<div class="method-heading">
|
587
|
+
<a href="#M000416" class="method-signature">
|
588
|
+
<span class="method-name">capture_params</span><span class="method-args">()</span>
|
589
|
+
</a>
|
590
|
+
</div>
|
591
|
+
|
592
|
+
<div class="method-description">
|
593
|
+
<p><a class="source-toggle" href="#"
|
594
|
+
onclick="toggleCode('M000416-source');return false;">[Source]</a></p>
|
595
|
+
<div class="method-source-code" id="M000416-source">
|
596
|
+
<pre>
|
597
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 166</span>
|
598
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture_params</span>
|
599
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'capture_params'</span>)
|
600
|
+
<span class="ruby-keyword kw">end</span>
|
601
|
+
</pre>
|
602
|
+
</div>
|
603
|
+
</div>
|
604
|
+
</div>
|
605
|
+
|
606
|
+
<div id="method-M000418" class="method-detail">
|
607
|
+
<a name="M000418"></a>
|
608
|
+
|
609
|
+
<div class="method-heading">
|
610
|
+
<a href="#M000418" class="method-signature">
|
611
|
+
<span class="method-name">developer_mode?</span><span class="method-args">()</span>
|
612
|
+
</a>
|
613
|
+
</div>
|
614
|
+
|
615
|
+
<div class="method-description">
|
616
|
+
<p>
|
617
|
+
True if we are capturing data and displaying in /newrelic
|
618
|
+
</p>
|
619
|
+
<p><a class="source-toggle" href="#"
|
620
|
+
onclick="toggleCode('M000418-source');return false;">[Source]</a></p>
|
621
|
+
<div class="method-source-code" id="M000418-source">
|
622
|
+
<pre>
|
623
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 174</span>
|
624
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">developer_mode?</span>
|
625
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'developer_mode'</span>, <span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'developer'</span>))
|
626
|
+
<span class="ruby-keyword kw">end</span>
|
627
|
+
</pre>
|
628
|
+
</div>
|
629
|
+
</div>
|
630
|
+
</div>
|
631
|
+
|
632
|
+
<div id="method-M000426" class="method-detail">
|
633
|
+
<a name="M000426"></a>
|
634
|
+
|
635
|
+
<div class="method-heading">
|
636
|
+
<a href="#M000426" class="method-signature">
|
637
|
+
<span class="method-name">dispatcher</span><span class="method-args">()</span>
|
638
|
+
</a>
|
639
|
+
</div>
|
640
|
+
|
641
|
+
<div class="method-description">
|
642
|
+
<p><a class="source-toggle" href="#"
|
643
|
+
onclick="toggleCode('M000426-source');return false;">[Source]</a></p>
|
644
|
+
<div class="method-source-code" id="M000426-source">
|
645
|
+
<pre>
|
646
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 211</span>
|
647
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatcher</span>
|
648
|
+
(<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'dispatcher'</span>] <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'dispatcher'</span>].<span class="ruby-identifier">to_sym</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher</span>
|
649
|
+
<span class="ruby-keyword kw">end</span>
|
650
|
+
</pre>
|
651
|
+
</div>
|
652
|
+
</div>
|
653
|
+
</div>
|
654
|
+
|
655
|
+
<div id="method-M000425" class="method-detail">
|
656
|
+
<a name="M000425"></a>
|
657
|
+
|
658
|
+
<div class="method-heading">
|
659
|
+
<a href="#M000425" class="method-signature">
|
660
|
+
<span class="method-name">dispatcher_instance_id</span><span class="method-args">()</span>
|
661
|
+
</a>
|
662
|
+
</div>
|
663
|
+
|
664
|
+
<div class="method-description">
|
665
|
+
<p><a class="source-toggle" href="#"
|
666
|
+
onclick="toggleCode('M000425-source');return false;">[Source]</a></p>
|
667
|
+
<div class="method-source-code" id="M000425-source">
|
668
|
+
<pre>
|
669
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 208</span>
|
670
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatcher_instance_id</span>
|
671
|
+
<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'dispatcher_instance_id'</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher_instance_id</span>
|
672
|
+
<span class="ruby-keyword kw">end</span>
|
673
|
+
</pre>
|
674
|
+
</div>
|
675
|
+
</div>
|
676
|
+
</div>
|
677
|
+
|
678
|
+
<div id="method-M000412" class="method-detail">
|
679
|
+
<a name="M000412"></a>
|
680
|
+
|
681
|
+
<div class="method-heading">
|
682
|
+
<a href="#M000412" class="method-signature">
|
683
|
+
<span class="method-name">fetch</span><span class="method-args">(key, default=nil)</span>
|
684
|
+
</a>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
<div class="method-description">
|
688
|
+
<p><a class="source-toggle" href="#"
|
689
|
+
onclick="toggleCode('M000412-source');return false;">[Source]</a></p>
|
690
|
+
<div class="method-source-code" id="M000412-source">
|
691
|
+
<pre>
|
692
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 146</span>
|
693
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">default</span>=<span class="ruby-keyword kw">nil</span>)
|
694
|
+
<span class="ruby-identifier">settings</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">default</span>)
|
695
|
+
<span class="ruby-keyword kw">end</span>
|
696
|
+
</pre>
|
697
|
+
</div>
|
698
|
+
</div>
|
699
|
+
</div>
|
700
|
+
|
701
|
+
<div id="method-M000424" class="method-detail">
|
702
|
+
<a name="M000424"></a>
|
703
|
+
|
704
|
+
<div class="method-heading">
|
705
|
+
<span class="method-name">framework</span><span class="method-args">()</span>
|
706
|
+
</div>
|
707
|
+
|
708
|
+
<div class="method-description">
|
709
|
+
<p>
|
710
|
+
Alias for <a href="Control.html#M000423">app</a>
|
711
|
+
</p>
|
712
|
+
</div>
|
713
|
+
</div>
|
714
|
+
|
715
|
+
<div id="method-M000436" class="method-detail">
|
716
|
+
<a name="M000436"></a>
|
717
|
+
|
718
|
+
<div class="method-heading">
|
719
|
+
<a href="#M000436" class="method-signature">
|
720
|
+
<span class="method-name">http_connection</span><span class="method-args">(host = nil)</span>
|
721
|
+
</a>
|
722
|
+
</div>
|
723
|
+
|
724
|
+
<div class="method-description">
|
725
|
+
<p>
|
726
|
+
Return the Net::HTTP with proxy configuration given the
|
727
|
+
NewRelic::Control::Server object. Default is the collector but for api
|
728
|
+
calls you need to pass <a href="Control.html#M000433">api_server</a>
|
729
|
+
</p>
|
730
|
+
<p>
|
731
|
+
Experimental support for SSL verification: swap ‘VERIFY_NONE’
|
732
|
+
for ‘VERIFY_PEER’ line to try it out If verification fails,
|
733
|
+
uncomment the ‘http.ca_file’ line and it will use the included
|
734
|
+
certificate.
|
735
|
+
</p>
|
736
|
+
<p><a class="source-toggle" href="#"
|
737
|
+
onclick="toggleCode('M000436-source');return false;">[Source]</a></p>
|
738
|
+
<div class="method-source-code" id="M000436-source">
|
739
|
+
<pre>
|
740
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 265</span>
|
741
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_connection</span>(<span class="ruby-identifier">host</span> = <span class="ruby-keyword kw">nil</span>)
|
742
|
+
<span class="ruby-identifier">host</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">server</span>
|
743
|
+
<span class="ruby-comment cmt"># Proxy returns regular HTTP if @proxy_host is nil (the default)</span>
|
744
|
+
<span class="ruby-identifier">http_class</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Proxy</span>(<span class="ruby-identifier">proxy_server</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">proxy_server</span>.<span class="ruby-identifier">port</span>,
|
745
|
+
<span class="ruby-identifier">proxy_server</span>.<span class="ruby-identifier">user</span>, <span class="ruby-identifier">proxy_server</span>.<span class="ruby-identifier">password</span>)
|
746
|
+
<span class="ruby-identifier">http</span> = <span class="ruby-identifier">http_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">host</span>.<span class="ruby-identifier">ip</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">host</span>.<span class="ruby-identifier">port</span>)
|
747
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"Http Connection opened to #{host.ip||host.name}:#{host.port}"</span>)
|
748
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">use_ssl?</span>
|
749
|
+
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword kw">true</span>
|
750
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verify_certificate?</span>
|
751
|
+
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_PEER</span>
|
752
|
+
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">ca_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">'..'</span>, <span class="ruby-value str">'..'</span>, <span class="ruby-value str">'cert'</span>, <span class="ruby-value str">'cacert.pem'</span>)
|
753
|
+
<span class="ruby-keyword kw">else</span>
|
754
|
+
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span>
|
755
|
+
<span class="ruby-keyword kw">end</span>
|
756
|
+
<span class="ruby-keyword kw">end</span>
|
757
|
+
<span class="ruby-identifier">http</span>
|
758
|
+
<span class="ruby-keyword kw">end</span>
|
759
|
+
</pre>
|
760
|
+
</div>
|
761
|
+
</div>
|
762
|
+
</div>
|
763
|
+
|
764
|
+
<div id="method-M000407" class="method-detail">
|
765
|
+
<a name="M000407"></a>
|
766
|
+
|
767
|
+
<div class="method-heading">
|
768
|
+
<a href="#M000407" class="method-signature">
|
769
|
+
<span class="method-name">init_plugin</span><span class="method-args">(options={})</span>
|
770
|
+
</a>
|
771
|
+
</div>
|
772
|
+
|
773
|
+
<div class="method-description">
|
774
|
+
<p>
|
775
|
+
Initialize the plugin/gem and start the agent. This does the necessary
|
776
|
+
configuration based on the <a href="Control.html#M000424">framework</a>
|
777
|
+
environment and determines whether or not to start the agent. If the agent
|
778
|
+
is not going to be started then it loads the agent shim which has stubs for
|
779
|
+
all the external api.
|
780
|
+
</p>
|
781
|
+
<p>
|
782
|
+
This may be invoked multiple times, as long as you don‘t attempt to
|
783
|
+
uninstall the agent after it has been started.
|
784
|
+
</p>
|
785
|
+
<p>
|
786
|
+
If the plugin is initialized and it determines that the agent is not
|
787
|
+
enabled, it will skip starting it and install the shim. But if you later
|
788
|
+
call this with <tt>:agent_enabled => true</tt>, then it will install the
|
789
|
+
real agent and start it.
|
790
|
+
</p>
|
791
|
+
<p>
|
792
|
+
What determines whether the agent is launched is the result of calling <a
|
793
|
+
href="Control.html#M000422">agent_enabled?</a> This will indicate whether
|
794
|
+
the instrumentation should/will be installed. If we‘re in a mode
|
795
|
+
where tracers are not installed then we should not start the agent.
|
796
|
+
</p>
|
797
|
+
<p>
|
798
|
+
Subclasses are not allowed to override, but must implement init_config({})
|
799
|
+
which is called at most once.
|
800
|
+
</p>
|
801
|
+
<p><a class="source-toggle" href="#"
|
802
|
+
onclick="toggleCode('M000407-source');return false;">[Source]</a></p>
|
803
|
+
<div class="method-source-code" id="M000407-source">
|
804
|
+
<pre>
|
805
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 76</span>
|
806
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_plugin</span>(<span class="ruby-identifier">options</span>={})
|
807
|
+
<span class="ruby-identifier">options</span>[<span class="ruby-value str">'app_name'</span>] = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'NEWRELIC_APP_NAME'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'NEWRELIC_APP_NAME'</span>]
|
808
|
+
|
809
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'new_relic/agent'</span>
|
810
|
+
<span class="ruby-comment cmt"># Merge the stringified options into the config as overrides:</span>
|
811
|
+
<span class="ruby-identifier">logger_override</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:log</span>)
|
812
|
+
<span class="ruby-identifier">environment_name</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:env</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">env</span> = <span class="ruby-identifier">environment_name</span>
|
813
|
+
<span class="ruby-identifier">dispatcher</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:dispatcher</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher</span> = <span class="ruby-identifier">dispatcher</span>
|
814
|
+
<span class="ruby-identifier">dispatcher_instance_id</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:dispatcher_instance_id</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher_instance_id</span> = <span class="ruby-identifier">dispatcher_instance_id</span>
|
815
|
+
|
816
|
+
<span class="ruby-comment cmt"># Clear out the settings, if they've already been loaded. It may be that</span>
|
817
|
+
<span class="ruby-comment cmt"># between calling init_plugin the first time and the second time, the env</span>
|
818
|
+
<span class="ruby-comment cmt"># has been overridden</span>
|
819
|
+
<span class="ruby-ivar">@settings</span> = <span class="ruby-keyword kw">nil</span>
|
820
|
+
|
821
|
+
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span>, <span class="ruby-identifier">val</span> <span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">sym</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">val</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">sym</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:config</span> }
|
822
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logger_override</span>
|
823
|
+
<span class="ruby-ivar">@log</span> = <span class="ruby-identifier">logger_override</span>
|
824
|
+
<span class="ruby-comment cmt"># Try to grab the log filename</span>
|
825
|
+
<span class="ruby-ivar">@log_file</span> = <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">instance_eval</span> { <span class="ruby-ivar">@logdev</span>.<span class="ruby-identifier">filename</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span> }
|
826
|
+
<span class="ruby-keyword kw">end</span>
|
827
|
+
<span class="ruby-comment cmt"># An artifact of earlier implementation, we put both #add_method_tracer and #trace_execution</span>
|
828
|
+
<span class="ruby-comment cmt"># methods in the module methods.</span>
|
829
|
+
<span class="ruby-constant">Module</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:include</span>, <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodTracer</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassMethods</span>
|
830
|
+
<span class="ruby-constant">Module</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:include</span>, <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodTracer</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceMethods</span>
|
831
|
+
<span class="ruby-identifier">init_config</span>(<span class="ruby-identifier">options</span>)
|
832
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">agent_enabled?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@started</span>
|
833
|
+
<span class="ruby-identifier">setup_log</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">logger_override</span>
|
834
|
+
<span class="ruby-identifier">start_agent</span>
|
835
|
+
<span class="ruby-identifier">install_instrumentation</span>
|
836
|
+
<span class="ruby-identifier">load_samplers</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'disable_samplers'</span>]
|
837
|
+
<span class="ruby-identifier">local_env</span>.<span class="ruby-identifier">gather_environment_info</span>
|
838
|
+
<span class="ruby-identifier">append_environment_info</span>
|
839
|
+
<span class="ruby-ivar">@started</span> = <span class="ruby-keyword kw">true</span>
|
840
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-identifier">agent_enabled?</span>
|
841
|
+
<span class="ruby-identifier">install_shim</span>
|
842
|
+
<span class="ruby-keyword kw">end</span>
|
843
|
+
<span class="ruby-keyword kw">end</span>
|
844
|
+
</pre>
|
845
|
+
</div>
|
846
|
+
</div>
|
847
|
+
</div>
|
848
|
+
|
849
|
+
<div id="method-M000442" class="method-detail">
|
850
|
+
<a name="M000442"></a>
|
851
|
+
|
852
|
+
<div class="method-heading">
|
853
|
+
<a href="#M000442" class="method-signature">
|
854
|
+
<span class="method-name">install_instrumentation</span><span class="method-args">()</span>
|
855
|
+
</a>
|
856
|
+
</div>
|
857
|
+
|
858
|
+
<div class="method-description">
|
859
|
+
<p><a class="source-toggle" href="#"
|
860
|
+
onclick="toggleCode('M000442-source');return false;">[Source]</a></p>
|
861
|
+
<div class="method-source-code" id="M000442-source">
|
862
|
+
<pre>
|
863
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 326</span>
|
864
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">install_instrumentation</span>
|
865
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instrumented</span>
|
866
|
+
|
867
|
+
<span class="ruby-ivar">@instrumented</span> = <span class="ruby-keyword kw">true</span>
|
868
|
+
|
869
|
+
<span class="ruby-comment cmt"># Instrumentation for the key code points inside rails for monitoring by NewRelic.</span>
|
870
|
+
<span class="ruby-comment cmt"># note this file is loaded only if the newrelic agent is enabled (through config/newrelic.yml)</span>
|
871
|
+
<span class="ruby-identifier">instrumentation_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">'agent'</span>,<span class="ruby-value str">'instrumentation'</span>)
|
872
|
+
<span class="ruby-ivar">@instrumentation_files</span> <span class="ruby-operator"><<</span>
|
873
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">instrumentation_path</span>, <span class="ruby-value str">'*.rb'</span>) <span class="ruby-operator"><<</span>
|
874
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">instrumentation_path</span>, <span class="ruby-identifier">app</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-value str">'*.rb'</span>)
|
875
|
+
<span class="ruby-ivar">@instrumentation_files</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span> <span class="ruby-identifier">pattern</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">load_instrumentation_files</span> <span class="ruby-identifier">pattern</span> }
|
876
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-value str">"Finished instrumentation"</span>
|
877
|
+
<span class="ruby-keyword kw">end</span>
|
878
|
+
</pre>
|
879
|
+
</div>
|
880
|
+
</div>
|
881
|
+
</div>
|
882
|
+
|
883
|
+
<div id="method-M000440" class="method-detail">
|
884
|
+
<a name="M000440"></a>
|
885
|
+
|
886
|
+
<div class="method-heading">
|
887
|
+
<a href="#M000440" class="method-signature">
|
888
|
+
<span class="method-name">install_shim</span><span class="method-args">()</span>
|
889
|
+
</a>
|
890
|
+
</div>
|
891
|
+
|
892
|
+
<div class="method-description">
|
893
|
+
<p>
|
894
|
+
Install stubs to the proper location so the <a
|
895
|
+
href="Control.html#M000423">app</a> code will not fail if the agent is not
|
896
|
+
running.
|
897
|
+
</p>
|
898
|
+
<p><a class="source-toggle" href="#"
|
899
|
+
onclick="toggleCode('M000440-source');return false;">[Source]</a></p>
|
900
|
+
<div class="method-source-code" id="M000440-source">
|
901
|
+
<pre>
|
902
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 309</span>
|
903
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">install_shim</span>
|
904
|
+
<span class="ruby-comment cmt"># Once we install instrumentation, you can't undo that by installing the shim.</span>
|
905
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Cannot install the Agent shim after instrumentation has already been installed!"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instrumented</span>
|
906
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span>.<span class="ruby-identifier">agent</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span><span class="ruby-operator">::</span><span class="ruby-constant">ShimAgent</span>.<span class="ruby-identifier">instance</span>
|
907
|
+
<span class="ruby-keyword kw">end</span>
|
908
|
+
</pre>
|
909
|
+
</div>
|
910
|
+
</div>
|
911
|
+
</div>
|
912
|
+
|
913
|
+
<div id="method-M000415" class="method-detail">
|
914
|
+
<a name="M000415"></a>
|
915
|
+
|
916
|
+
<div class="method-heading">
|
917
|
+
<a href="#M000415" class="method-signature">
|
918
|
+
<span class="method-name">license_key</span><span class="method-args">()</span>
|
919
|
+
</a>
|
920
|
+
</div>
|
921
|
+
|
922
|
+
<div class="method-description">
|
923
|
+
<p><a class="source-toggle" href="#"
|
924
|
+
onclick="toggleCode('M000415-source');return false;">[Source]</a></p>
|
925
|
+
<div class="method-source-code" id="M000415-source">
|
926
|
+
<pre>
|
927
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 163</span>
|
928
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">license_key</span>
|
929
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'license_key'</span>)
|
930
|
+
<span class="ruby-keyword kw">end</span>
|
931
|
+
</pre>
|
932
|
+
</div>
|
933
|
+
</div>
|
934
|
+
</div>
|
935
|
+
|
936
|
+
<div id="method-M000443" class="method-detail">
|
937
|
+
<a name="M000443"></a>
|
938
|
+
|
939
|
+
<div class="method-heading">
|
940
|
+
<a href="#M000443" class="method-signature">
|
941
|
+
<span class="method-name">load_samplers</span><span class="method-args">()</span>
|
942
|
+
</a>
|
943
|
+
</div>
|
944
|
+
|
945
|
+
<div class="method-description">
|
946
|
+
<p><a class="source-toggle" href="#"
|
947
|
+
onclick="toggleCode('M000443-source');return false;">[Source]</a></p>
|
948
|
+
<div class="method-source-code" id="M000443-source">
|
949
|
+
<pre>
|
950
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 341</span>
|
951
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_samplers</span>
|
952
|
+
<span class="ruby-identifier">agent</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span>.<span class="ruby-identifier">instance</span>
|
953
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span><span class="ruby-operator">::</span><span class="ruby-constant">Sampler</span>.<span class="ruby-identifier">sampler_classes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">subclass</span> <span class="ruby-operator">|</span>
|
954
|
+
<span class="ruby-keyword kw">begin</span>
|
955
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"#{subclass.name} not supported on this platform."</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">subclass</span>.<span class="ruby-identifier">supported_on_this_platform?</span>
|
956
|
+
<span class="ruby-identifier">sampler</span> = <span class="ruby-identifier">subclass</span>.<span class="ruby-identifier">new</span>
|
957
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">subclass</span>.<span class="ruby-identifier">use_harvest_sampler?</span>
|
958
|
+
<span class="ruby-identifier">agent</span>.<span class="ruby-identifier">stats_engine</span>.<span class="ruby-identifier">add_harvest_sampler</span> <span class="ruby-identifier">sampler</span>
|
959
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"Registered #{subclass.name} for harvest time sampling"</span>
|
960
|
+
<span class="ruby-keyword kw">else</span>
|
961
|
+
<span class="ruby-identifier">agent</span>.<span class="ruby-identifier">stats_engine</span>.<span class="ruby-identifier">add_sampler</span> <span class="ruby-identifier">sampler</span>
|
962
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"Registered #{subclass.name} for periodic sampling"</span>
|
963
|
+
<span class="ruby-keyword kw">end</span>
|
964
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span><span class="ruby-operator">::</span><span class="ruby-constant">Sampler</span><span class="ruby-operator">::</span><span class="ruby-constant">Unsupported</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
965
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"#{subclass} sampler not available: #{e}"</span>
|
966
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
967
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">"Error registering sampler: #{e}, #{e.backtrace.join("\n")}"</span>
|
968
|
+
<span class="ruby-keyword kw">end</span>
|
969
|
+
<span class="ruby-keyword kw">end</span>
|
970
|
+
<span class="ruby-keyword kw">end</span>
|
971
|
+
</pre>
|
972
|
+
</div>
|
973
|
+
</div>
|
974
|
+
</div>
|
975
|
+
|
976
|
+
<div id="method-M000438" class="method-detail">
|
977
|
+
<a name="M000438"></a>
|
978
|
+
|
979
|
+
<div class="method-heading">
|
980
|
+
<a href="#M000438" class="method-signature">
|
981
|
+
<span class="method-name">log</span><span class="method-args">()</span>
|
982
|
+
</a>
|
983
|
+
</div>
|
984
|
+
|
985
|
+
<div class="method-description">
|
986
|
+
<p><a class="source-toggle" href="#"
|
987
|
+
onclick="toggleCode('M000438-source');return false;">[Source]</a></p>
|
988
|
+
<div class="method-source-code" id="M000438-source">
|
989
|
+
<pre>
|
990
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 287</span>
|
991
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>
|
992
|
+
<span class="ruby-comment cmt"># If we try to get a log before one has been set up, return a stdout log</span>
|
993
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@log</span>
|
994
|
+
<span class="ruby-identifier">l</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDOUT</span>)
|
995
|
+
<span class="ruby-identifier">l</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">INFO</span>
|
996
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">l</span>
|
997
|
+
<span class="ruby-keyword kw">end</span>
|
998
|
+
<span class="ruby-ivar">@log</span>
|
999
|
+
<span class="ruby-keyword kw">end</span>
|
1000
|
+
</pre>
|
1001
|
+
</div>
|
1002
|
+
</div>
|
1003
|
+
</div>
|
1004
|
+
|
1005
|
+
<div id="method-M000439" class="method-detail">
|
1006
|
+
<a name="M000439"></a>
|
1007
|
+
|
1008
|
+
<div class="method-heading">
|
1009
|
+
<a href="#M000439" class="method-signature">
|
1010
|
+
<span class="method-name">log!</span><span class="method-args">(msg, level=:info)</span>
|
1011
|
+
</a>
|
1012
|
+
</div>
|
1013
|
+
|
1014
|
+
<div class="method-description">
|
1015
|
+
<p>
|
1016
|
+
send the given message to STDOUT so that it shows up in the console. This
|
1017
|
+
should be used for important informational messages at boot. The <a
|
1018
|
+
href="Control.html#M000448">to_stdout</a> may be implemented differently by
|
1019
|
+
different config subclasses. This will NOT print anything if tracers are
|
1020
|
+
not enabled
|
1021
|
+
</p>
|
1022
|
+
<p><a class="source-toggle" href="#"
|
1023
|
+
onclick="toggleCode('M000439-source');return false;">[Source]</a></p>
|
1024
|
+
<div class="method-source-code" id="M000439-source">
|
1025
|
+
<pre>
|
1026
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 301</span>
|
1027
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log!</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">level</span>=<span class="ruby-identifier">:info</span>)
|
1028
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@settings</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">agent_enabled?</span>
|
1029
|
+
<span class="ruby-identifier">to_stdout</span> <span class="ruby-identifier">msg</span>
|
1030
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">level</span>, <span class="ruby-identifier">msg</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@log</span>
|
1031
|
+
<span class="ruby-keyword kw">end</span>
|
1032
|
+
</pre>
|
1033
|
+
</div>
|
1034
|
+
</div>
|
1035
|
+
</div>
|
1036
|
+
|
1037
|
+
<div id="method-M000417" class="method-detail">
|
1038
|
+
<a name="M000417"></a>
|
1039
|
+
|
1040
|
+
<div class="method-heading">
|
1041
|
+
<a href="#M000417" class="method-signature">
|
1042
|
+
<span class="method-name">monitor_mode?</span><span class="method-args">()</span>
|
1043
|
+
</a>
|
1044
|
+
</div>
|
1045
|
+
|
1046
|
+
<div class="method-description">
|
1047
|
+
<p>
|
1048
|
+
True if we are sending data to the <a
|
1049
|
+
href="Control.html#M000432">server</a>, monitoring production
|
1050
|
+
</p>
|
1051
|
+
<p><a class="source-toggle" href="#"
|
1052
|
+
onclick="toggleCode('M000417-source');return false;">[Source]</a></p>
|
1053
|
+
<div class="method-source-code" id="M000417-source">
|
1054
|
+
<pre>
|
1055
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 170</span>
|
1056
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monitor_mode?</span>
|
1057
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'monitor_mode'</span>, <span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'enabled'</span>))
|
1058
|
+
<span class="ruby-keyword kw">end</span>
|
1059
|
+
</pre>
|
1060
|
+
</div>
|
1061
|
+
</div>
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
<div id="method-M000419" class="method-detail">
|
1065
|
+
<a name="M000419"></a>
|
1066
|
+
|
1067
|
+
<div class="method-heading">
|
1068
|
+
<a href="#M000419" class="method-signature">
|
1069
|
+
<span class="method-name">multi_threaded?</span><span class="method-args">()</span>
|
1070
|
+
</a>
|
1071
|
+
</div>
|
1072
|
+
|
1073
|
+
<div class="method-description">
|
1074
|
+
<p>
|
1075
|
+
True if the <a href="Control.html#M000423">app</a> runs in multi-threaded
|
1076
|
+
mode
|
1077
|
+
</p>
|
1078
|
+
<p><a class="source-toggle" href="#"
|
1079
|
+
onclick="toggleCode('M000419-source');return false;">[Source]</a></p>
|
1080
|
+
<div class="method-source-code" id="M000419-source">
|
1081
|
+
<pre>
|
1082
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 178</span>
|
1083
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">multi_threaded?</span>
|
1084
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'multi_threaded'</span>)
|
1085
|
+
<span class="ruby-keyword kw">end</span>
|
1086
|
+
</pre>
|
1087
|
+
</div>
|
1088
|
+
</div>
|
1089
|
+
</div>
|
1090
|
+
|
1091
|
+
<div id="method-M000421" class="method-detail">
|
1092
|
+
<a name="M000421"></a>
|
1093
|
+
|
1094
|
+
<div class="method-heading">
|
1095
|
+
<a href="#M000421" class="method-signature">
|
1096
|
+
<span class="method-name">post_size_limit</span><span class="method-args">()</span>
|
1097
|
+
</a>
|
1098
|
+
</div>
|
1099
|
+
|
1100
|
+
<div class="method-description">
|
1101
|
+
<p><a class="source-toggle" href="#"
|
1102
|
+
onclick="toggleCode('M000421-source');return false;">[Source]</a></p>
|
1103
|
+
<div class="method-source-code" id="M000421-source">
|
1104
|
+
<pre>
|
1105
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 185</span>
|
1106
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_size_limit</span>
|
1107
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'post_size_limit'</span>, <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span>)
|
1108
|
+
<span class="ruby-keyword kw">end</span>
|
1109
|
+
</pre>
|
1110
|
+
</div>
|
1111
|
+
</div>
|
1112
|
+
</div>
|
1113
|
+
|
1114
|
+
<div id="method-M000405" class="method-detail">
|
1115
|
+
<a name="M000405"></a>
|
1116
|
+
|
1117
|
+
<div class="method-heading">
|
1118
|
+
<a href="#M000405" class="method-signature">
|
1119
|
+
<span class="method-name">profiling=</span><span class="method-args">(val)</span>
|
1120
|
+
</a>
|
1121
|
+
</div>
|
1122
|
+
|
1123
|
+
<div class="method-description">
|
1124
|
+
<p>
|
1125
|
+
Set the flag for capturing profiles in dev mode. If RubyProf is not loaded
|
1126
|
+
a true value is ignored.
|
1127
|
+
</p>
|
1128
|
+
<p><a class="source-toggle" href="#"
|
1129
|
+
onclick="toggleCode('M000405-source');return false;">[Source]</a></p>
|
1130
|
+
<div class="method-source-code" id="M000405-source">
|
1131
|
+
<pre>
|
1132
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 34</span>
|
1133
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">profiling=</span>(<span class="ruby-identifier">val</span>)
|
1134
|
+
<span class="ruby-ivar">@profiling</span> = <span class="ruby-identifier">profiling_available?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">RubyProf</span>)
|
1135
|
+
<span class="ruby-keyword kw">end</span>
|
1136
|
+
</pre>
|
1137
|
+
</div>
|
1138
|
+
</div>
|
1139
|
+
</div>
|
1140
|
+
|
1141
|
+
<div id="method-M000403" class="method-detail">
|
1142
|
+
<a name="M000403"></a>
|
1143
|
+
|
1144
|
+
<div class="method-heading">
|
1145
|
+
<a href="#M000403" class="method-signature">
|
1146
|
+
<span class="method-name">profiling?</span><span class="method-args">()</span>
|
1147
|
+
</a>
|
1148
|
+
</div>
|
1149
|
+
|
1150
|
+
<div class="method-description">
|
1151
|
+
<p>
|
1152
|
+
A flag used in dev mode to indicate if profiling is available
|
1153
|
+
</p>
|
1154
|
+
<p><a class="source-toggle" href="#"
|
1155
|
+
onclick="toggleCode('M000403-source');return false;">[Source]</a></p>
|
1156
|
+
<div class="method-source-code" id="M000403-source">
|
1157
|
+
<pre>
|
1158
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 21</span>
|
1159
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">profiling?</span>
|
1160
|
+
<span class="ruby-ivar">@profiling</span>
|
1161
|
+
<span class="ruby-keyword kw">end</span>
|
1162
|
+
</pre>
|
1163
|
+
</div>
|
1164
|
+
</div>
|
1165
|
+
</div>
|
1166
|
+
|
1167
|
+
<div id="method-M000404" class="method-detail">
|
1168
|
+
<a name="M000404"></a>
|
1169
|
+
|
1170
|
+
<div class="method-heading">
|
1171
|
+
<a href="#M000404" class="method-signature">
|
1172
|
+
<span class="method-name">profiling_available?</span><span class="method-args">()</span>
|
1173
|
+
</a>
|
1174
|
+
</div>
|
1175
|
+
|
1176
|
+
<div class="method-description">
|
1177
|
+
<p><a class="source-toggle" href="#"
|
1178
|
+
onclick="toggleCode('M000404-source');return false;">[Source]</a></p>
|
1179
|
+
<div class="method-source-code" id="M000404-source">
|
1180
|
+
<pre>
|
1181
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 25</span>
|
1182
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">profiling_available?</span>
|
1183
|
+
<span class="ruby-ivar">@profiling_available</span> <span class="ruby-operator">||=</span>
|
1184
|
+
<span class="ruby-keyword kw">begin</span>
|
1185
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'ruby-prof'</span>
|
1186
|
+
<span class="ruby-keyword kw">true</span>
|
1187
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>; <span class="ruby-keyword kw">end</span>
|
1188
|
+
<span class="ruby-keyword kw">end</span>
|
1189
|
+
</pre>
|
1190
|
+
</div>
|
1191
|
+
</div>
|
1192
|
+
</div>
|
1193
|
+
|
1194
|
+
<div id="method-M000434" class="method-detail">
|
1195
|
+
<a name="M000434"></a>
|
1196
|
+
|
1197
|
+
<div class="method-heading">
|
1198
|
+
<a href="#M000434" class="method-signature">
|
1199
|
+
<span class="method-name">proxy_server</span><span class="method-args">()</span>
|
1200
|
+
</a>
|
1201
|
+
</div>
|
1202
|
+
|
1203
|
+
<div class="method-description">
|
1204
|
+
<p><a class="source-toggle" href="#"
|
1205
|
+
onclick="toggleCode('M000434-source');return false;">[Source]</a></p>
|
1206
|
+
<div class="method-source-code" id="M000434-source">
|
1207
|
+
<pre>
|
1208
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 246</span>
|
1209
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">proxy_server</span>
|
1210
|
+
<span class="ruby-ivar">@proxy_server</span> <span class="ruby-operator">||=</span>
|
1211
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Control</span><span class="ruby-operator">::</span><span class="ruby-constant">ProxyServer</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'proxy_host'</span>], <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'proxy_port'</span>], <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'proxy_user'</span>], <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'proxy_pass'</span>]
|
1212
|
+
<span class="ruby-keyword kw">end</span>
|
1213
|
+
</pre>
|
1214
|
+
</div>
|
1215
|
+
</div>
|
1216
|
+
</div>
|
1217
|
+
|
1218
|
+
<div id="method-M000432" class="method-detail">
|
1219
|
+
<a name="M000432"></a>
|
1220
|
+
|
1221
|
+
<div class="method-heading">
|
1222
|
+
<a href="#M000432" class="method-signature">
|
1223
|
+
<span class="method-name">server</span><span class="method-args">()</span>
|
1224
|
+
</a>
|
1225
|
+
</div>
|
1226
|
+
|
1227
|
+
<div class="method-description">
|
1228
|
+
<p><a class="source-toggle" href="#"
|
1229
|
+
onclick="toggleCode('M000432-source');return false;">[Source]</a></p>
|
1230
|
+
<div class="method-source-code" id="M000432-source">
|
1231
|
+
<pre>
|
1232
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 233</span>
|
1233
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server</span>
|
1234
|
+
<span class="ruby-ivar">@remote_server</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">server_from_host</span>(<span class="ruby-keyword kw">nil</span>)
|
1235
|
+
<span class="ruby-keyword kw">end</span>
|
1236
|
+
</pre>
|
1237
|
+
</div>
|
1238
|
+
</div>
|
1239
|
+
</div>
|
1240
|
+
|
1241
|
+
<div id="method-M000435" class="method-detail">
|
1242
|
+
<a name="M000435"></a>
|
1243
|
+
|
1244
|
+
<div class="method-heading">
|
1245
|
+
<a href="#M000435" class="method-signature">
|
1246
|
+
<span class="method-name">server_from_host</span><span class="method-args">(hostname=nil)</span>
|
1247
|
+
</a>
|
1248
|
+
</div>
|
1249
|
+
|
1250
|
+
<div class="method-description">
|
1251
|
+
<p><a class="source-toggle" href="#"
|
1252
|
+
onclick="toggleCode('M000435-source');return false;">[Source]</a></p>
|
1253
|
+
<div class="method-source-code" id="M000435-source">
|
1254
|
+
<pre>
|
1255
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 251</span>
|
1256
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_from_host</span>(<span class="ruby-identifier">hostname</span>=<span class="ruby-keyword kw">nil</span>)
|
1257
|
+
<span class="ruby-identifier">host</span> = <span class="ruby-identifier">hostname</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'host'</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'collector.newrelic.com'</span>
|
1258
|
+
|
1259
|
+
<span class="ruby-comment cmt"># if the host is not an IP address, turn it into one</span>
|
1260
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Control</span><span class="ruby-operator">::</span><span class="ruby-constant">Server</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">host</span>, (<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'port'</span>] <span class="ruby-operator">||</span> (<span class="ruby-identifier">use_ssl?</span> <span class="ruby-value">? </span><span class="ruby-value">443</span> <span class="ruby-operator">:</span> <span class="ruby-value">80</span>)).<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">convert_to_ip_address</span>(<span class="ruby-identifier">host</span>)
|
1261
|
+
<span class="ruby-keyword kw">end</span>
|
1262
|
+
</pre>
|
1263
|
+
</div>
|
1264
|
+
</div>
|
1265
|
+
</div>
|
1266
|
+
|
1267
|
+
<div id="method-M000410" class="method-detail">
|
1268
|
+
<a name="M000410"></a>
|
1269
|
+
|
1270
|
+
<div class="method-heading">
|
1271
|
+
<a href="#M000410" class="method-signature">
|
1272
|
+
<span class="method-name">settings</span><span class="method-args">()</span>
|
1273
|
+
</a>
|
1274
|
+
</div>
|
1275
|
+
|
1276
|
+
<div class="method-description">
|
1277
|
+
<p><a class="source-toggle" href="#"
|
1278
|
+
onclick="toggleCode('M000410-source');return false;">[Source]</a></p>
|
1279
|
+
<div class="method-source-code" id="M000410-source">
|
1280
|
+
<pre>
|
1281
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 125</span>
|
1282
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">settings</span>
|
1283
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@settings</span>
|
1284
|
+
<span class="ruby-ivar">@settings</span> = (<span class="ruby-ivar">@yaml</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">merge_defaults</span>(<span class="ruby-ivar">@yaml</span>[<span class="ruby-identifier">env</span>])) <span class="ruby-operator">||</span> {}
|
1285
|
+
<span class="ruby-comment cmt"># At the time we bind the settings, we also need to run this little piece</span>
|
1286
|
+
<span class="ruby-comment cmt"># of magic which allows someone to augment the id with the app name, necessary</span>
|
1287
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'multi_homed'</span>] <span class="ruby-operator">&&</span> <span class="ruby-identifier">app_names</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
1288
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher_instance_id</span>
|
1289
|
+
<span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher_instance_id</span> <span class="ruby-operator"><<</span> <span class="ruby-node">":#{app_names.first}"</span>
|
1290
|
+
<span class="ruby-keyword kw">else</span>
|
1291
|
+
<span class="ruby-ivar">@local_env</span>.<span class="ruby-identifier">dispatcher_instance_id</span> = <span class="ruby-identifier">app_names</span>.<span class="ruby-identifier">first</span>
|
1292
|
+
<span class="ruby-keyword kw">end</span>
|
1293
|
+
<span class="ruby-keyword kw">end</span>
|
1294
|
+
|
1295
|
+
<span class="ruby-keyword kw">end</span>
|
1296
|
+
<span class="ruby-ivar">@settings</span>
|
1297
|
+
<span class="ruby-keyword kw">end</span>
|
1298
|
+
</pre>
|
1299
|
+
</div>
|
1300
|
+
</div>
|
1301
|
+
</div>
|
1302
|
+
|
1303
|
+
<div id="method-M000408" class="method-detail">
|
1304
|
+
<a name="M000408"></a>
|
1305
|
+
|
1306
|
+
<div class="method-heading">
|
1307
|
+
<a href="#M000408" class="method-signature">
|
1308
|
+
<span class="method-name">start_agent</span><span class="method-args">()</span>
|
1309
|
+
</a>
|
1310
|
+
</div>
|
1311
|
+
|
1312
|
+
<div class="method-description">
|
1313
|
+
<p>
|
1314
|
+
Install the real agent into the <a href="Agent.html">Agent</a> module, and
|
1315
|
+
issue the start command.
|
1316
|
+
</p>
|
1317
|
+
<p><a class="source-toggle" href="#"
|
1318
|
+
onclick="toggleCode('M000408-source');return false;">[Source]</a></p>
|
1319
|
+
<div class="method-source-code" id="M000408-source">
|
1320
|
+
<pre>
|
1321
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 116</span>
|
1322
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_agent</span>
|
1323
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span>.<span class="ruby-identifier">agent</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span>.<span class="ruby-identifier">instance</span>
|
1324
|
+
<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Agent</span>.<span class="ruby-identifier">agent</span>.<span class="ruby-identifier">start</span>
|
1325
|
+
<span class="ruby-keyword kw">end</span>
|
1326
|
+
</pre>
|
1327
|
+
</div>
|
1328
|
+
</div>
|
1329
|
+
</div>
|
1330
|
+
|
1331
|
+
<div id="method-M000437" class="method-detail">
|
1332
|
+
<a name="M000437"></a>
|
1333
|
+
|
1334
|
+
<div class="method-heading">
|
1335
|
+
<a href="#M000437" class="method-signature">
|
1336
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
1337
|
+
</a>
|
1338
|
+
</div>
|
1339
|
+
|
1340
|
+
<div class="method-description">
|
1341
|
+
<p><a class="source-toggle" href="#"
|
1342
|
+
onclick="toggleCode('M000437-source');return false;">[Source]</a></p>
|
1343
|
+
<div class="method-source-code" id="M000437-source">
|
1344
|
+
<pre>
|
1345
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 283</span>
|
1346
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
1347
|
+
<span class="ruby-node">"Control[#{self.app}]"</span>
|
1348
|
+
<span class="ruby-keyword kw">end</span>
|
1349
|
+
</pre>
|
1350
|
+
</div>
|
1351
|
+
</div>
|
1352
|
+
</div>
|
1353
|
+
|
1354
|
+
<div id="method-M000430" class="method-detail">
|
1355
|
+
<a name="M000430"></a>
|
1356
|
+
|
1357
|
+
<div class="method-heading">
|
1358
|
+
<a href="#M000430" class="method-signature">
|
1359
|
+
<span class="method-name">use_ssl?</span><span class="method-args">()</span>
|
1360
|
+
</a>
|
1361
|
+
</div>
|
1362
|
+
|
1363
|
+
<div class="method-description">
|
1364
|
+
<p><a class="source-toggle" href="#"
|
1365
|
+
onclick="toggleCode('M000430-source');return false;">[Source]</a></p>
|
1366
|
+
<div class="method-source-code" id="M000430-source">
|
1367
|
+
<pre>
|
1368
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 224</span>
|
1369
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use_ssl?</span>
|
1370
|
+
<span class="ruby-ivar">@use_ssl</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'ssl'</span>, <span class="ruby-keyword kw">false</span>)
|
1371
|
+
<span class="ruby-keyword kw">end</span>
|
1372
|
+
</pre>
|
1373
|
+
</div>
|
1374
|
+
</div>
|
1375
|
+
</div>
|
1376
|
+
|
1377
|
+
<div id="method-M000420" class="method-detail">
|
1378
|
+
<a name="M000420"></a>
|
1379
|
+
|
1380
|
+
<div class="method-heading">
|
1381
|
+
<a href="#M000420" class="method-signature">
|
1382
|
+
<span class="method-name">use_textmate?</span><span class="method-args">()</span>
|
1383
|
+
</a>
|
1384
|
+
</div>
|
1385
|
+
|
1386
|
+
<div class="method-description">
|
1387
|
+
<p>
|
1388
|
+
True if we should view files in textmate
|
1389
|
+
</p>
|
1390
|
+
<p><a class="source-toggle" href="#"
|
1391
|
+
onclick="toggleCode('M000420-source');return false;">[Source]</a></p>
|
1392
|
+
<div class="method-source-code" id="M000420-source">
|
1393
|
+
<pre>
|
1394
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 182</span>
|
1395
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">use_textmate?</span>
|
1396
|
+
<span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'textmate'</span>)
|
1397
|
+
<span class="ruby-keyword kw">end</span>
|
1398
|
+
</pre>
|
1399
|
+
</div>
|
1400
|
+
</div>
|
1401
|
+
</div>
|
1402
|
+
|
1403
|
+
<div id="method-M000428" class="method-detail">
|
1404
|
+
<a name="M000428"></a>
|
1405
|
+
|
1406
|
+
<div class="method-heading">
|
1407
|
+
<a href="#M000428" class="method-signature">
|
1408
|
+
<span class="method-name">validate_seed</span><span class="method-args">()</span>
|
1409
|
+
</a>
|
1410
|
+
</div>
|
1411
|
+
|
1412
|
+
<div class="method-description">
|
1413
|
+
<p><a class="source-toggle" href="#"
|
1414
|
+
onclick="toggleCode('M000428-source');return false;">[Source]</a></p>
|
1415
|
+
<div class="method-source-code" id="M000428-source">
|
1416
|
+
<pre>
|
1417
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 217</span>
|
1418
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_seed</span>
|
1419
|
+
<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'validate_seed'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'NR_VALIDATE_SEED'</span>]
|
1420
|
+
<span class="ruby-keyword kw">end</span>
|
1421
|
+
</pre>
|
1422
|
+
</div>
|
1423
|
+
</div>
|
1424
|
+
</div>
|
1425
|
+
|
1426
|
+
<div id="method-M000429" class="method-detail">
|
1427
|
+
<a name="M000429"></a>
|
1428
|
+
|
1429
|
+
<div class="method-heading">
|
1430
|
+
<a href="#M000429" class="method-signature">
|
1431
|
+
<span class="method-name">validate_token</span><span class="method-args">()</span>
|
1432
|
+
</a>
|
1433
|
+
</div>
|
1434
|
+
|
1435
|
+
<div class="method-description">
|
1436
|
+
<p><a class="source-toggle" href="#"
|
1437
|
+
onclick="toggleCode('M000429-source');return false;">[Source]</a></p>
|
1438
|
+
<div class="method-source-code" id="M000429-source">
|
1439
|
+
<pre>
|
1440
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 220</span>
|
1441
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_token</span>
|
1442
|
+
<span class="ruby-keyword kw">self</span>[<span class="ruby-value str">'validate_token'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'NR_VALIDATE_TOKEN'</span>]
|
1443
|
+
<span class="ruby-keyword kw">end</span>
|
1444
|
+
</pre>
|
1445
|
+
</div>
|
1446
|
+
</div>
|
1447
|
+
</div>
|
1448
|
+
|
1449
|
+
<div id="method-M000431" class="method-detail">
|
1450
|
+
<a name="M000431"></a>
|
1451
|
+
|
1452
|
+
<div class="method-heading">
|
1453
|
+
<a href="#M000431" class="method-signature">
|
1454
|
+
<span class="method-name">verify_certificate?</span><span class="method-args">()</span>
|
1455
|
+
</a>
|
1456
|
+
</div>
|
1457
|
+
|
1458
|
+
<div class="method-description">
|
1459
|
+
<p><a class="source-toggle" href="#"
|
1460
|
+
onclick="toggleCode('M000431-source');return false;">[Source]</a></p>
|
1461
|
+
<div class="method-source-code" id="M000431-source">
|
1462
|
+
<pre>
|
1463
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 228</span>
|
1464
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verify_certificate?</span>
|
1465
|
+
<span class="ruby-comment cmt">#this can only be on when SSL is enabled</span>
|
1466
|
+
<span class="ruby-ivar">@verify_certificate</span> <span class="ruby-operator">||=</span> ( <span class="ruby-identifier">use_ssl?</span> <span class="ruby-value">? </span><span class="ruby-identifier">fetch</span>(<span class="ruby-value str">'verify_certificate'</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>)
|
1467
|
+
<span class="ruby-keyword kw">end</span>
|
1468
|
+
</pre>
|
1469
|
+
</div>
|
1470
|
+
</div>
|
1471
|
+
</div>
|
1472
|
+
|
1473
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
1474
|
+
|
1475
|
+
<div id="method-M000444" class="method-detail">
|
1476
|
+
<a name="M000444"></a>
|
1477
|
+
|
1478
|
+
<div class="method-heading">
|
1479
|
+
<a href="#M000444" class="method-signature">
|
1480
|
+
<span class="method-name">append_environment_info</span><span class="method-args">()</span>
|
1481
|
+
</a>
|
1482
|
+
</div>
|
1483
|
+
|
1484
|
+
<div class="method-description">
|
1485
|
+
<p>
|
1486
|
+
Append <a href="Control.html#M000424">framework</a> specific environment
|
1487
|
+
information for uploading to the <a href="Control.html#M000432">server</a>
|
1488
|
+
for change detection. Override in subclasses
|
1489
|
+
</p>
|
1490
|
+
<p><a class="source-toggle" href="#"
|
1491
|
+
onclick="toggleCode('M000444-source');return false;">[Source]</a></p>
|
1492
|
+
<div class="method-source-code" id="M000444-source">
|
1493
|
+
<pre>
|
1494
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 366</span>
|
1495
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_environment_info</span>; <span class="ruby-keyword kw">end</span>
|
1496
|
+
</pre>
|
1497
|
+
</div>
|
1498
|
+
</div>
|
1499
|
+
</div>
|
1500
|
+
|
1501
|
+
<div id="method-M000449" class="method-detail">
|
1502
|
+
<a name="M000449"></a>
|
1503
|
+
|
1504
|
+
<div class="method-heading">
|
1505
|
+
<a href="#M000449" class="method-signature">
|
1506
|
+
<span class="method-name">config_file</span><span class="method-args">()</span>
|
1507
|
+
</a>
|
1508
|
+
</div>
|
1509
|
+
|
1510
|
+
<div class="method-description">
|
1511
|
+
<p><a class="source-toggle" href="#"
|
1512
|
+
onclick="toggleCode('M000449-source');return false;">[Source]</a></p>
|
1513
|
+
<div class="method-source-code" id="M000449-source">
|
1514
|
+
<pre>
|
1515
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 430</span>
|
1516
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">config_file</span>
|
1517
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">root</span>,<span class="ruby-value str">"config"</span>,<span class="ruby-value str">"newrelic.yml"</span>))
|
1518
|
+
<span class="ruby-keyword kw">end</span>
|
1519
|
+
</pre>
|
1520
|
+
</div>
|
1521
|
+
</div>
|
1522
|
+
</div>
|
1523
|
+
|
1524
|
+
<div id="method-M000445" class="method-detail">
|
1525
|
+
<a name="M000445"></a>
|
1526
|
+
|
1527
|
+
<div class="method-heading">
|
1528
|
+
<a href="#M000445" class="method-signature">
|
1529
|
+
<span class="method-name">convert_to_ip_address</span><span class="method-args">(host)</span>
|
1530
|
+
</a>
|
1531
|
+
</div>
|
1532
|
+
|
1533
|
+
<div class="method-description">
|
1534
|
+
<p>
|
1535
|
+
Look up the ip address of the host using the pure ruby lookup to prevent
|
1536
|
+
blocking. If that fails, fall back to the regular IPSocket library. Return
|
1537
|
+
nil if we can‘t find the host ip address and don‘t have a good
|
1538
|
+
default.
|
1539
|
+
</p>
|
1540
|
+
<p><a class="source-toggle" href="#"
|
1541
|
+
onclick="toggleCode('M000445-source');return false;">[Source]</a></p>
|
1542
|
+
<div class="method-source-code" id="M000445-source">
|
1543
|
+
<pre>
|
1544
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 372</span>
|
1545
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_to_ip_address</span>(<span class="ruby-identifier">host</span>)
|
1546
|
+
<span class="ruby-comment cmt"># here we leave it as a host name since the cert verification</span>
|
1547
|
+
<span class="ruby-comment cmt"># needs it in host form</span>
|
1548
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">host</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verify_certificate?</span>
|
1549
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"localhost"</span>
|
1550
|
+
<span class="ruby-comment cmt"># Fall back to known ip address in the common case</span>
|
1551
|
+
<span class="ruby-identifier">ip_address</span> = <span class="ruby-value str">'65.74.177.195'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">host</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'collector.newrelic.com'</span>
|
1552
|
+
<span class="ruby-keyword kw">begin</span>
|
1553
|
+
<span class="ruby-identifier">ip_address</span> = <span class="ruby-constant">Resolv</span>.<span class="ruby-identifier">getaddress</span>(<span class="ruby-identifier">host</span>)
|
1554
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">"Resolved #{host} to #{ip_address}"</span>
|
1555
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
1556
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">warn</span> <span class="ruby-node">"DNS Error caching IP address: #{e}"</span>
|
1557
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n "</span>)
|
1558
|
+
<span class="ruby-identifier">ip_address</span> = <span class="ruby-constant">IPSocket</span><span class="ruby-operator">::</span><span class="ruby-identifier">getaddress</span> <span class="ruby-identifier">host</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">ip_address</span>
|
1559
|
+
<span class="ruby-keyword kw">end</span>
|
1560
|
+
<span class="ruby-identifier">ip_address</span>
|
1561
|
+
<span class="ruby-keyword kw">end</span>
|
1562
|
+
</pre>
|
1563
|
+
</div>
|
1564
|
+
</div>
|
1565
|
+
</div>
|
1566
|
+
|
1567
|
+
<div id="method-M000455" class="method-detail">
|
1568
|
+
<a name="M000455"></a>
|
1569
|
+
|
1570
|
+
<div class="method-heading">
|
1571
|
+
<a href="#M000455" class="method-signature">
|
1572
|
+
<span class="method-name">load_instrumentation_files</span><span class="method-args">(pattern)</span>
|
1573
|
+
</a>
|
1574
|
+
</div>
|
1575
|
+
|
1576
|
+
<div class="method-description">
|
1577
|
+
<p><a class="source-toggle" href="#"
|
1578
|
+
onclick="toggleCode('M000455-source');return false;">[Source]</a></p>
|
1579
|
+
<div class="method-source-code" id="M000455-source">
|
1580
|
+
<pre>
|
1581
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 485</span>
|
1582
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_instrumentation_files</span> <span class="ruby-identifier">pattern</span>
|
1583
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
1584
|
+
<span class="ruby-keyword kw">begin</span>
|
1585
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"Processing instrumentation file '#{file}'"</span>
|
1586
|
+
<span class="ruby-identifier">require</span> <span class="ruby-identifier">file</span>
|
1587
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
1588
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">"Error loading instrumentation file '#{file}': #{e}"</span>
|
1589
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>)
|
1590
|
+
<span class="ruby-keyword kw">end</span>
|
1591
|
+
<span class="ruby-keyword kw">end</span>
|
1592
|
+
<span class="ruby-keyword kw">end</span>
|
1593
|
+
</pre>
|
1594
|
+
</div>
|
1595
|
+
</div>
|
1596
|
+
</div>
|
1597
|
+
|
1598
|
+
<div id="method-M000450" class="method-detail">
|
1599
|
+
<a name="M000450"></a>
|
1600
|
+
|
1601
|
+
<div class="method-heading">
|
1602
|
+
<a href="#M000450" class="method-signature">
|
1603
|
+
<span class="method-name">log_path</span><span class="method-args">()</span>
|
1604
|
+
</a>
|
1605
|
+
</div>
|
1606
|
+
|
1607
|
+
<div class="method-description">
|
1608
|
+
<p><a class="source-toggle" href="#"
|
1609
|
+
onclick="toggleCode('M000450-source');return false;">[Source]</a></p>
|
1610
|
+
<div class="method-source-code" id="M000450-source">
|
1611
|
+
<pre>
|
1612
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 434</span>
|
1613
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_path</span>
|
1614
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">root</span>,<span class="ruby-value str">'log'</span>)
|
1615
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">path</span>
|
1616
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-value str">'.'</span>
|
1617
|
+
<span class="ruby-keyword kw">end</span>
|
1618
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
|
1619
|
+
<span class="ruby-keyword kw">end</span>
|
1620
|
+
</pre>
|
1621
|
+
</div>
|
1622
|
+
</div>
|
1623
|
+
</div>
|
1624
|
+
|
1625
|
+
<div id="method-M000446" class="method-detail">
|
1626
|
+
<a name="M000446"></a>
|
1627
|
+
|
1628
|
+
<div class="method-heading">
|
1629
|
+
<a href="#M000446" class="method-signature">
|
1630
|
+
<span class="method-name">merge_defaults</span><span class="method-args">(settings_hash)</span>
|
1631
|
+
</a>
|
1632
|
+
</div>
|
1633
|
+
|
1634
|
+
<div class="method-description">
|
1635
|
+
<p><a class="source-toggle" href="#"
|
1636
|
+
onclick="toggleCode('M000446-source');return false;">[Source]</a></p>
|
1637
|
+
<div class="method-source-code" id="M000446-source">
|
1638
|
+
<pre>
|
1639
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 390</span>
|
1640
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge_defaults</span>(<span class="ruby-identifier">settings_hash</span>)
|
1641
|
+
<span class="ruby-identifier">s</span> = {
|
1642
|
+
<span class="ruby-value str">'host'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'collector.newrelic.com'</span>,
|
1643
|
+
<span class="ruby-value str">'ssl'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>,
|
1644
|
+
<span class="ruby-value str">'log_level'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'info'</span>,
|
1645
|
+
<span class="ruby-value str">'apdex_t'</span> =<span class="ruby-operator">></span> <span class="ruby-value">1.0</span>
|
1646
|
+
}
|
1647
|
+
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">settings_hash</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">settings_hash</span>
|
1648
|
+
<span class="ruby-comment cmt"># monitor_daemons replaced with agent_enabled</span>
|
1649
|
+
<span class="ruby-identifier">s</span>[<span class="ruby-value str">'agent_enabled'</span>] = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'monitor_daemons'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>[<span class="ruby-value str">'agent_enabled'</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'monitor_daemons'</span>)
|
1650
|
+
<span class="ruby-identifier">s</span>
|
1651
|
+
<span class="ruby-keyword kw">end</span>
|
1652
|
+
</pre>
|
1653
|
+
</div>
|
1654
|
+
</div>
|
1655
|
+
</div>
|
1656
|
+
|
1657
|
+
<div id="method-M000454" class="method-detail">
|
1658
|
+
<a name="M000454"></a>
|
1659
|
+
|
1660
|
+
<div class="method-heading">
|
1661
|
+
<a href="#M000454" class="method-signature">
|
1662
|
+
<span class="method-name">newrelic_root</span><span class="method-args">()</span>
|
1663
|
+
</a>
|
1664
|
+
</div>
|
1665
|
+
|
1666
|
+
<div class="method-description">
|
1667
|
+
<p><a class="source-toggle" href="#"
|
1668
|
+
onclick="toggleCode('M000454-source');return false;">[Source]</a></p>
|
1669
|
+
<div class="method-source-code" id="M000454-source">
|
1670
|
+
<pre>
|
1671
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 481</span>
|
1672
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">newrelic_root</span>
|
1673
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">newrelic_root</span>
|
1674
|
+
<span class="ruby-keyword kw">end</span>
|
1675
|
+
</pre>
|
1676
|
+
</div>
|
1677
|
+
</div>
|
1678
|
+
</div>
|
1679
|
+
|
1680
|
+
<div id="method-M000447" class="method-detail">
|
1681
|
+
<a name="M000447"></a>
|
1682
|
+
|
1683
|
+
<div class="method-heading">
|
1684
|
+
<a href="#M000447" class="method-signature">
|
1685
|
+
<span class="method-name">setup_log</span><span class="method-args">()</span>
|
1686
|
+
</a>
|
1687
|
+
</div>
|
1688
|
+
|
1689
|
+
<div class="method-description">
|
1690
|
+
<p>
|
1691
|
+
<a href="Control.html">Control</a> subclasses may override this, but it can
|
1692
|
+
be called multiple times.
|
1693
|
+
</p>
|
1694
|
+
<p><a class="source-toggle" href="#"
|
1695
|
+
onclick="toggleCode('M000447-source');return false;">[Source]</a></p>
|
1696
|
+
<div class="method-source-code" id="M000447-source">
|
1697
|
+
<pre>
|
1698
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 404</span>
|
1699
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup_log</span>
|
1700
|
+
<span class="ruby-ivar">@log_file</span> = <span class="ruby-node">"#{log_path}/newrelic_agent.log"</span>
|
1701
|
+
<span class="ruby-ivar">@log</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@log_file</span>
|
1702
|
+
|
1703
|
+
<span class="ruby-comment cmt"># change the format just for our logger</span>
|
1704
|
+
|
1705
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">format_message</span>(<span class="ruby-identifier">severity</span>, <span class="ruby-identifier">timestamp</span>, <span class="ruby-identifier">progname</span>, <span class="ruby-identifier">msg</span>)
|
1706
|
+
<span class="ruby-node">"[#{timestamp.strftime("%m/%d/%y %H:%M:%S %z")} #{Socket.gethostname} (#{$$})] #{severity} : #{msg}\n"</span>
|
1707
|
+
<span class="ruby-keyword kw">end</span>
|
1708
|
+
|
1709
|
+
<span class="ruby-comment cmt"># set the log level as specified in the config file</span>
|
1710
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">fetch</span>(<span class="ruby-value str">"log_level"</span>,<span class="ruby-value str">"info"</span>).<span class="ruby-identifier">downcase</span>
|
1711
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"debug"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
1712
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"info"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">INFO</span>
|
1713
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"warn"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">WARN</span>
|
1714
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"error"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">ERROR</span>
|
1715
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"fatal"</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">FATAL</span>
|
1716
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">INFO</span>
|
1717
|
+
<span class="ruby-keyword kw">end</span>
|
1718
|
+
<span class="ruby-ivar">@log</span>
|
1719
|
+
<span class="ruby-keyword kw">end</span>
|
1720
|
+
</pre>
|
1721
|
+
</div>
|
1722
|
+
</div>
|
1723
|
+
</div>
|
1724
|
+
|
1725
|
+
<div id="method-M000448" class="method-detail">
|
1726
|
+
<a name="M000448"></a>
|
1727
|
+
|
1728
|
+
<div class="method-heading">
|
1729
|
+
<a href="#M000448" class="method-signature">
|
1730
|
+
<span class="method-name">to_stdout</span><span class="method-args">(msg)</span>
|
1731
|
+
</a>
|
1732
|
+
</div>
|
1733
|
+
|
1734
|
+
<div class="method-description">
|
1735
|
+
<p><a class="source-toggle" href="#"
|
1736
|
+
onclick="toggleCode('M000448-source');return false;">[Source]</a></p>
|
1737
|
+
<div class="method-source-code" id="M000448-source">
|
1738
|
+
<pre>
|
1739
|
+
<span class="ruby-comment cmt"># File lib/new_relic/control.rb, line 426</span>
|
1740
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_stdout</span><span class="ruby-identifier">to_stdout</span>(<span class="ruby-identifier">msg</span>)
|
1741
|
+
<span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">"** [NewRelic] "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>
|
1742
|
+
<span class="ruby-keyword kw">end</span>
|
1743
|
+
</pre>
|
1744
|
+
</div>
|
1745
|
+
</div>
|
1746
|
+
</div>
|
1747
|
+
|
1748
|
+
|
1749
|
+
</div>
|
1750
|
+
|
1751
|
+
|
1752
|
+
</div>
|
1753
|
+
|
1754
|
+
|
1755
|
+
<div id="validator-badges">
|
1756
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1757
|
+
</div>
|
1758
|
+
|
1759
|
+
</body>
|
1760
|
+
</html>
|