newrelic_rpm 2.10.8 → 2.11.0.beta
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 +15 -3
- data/lib/new_relic/agent.rb +17 -6
- data/lib/new_relic/agent/agent.rb +98 -77
- data/lib/new_relic/agent/busy_calculator.rb +1 -1
- data/lib/new_relic/agent/error_collector.rb +6 -3
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +1 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +0 -2
- data/lib/new_relic/agent/instrumentation/memcache.rb +0 -1
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +8 -2
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +3 -3
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +10 -0
- data/lib/new_relic/agent/method_tracer.rb +1 -1
- data/lib/new_relic/agent/shim_agent.rb +1 -1
- data/lib/new_relic/agent/stats_engine.rb +1 -1
- data/lib/new_relic/agent/stats_engine/samplers.rb +2 -2
- data/lib/new_relic/control.rb +6 -3
- data/lib/new_relic/rack/metric_app.rb +4 -4
- data/lib/new_relic/version.rb +3 -3
- data/newrelic.yml +3 -3
- data/newrelic_rpm.gemspec +4 -192
- data/test/new_relic/agent/rpm_agent_test.rb +15 -2
- data/test/new_relic/agent/task_instrumentation_test.rb +3 -2
- metadata +12 -197
- data/rdoc/classes/NewRelic.html +0 -293
- data/rdoc/classes/NewRelic/Agent.html +0 -810
- data/rdoc/classes/NewRelic/Agent/Agent.html +0 -742
- data/rdoc/classes/NewRelic/Agent/BackgroundLoadingError.html +0 -111
- data/rdoc/classes/NewRelic/Agent/BusyCalculator.html +0 -309
- data/rdoc/classes/NewRelic/Agent/CollectionHelper.html +0 -196
- data/rdoc/classes/NewRelic/Agent/ErrorCollector.html +0 -378
- data/rdoc/classes/NewRelic/Agent/ForceDisconnectException.html +0 -118
- data/rdoc/classes/NewRelic/Agent/ForceRestartException.html +0 -117
- data/rdoc/classes/NewRelic/Agent/IgnoreSilentlyException.html +0 -118
- data/rdoc/classes/NewRelic/Agent/Instrumentation.html +0 -174
- data/rdoc/classes/NewRelic/Agent/Instrumentation/ActiveRecordInstrumentation.html +0 -221
- data/rdoc/classes/NewRelic/Agent/Instrumentation/ControllerInstrumentation.html +0 -349
- data/rdoc/classes/NewRelic/Agent/Instrumentation/ControllerInstrumentation/ClassMethods.html +0 -277
- data/rdoc/classes/NewRelic/Agent/Instrumentation/DelayedJobInstrumentation.html +0 -112
- data/rdoc/classes/NewRelic/Agent/Instrumentation/MetricFrame.html +0 -1007
- data/rdoc/classes/NewRelic/Agent/Instrumentation/Rack.html +0 -321
- data/rdoc/classes/NewRelic/Agent/Instrumentation/Sinatra.html +0 -176
- data/rdoc/classes/NewRelic/Agent/LicenseException.html +0 -117
- data/rdoc/classes/NewRelic/Agent/MethodTracer.html +0 -150
- data/rdoc/classes/NewRelic/Agent/MethodTracer/ClassMethods.html +0 -295
- data/rdoc/classes/NewRelic/Agent/MethodTracer/InstanceMethods.html +0 -284
- data/rdoc/classes/NewRelic/Agent/PostTooBigException.html +0 -120
- data/rdoc/classes/NewRelic/Agent/Sampler.html +0 -314
- data/rdoc/classes/NewRelic/Agent/Sampler/Unsupported.html +0 -117
- data/rdoc/classes/NewRelic/Agent/Samplers.html +0 -126
- data/rdoc/classes/NewRelic/Agent/Samplers/CpuSampler.html +0 -327
- data/rdoc/classes/NewRelic/Agent/Samplers/DelayedJobLockSampler.html +0 -296
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler.html +0 -321
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/Base.html +0 -186
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/JavaHeapSampler.html +0 -173
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/ProcStatus.html +0 -216
- data/rdoc/classes/NewRelic/Agent/Samplers/MemorySampler/ShellPS.html +0 -207
- data/rdoc/classes/NewRelic/Agent/Samplers/ObjectSampler.html +0 -222
- data/rdoc/classes/NewRelic/Agent/ServerError.html +0 -117
- data/rdoc/classes/NewRelic/Agent/ShimAgent.html +0 -297
- data/rdoc/classes/NewRelic/Agent/StatsEngine.html +0 -204
- data/rdoc/classes/NewRelic/Agent/StatsEngine/MetricStats.html +0 -441
- data/rdoc/classes/NewRelic/Agent/StatsEngine/Samplers.html +0 -237
- data/rdoc/classes/NewRelic/Agent/StatsEngine/ScopeStackElement.html +0 -178
- data/rdoc/classes/NewRelic/Agent/StatsEngine/Transactions.html +0 -385
- data/rdoc/classes/NewRelic/Agent/TransactionSampleBuilder.html +0 -505
- data/rdoc/classes/NewRelic/Agent/TransactionSampler.html +0 -690
- data/rdoc/classes/NewRelic/Agent/WorkerLoop.html +0 -305
- data/rdoc/classes/NewRelic/Agent/WorkerLoop/LoopTask.html +0 -224
- data/rdoc/classes/NewRelic/ApdexStats.html +0 -196
- data/rdoc/classes/NewRelic/BasicStats.html +0 -113
- data/rdoc/classes/NewRelic/ChainedCall.html +0 -180
- data/rdoc/classes/NewRelic/Commands.html +0 -112
- data/rdoc/classes/NewRelic/Commands/CommandFailure.html +0 -167
- data/rdoc/classes/NewRelic/Commands/Deployments.html +0 -285
- data/rdoc/classes/NewRelic/Control.html +0 -1760
- data/rdoc/classes/NewRelic/Control/External.html +0 -148
- data/rdoc/classes/NewRelic/Control/Merb.html +0 -227
- data/rdoc/classes/NewRelic/Control/Rails.html +0 -542
- data/rdoc/classes/NewRelic/Control/Ruby.html +0 -266
- data/rdoc/classes/NewRelic/Control/Sinatra.html +0 -178
- data/rdoc/classes/NewRelic/DelayedJobInjection.html +0 -118
- data/rdoc/classes/NewRelic/Histogram.html +0 -226
- data/rdoc/classes/NewRelic/Histogram/Bucket.html +0 -319
- data/rdoc/classes/NewRelic/Histogram/Shim.html +0 -144
- data/rdoc/classes/NewRelic/LocalEnvironment.html +0 -572
- data/rdoc/classes/NewRelic/MerbBootLoader.html +0 -146
- data/rdoc/classes/NewRelic/MethodTraceStats.html +0 -250
- data/rdoc/classes/NewRelic/MetricData.html +0 -347
- data/rdoc/classes/NewRelic/MetricParser.html +0 -747
- data/rdoc/classes/NewRelic/MetricParser/ActionMailer.html +0 -170
- data/rdoc/classes/NewRelic/MetricParser/ActiveMerchant.html +0 -267
- data/rdoc/classes/NewRelic/MetricParser/ActiveRecord.html +0 -250
- data/rdoc/classes/NewRelic/MetricParser/Controller.html +0 -363
- data/rdoc/classes/NewRelic/MetricParser/ControllerCPU.html +0 -319
- data/rdoc/classes/NewRelic/MetricParser/Errors.html +0 -170
- data/rdoc/classes/NewRelic/MetricParser/External.html +0 -339
- data/rdoc/classes/NewRelic/MetricParser/MemCache.html +0 -340
- data/rdoc/classes/NewRelic/MetricParser/OtherTransaction.html +0 -205
- data/rdoc/classes/NewRelic/MetricParser/View.html +0 -381
- data/rdoc/classes/NewRelic/MetricParser/WebFrontend.html +0 -182
- data/rdoc/classes/NewRelic/MetricParser/WebService.html +0 -172
- data/rdoc/classes/NewRelic/MetricSpec.html +0 -406
- data/rdoc/classes/NewRelic/Metrics.html +0 -138
- data/rdoc/classes/NewRelic/NoticedError.html +0 -200
- data/rdoc/classes/NewRelic/Rack.html +0 -112
- data/rdoc/classes/NewRelic/Rack/MetricApp.html +0 -193
- data/rdoc/classes/NewRelic/Rack/Status.html +0 -165
- data/rdoc/classes/NewRelic/ScopedMethodTraceStats.html +0 -225
- data/rdoc/classes/NewRelic/Stats.html +0 -917
- data/rdoc/classes/NewRelic/StatsBase.html +0 -346
- data/rdoc/classes/NewRelic/TransactionAnalysis.html +0 -269
- data/rdoc/classes/NewRelic/TransactionAnalysis/SegmentSummary.html +0 -338
- data/rdoc/classes/NewRelic/TransactionSample.html +0 -766
- data/rdoc/classes/NewRelic/TransactionSample/CompositeSegment.html +0 -195
- data/rdoc/classes/NewRelic/TransactionSample/FakeSegment.html +0 -113
- data/rdoc/classes/NewRelic/TransactionSample/IDGenerator.html +0 -178
- data/rdoc/classes/NewRelic/TransactionSample/Segment.html +0 -920
- data/rdoc/classes/NewRelic/TransactionSample/SummarySegment.html +0 -180
- data/rdoc/classes/NewRelic/VersionNumber.html +0 -338
- data/rdoc/classes/NewRelicApi.html +0 -270
- data/rdoc/classes/NewRelicApi/Account.html +0 -178
- data/rdoc/classes/NewRelicApi/Account/AccountUsage.html +0 -111
- data/rdoc/classes/NewRelicApi/Account/AccountView.html +0 -146
- data/rdoc/classes/NewRelicApi/Application.html +0 -139
- data/rdoc/classes/NewRelicApi/Application/Agent.html +0 -119
- data/rdoc/classes/NewRelicApi/Deployment.html +0 -123
- data/rdoc/classes/NewRelicApi/Subscription.html +0 -111
- data/rdoc/classes/NewRelicApi/ThresholdValue.html +0 -174
- data/rdoc/classes/NewRelicApi/User.html +0 -111
- data/rdoc/created.rid +0 -1
- data/rdoc/files/CHANGELOG.html +0 -649
- data/rdoc/files/LICENSE.html +0 -143
- data/rdoc/files/lib/new_relic/agent/agent_rb.html +0 -113
- data/rdoc/files/lib/new_relic/agent/busy_calculator_rb.html +0 -115
- data/rdoc/files/lib/new_relic/agent/chained_call_rb.html +0 -107
- data/rdoc/files/lib/new_relic/agent/collection_helper_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/error_collector_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/instrumentation/active_merchant_rb.html +0 -107
- data/rdoc/files/lib/new_relic/agent/instrumentation/active_record_instrumentation_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/instrumentation/authlogic_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/instrumentation/controller_instrumentation_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/instrumentation/data_mapper_rb.html +0 -191
- data/rdoc/files/lib/new_relic/agent/instrumentation/delayed_job_instrumentation_rb.html +0 -109
- data/rdoc/files/lib/new_relic/agent/instrumentation/memcache_rb.html +0 -152
- data/rdoc/files/lib/new_relic/agent/instrumentation/merb/controller_rb.html +0 -155
- data/rdoc/files/lib/new_relic/agent/instrumentation/merb/errors_rb.html +0 -107
- data/rdoc/files/lib/new_relic/agent/instrumentation/metric_frame_rb.html +0 -113
- data/rdoc/files/lib/new_relic/agent/instrumentation/net_rb.html +0 -172
- data/rdoc/files/lib/new_relic/agent/instrumentation/passenger_instrumentation_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/instrumentation/rack_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/instrumentation/rails/action_controller_rb.html +0 -152
- data/rdoc/files/lib/new_relic/agent/instrumentation/rails/action_web_service_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/instrumentation/rails/errors_rb.html +0 -167
- data/rdoc/files/lib/new_relic/agent/instrumentation/sinatra_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/method_tracer_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/sampler_rb.html +0 -116
- data/rdoc/files/lib/new_relic/agent/samplers/cpu_sampler_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/samplers/delayed_job_lock_sampler_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/samplers/memory_sampler_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/samplers/object_sampler_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/shim_agent_rb.html +0 -108
- data/rdoc/files/lib/new_relic/agent/stats_engine/metric_stats_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/stats_engine/samplers_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/stats_engine/transactions_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/stats_engine_rb.html +0 -110
- data/rdoc/files/lib/new_relic/agent/transaction_sampler_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent/worker_loop_rb.html +0 -101
- data/rdoc/files/lib/new_relic/agent_rb.html +0 -204
- data/rdoc/files/lib/new_relic/commands/deployments_rb.html +0 -119
- data/rdoc/files/lib/new_relic/commands/new_relic_commands_rb.html +0 -108
- data/rdoc/files/lib/new_relic/control/external_rb.html +0 -117
- data/rdoc/files/lib/new_relic/control/merb_rb.html +0 -101
- data/rdoc/files/lib/new_relic/control/rails_rb.html +0 -108
- data/rdoc/files/lib/new_relic/control/ruby_rb.html +0 -110
- data/rdoc/files/lib/new_relic/control/sinatra_rb.html +0 -108
- data/rdoc/files/lib/new_relic/control_rb.html +0 -116
- data/rdoc/files/lib/new_relic/delayed_job_injection_rb.html +0 -180
- data/rdoc/files/lib/new_relic/histogram_rb.html +0 -114
- data/rdoc/files/lib/new_relic/local_environment_rb.html +0 -111
- data/rdoc/files/lib/new_relic/merbtasks_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_data_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/action_mailer_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/active_merchant_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/active_record_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/controller_cpu_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/controller_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/errors_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/external_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/mem_cache_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/other_transaction_rb.html +0 -108
- data/rdoc/files/lib/new_relic/metric_parser/view_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser/web_frontend_rb.html +0 -107
- data/rdoc/files/lib/new_relic/metric_parser/web_service_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_parser_rb.html +0 -101
- data/rdoc/files/lib/new_relic/metric_spec_rb.html +0 -108
- data/rdoc/files/lib/new_relic/metrics_rb.html +0 -101
- data/rdoc/files/lib/new_relic/noticed_error_rb.html +0 -107
- data/rdoc/files/lib/new_relic/rack/metric_app_rb.html +0 -108
- data/rdoc/files/lib/new_relic/rack_app_rb.html +0 -110
- data/rdoc/files/lib/new_relic/recipes_rb.html +0 -128
- data/rdoc/files/lib/new_relic/stats_rb.html +0 -101
- data/rdoc/files/lib/new_relic/transaction_analysis_rb.html +0 -108
- data/rdoc/files/lib/new_relic/transaction_sample_rb.html +0 -101
- data/rdoc/files/lib/new_relic/version_rb.html +0 -101
- data/rdoc/files/lib/new_relic_api_rb.html +0 -145
- data/rdoc/files/lib/newrelic_rpm_rb.html +0 -147
- data/rdoc/files/lib/tasks/all_rb.html +0 -107
- data/rdoc/fr_class_index.html +0 -134
- data/rdoc/fr_file_index.html +0 -103
- data/rdoc/fr_method_index.html +0 -568
- data/rdoc/index.html +0 -24
- data/rdoc/rdoc-style.css +0 -208
@@ -1,441 +0,0 @@
|
|
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>Module: NewRelic::Agent::StatsEngine::MetricStats</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>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">NewRelic::Agent::StatsEngine::MetricStats</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/new_relic/agent/stats_engine/metric_stats_rb.html">
|
59
|
-
lib/new_relic/agent/stats_engine/metric_stats.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000237">clear_stats</a>
|
84
|
-
<a href="#M000233">get_custom_stats</a>
|
85
|
-
<a href="#M000234">get_stats</a>
|
86
|
-
<a href="#M000232">get_stats_no_scope</a>
|
87
|
-
<a href="#M000236">harvest_timeslice_data</a>
|
88
|
-
<a href="#M000230">lookup_stat</a>
|
89
|
-
<a href="#M000235">lookup_stats</a>
|
90
|
-
<a href="#M000231">metrics</a>
|
91
|
-
<a href="#M000238">reset_stats</a>
|
92
|
-
<a href="#M000239">stats_hash</a>
|
93
|
-
</div>
|
94
|
-
</div>
|
95
|
-
|
96
|
-
</div>
|
97
|
-
|
98
|
-
|
99
|
-
<!-- if includes -->
|
100
|
-
|
101
|
-
<div id="section">
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<!-- if method_list -->
|
111
|
-
<div id="methods">
|
112
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
113
|
-
|
114
|
-
<div id="method-M000237" class="method-detail">
|
115
|
-
<a name="M000237"></a>
|
116
|
-
|
117
|
-
<div class="method-heading">
|
118
|
-
<a href="#M000237" class="method-signature">
|
119
|
-
<span class="method-name">clear_stats</span><span class="method-args">()</span>
|
120
|
-
</a>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
<div class="method-description">
|
124
|
-
<p>
|
125
|
-
Remove all stats. For test code only.
|
126
|
-
</p>
|
127
|
-
<p><a class="source-toggle" href="#"
|
128
|
-
onclick="toggleCode('M000237-source');return false;">[Source]</a></p>
|
129
|
-
<div class="method-source-code" id="M000237-source">
|
130
|
-
<pre>
|
131
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 102</span>
|
132
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_stats</span>
|
133
|
-
<span class="ruby-identifier">stats_hash</span>.<span class="ruby-identifier">clear</span>
|
134
|
-
<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">BusyCalculator</span>.<span class="ruby-identifier">reset</span>
|
135
|
-
<span class="ruby-keyword kw">end</span>
|
136
|
-
</pre>
|
137
|
-
</div>
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div id="method-M000233" class="method-detail">
|
142
|
-
<a name="M000233"></a>
|
143
|
-
|
144
|
-
<div class="method-heading">
|
145
|
-
<a href="#M000233" class="method-signature">
|
146
|
-
<span class="method-name">get_custom_stats</span><span class="method-args">(metric_name, stat_class)</span>
|
147
|
-
</a>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
<div class="method-description">
|
151
|
-
<p>
|
152
|
-
This version allows a caller to pass a stat class to use
|
153
|
-
</p>
|
154
|
-
<p><a class="source-toggle" href="#"
|
155
|
-
onclick="toggleCode('M000233-source');return false;">[Source]</a></p>
|
156
|
-
<div class="method-source-code" id="M000233-source">
|
157
|
-
<pre>
|
158
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 21</span>
|
159
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_custom_stats</span>(<span class="ruby-identifier">metric_name</span>, <span class="ruby-identifier">stat_class</span>)
|
160
|
-
<span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">metric_name</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">stat_class</span>.<span class="ruby-identifier">new</span>
|
161
|
-
<span class="ruby-keyword kw">end</span>
|
162
|
-
</pre>
|
163
|
-
</div>
|
164
|
-
</div>
|
165
|
-
</div>
|
166
|
-
|
167
|
-
<div id="method-M000234" class="method-detail">
|
168
|
-
<a name="M000234"></a>
|
169
|
-
|
170
|
-
<div class="method-heading">
|
171
|
-
<a href="#M000234" class="method-signature">
|
172
|
-
<span class="method-name">get_stats</span><span class="method-args">(metric_name, use_scope = true, scoped_metric_only = false)</span>
|
173
|
-
</a>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<div class="method-description">
|
177
|
-
<p>
|
178
|
-
If use_scope is true, two chained <a
|
179
|
-
href="MetricStats.html#M000231">metrics</a> are created, one with scope and
|
180
|
-
one without If scoped_metric_only is true, only a scoped metric is created
|
181
|
-
(used by rendering <a href="MetricStats.html#M000231">metrics</a> which by
|
182
|
-
definition are per controller only)
|
183
|
-
</p>
|
184
|
-
<p><a class="source-toggle" href="#"
|
185
|
-
onclick="toggleCode('M000234-source');return false;">[Source]</a></p>
|
186
|
-
<div class="method-source-code" id="M000234-source">
|
187
|
-
<pre>
|
188
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 27</span>
|
189
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_stats</span>(<span class="ruby-identifier">metric_name</span>, <span class="ruby-identifier">use_scope</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">scoped_metric_only</span> = <span class="ruby-keyword kw">false</span>)
|
190
|
-
|
191
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scoped_metric_only</span>
|
192
|
-
<span class="ruby-identifier">spec</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MetricSpec</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">metric_name</span>, <span class="ruby-identifier">scope_name</span>
|
193
|
-
<span class="ruby-identifier">stats</span> = <span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">spec</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodTraceStats</span>.<span class="ruby-identifier">new</span>
|
194
|
-
<span class="ruby-keyword kw">else</span>
|
195
|
-
<span class="ruby-identifier">stats</span> = <span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">metric_name</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodTraceStats</span>.<span class="ruby-identifier">new</span>
|
196
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">use_scope</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">scope_name</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">scope_name</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">metric_name</span>
|
197
|
-
<span class="ruby-identifier">spec</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MetricSpec</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">metric_name</span>, <span class="ruby-identifier">scope_name</span>
|
198
|
-
<span class="ruby-identifier">scoped_stats</span> = <span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">spec</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">ScopedMethodTraceStats</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">stats</span>)
|
199
|
-
<span class="ruby-identifier">stats</span> = <span class="ruby-identifier">scoped_stats</span>
|
200
|
-
<span class="ruby-keyword kw">end</span>
|
201
|
-
<span class="ruby-keyword kw">end</span>
|
202
|
-
<span class="ruby-identifier">stats</span>
|
203
|
-
<span class="ruby-keyword kw">end</span>
|
204
|
-
</pre>
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
</div>
|
208
|
-
|
209
|
-
<div id="method-M000232" class="method-detail">
|
210
|
-
<a name="M000232"></a>
|
211
|
-
|
212
|
-
<div class="method-heading">
|
213
|
-
<a href="#M000232" class="method-signature">
|
214
|
-
<span class="method-name">get_stats_no_scope</span><span class="method-args">(metric_name)</span>
|
215
|
-
</a>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
<p><a class="source-toggle" href="#"
|
220
|
-
onclick="toggleCode('M000232-source');return false;">[Source]</a></p>
|
221
|
-
<div class="method-source-code" id="M000232-source">
|
222
|
-
<pre>
|
223
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 15</span>
|
224
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_stats_no_scope</span>(<span class="ruby-identifier">metric_name</span>)
|
225
|
-
<span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">metric_name</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MethodTraceStats</span>.<span class="ruby-identifier">new</span>
|
226
|
-
<span class="ruby-keyword kw">end</span>
|
227
|
-
</pre>
|
228
|
-
</div>
|
229
|
-
</div>
|
230
|
-
</div>
|
231
|
-
|
232
|
-
<div id="method-M000236" class="method-detail">
|
233
|
-
<a name="M000236"></a>
|
234
|
-
|
235
|
-
<div class="method-heading">
|
236
|
-
<a href="#M000236" class="method-signature">
|
237
|
-
<span class="method-name">harvest_timeslice_data</span><span class="method-args">(previous_timeslice_data, metric_ids)</span>
|
238
|
-
</a>
|
239
|
-
</div>
|
240
|
-
|
241
|
-
<div class="method-description">
|
242
|
-
<p>
|
243
|
-
Harvest the timeslice data. First recombine current statss with any
|
244
|
-
previously unsent <a href="MetricStats.html#M000231">metrics</a>, clear out
|
245
|
-
stats cache, and return the current stats.
|
246
|
-
</p>
|
247
|
-
<hr size="1"></hr><p>
|
248
|
-
Note: this is not synchronized. There is still some risk in this and we
|
249
|
-
will revisit later to see if we can make this more robust without
|
250
|
-
sacrificing efficiency. +++
|
251
|
-
</p>
|
252
|
-
<p><a class="source-toggle" href="#"
|
253
|
-
onclick="toggleCode('M000236-source');return false;">[Source]</a></p>
|
254
|
-
<div class="method-source-code" id="M000236-source">
|
255
|
-
<pre>
|
256
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 56</span>
|
257
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">harvest_timeslice_data</span>(<span class="ruby-identifier">previous_timeslice_data</span>, <span class="ruby-identifier">metric_ids</span>)
|
258
|
-
<span class="ruby-identifier">timeslice_data</span> = {}
|
259
|
-
<span class="ruby-identifier">poll</span> <span class="ruby-identifier">harvest_samplers</span>
|
260
|
-
<span class="ruby-identifier">stats_hash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">metric_spec</span> <span class="ruby-operator">|</span>
|
261
|
-
|
262
|
-
|
263
|
-
<span class="ruby-comment cmt"># get a copy of the stats collected since the last harvest, and clear</span>
|
264
|
-
<span class="ruby-comment cmt"># the stats inside our hash table for the next time slice.</span>
|
265
|
-
<span class="ruby-identifier">stats</span> = <span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">metric_spec</span>]
|
266
|
-
|
267
|
-
<span class="ruby-comment cmt"># we have an optimization for unscoped metrics</span>
|
268
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">metric_spec</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MetricSpec</span>)
|
269
|
-
<span class="ruby-identifier">metric_spec</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MetricSpec</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">metric_spec</span>
|
270
|
-
<span class="ruby-keyword kw">end</span>
|
271
|
-
|
272
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">nil?</span>
|
273
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Nil stats for #{metric_spec.name} (#{metric_spec.scope})"</span>
|
274
|
-
<span class="ruby-keyword kw">end</span>
|
275
|
-
|
276
|
-
<span class="ruby-identifier">stats_copy</span> = <span class="ruby-identifier">stats</span>.<span class="ruby-identifier">clone</span>
|
277
|
-
<span class="ruby-identifier">stats</span>.<span class="ruby-identifier">reset</span>
|
278
|
-
|
279
|
-
<span class="ruby-comment cmt"># if the previous timeslice data has not been reported (due to an error of some sort)</span>
|
280
|
-
<span class="ruby-comment cmt"># then we need to merge this timeslice with the previously accumulated - but not sent</span>
|
281
|
-
<span class="ruby-comment cmt"># data</span>
|
282
|
-
<span class="ruby-identifier">previous_metric_data</span> = <span class="ruby-identifier">previous_timeslice_data</span>[<span class="ruby-identifier">metric_spec</span>]
|
283
|
-
<span class="ruby-identifier">stats_copy</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">previous_metric_data</span>.<span class="ruby-identifier">stats</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">previous_metric_data</span>.<span class="ruby-identifier">nil?</span>
|
284
|
-
<span class="ruby-identifier">stats_copy</span>.<span class="ruby-identifier">round!</span>
|
285
|
-
|
286
|
-
<span class="ruby-comment cmt"># don't bother collecting and reporting stats that have zero-values for this timeslice.</span>
|
287
|
-
<span class="ruby-comment cmt"># significant performance boost and storage savings.</span>
|
288
|
-
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stats_copy</span>.<span class="ruby-identifier">is_reset?</span>
|
289
|
-
|
290
|
-
<span class="ruby-identifier">id</span> = <span class="ruby-identifier">metric_ids</span>[<span class="ruby-identifier">metric_spec</span>]
|
291
|
-
<span class="ruby-identifier">metric_spec_for_transport</span> = <span class="ruby-identifier">id</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">metric_spec</span>
|
292
|
-
|
293
|
-
<span class="ruby-identifier">metric_data</span> = <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MetricData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">metric_spec_for_transport</span>, <span class="ruby-identifier">stats_copy</span>, <span class="ruby-identifier">id</span>)
|
294
|
-
|
295
|
-
<span class="ruby-identifier">timeslice_data</span>[<span class="ruby-identifier">metric_spec</span>] = <span class="ruby-identifier">metric_data</span>
|
296
|
-
<span class="ruby-keyword kw">end</span>
|
297
|
-
<span class="ruby-keyword kw">end</span>
|
298
|
-
|
299
|
-
<span class="ruby-identifier">timeslice_data</span>
|
300
|
-
<span class="ruby-keyword kw">end</span>
|
301
|
-
</pre>
|
302
|
-
</div>
|
303
|
-
</div>
|
304
|
-
</div>
|
305
|
-
|
306
|
-
<div id="method-M000230" class="method-detail">
|
307
|
-
<a name="M000230"></a>
|
308
|
-
|
309
|
-
<div class="method-heading">
|
310
|
-
<a href="#M000230" class="method-signature">
|
311
|
-
<span class="method-name">lookup_stat</span><span class="method-args">(metric_name)</span>
|
312
|
-
</a>
|
313
|
-
</div>
|
314
|
-
|
315
|
-
<div class="method-description">
|
316
|
-
<p>
|
317
|
-
The stats hash hashes either a metric name for an unscoped metric, or a
|
318
|
-
metric_spec for a scoped metric value.
|
319
|
-
</p>
|
320
|
-
<p><a class="source-toggle" href="#"
|
321
|
-
onclick="toggleCode('M000230-source');return false;">[Source]</a></p>
|
322
|
-
<div class="method-source-code" id="M000230-source">
|
323
|
-
<pre>
|
324
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 7</span>
|
325
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lookup_stat</span>(<span class="ruby-identifier">metric_name</span>)
|
326
|
-
<span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">metric_name</span>]
|
327
|
-
<span class="ruby-keyword kw">end</span>
|
328
|
-
</pre>
|
329
|
-
</div>
|
330
|
-
</div>
|
331
|
-
</div>
|
332
|
-
|
333
|
-
<div id="method-M000235" class="method-detail">
|
334
|
-
<a name="M000235"></a>
|
335
|
-
|
336
|
-
<div class="method-heading">
|
337
|
-
<a href="#M000235" class="method-signature">
|
338
|
-
<span class="method-name">lookup_stats</span><span class="method-args">(metric_name, scope_name = nil)</span>
|
339
|
-
</a>
|
340
|
-
</div>
|
341
|
-
|
342
|
-
<div class="method-description">
|
343
|
-
<p><a class="source-toggle" href="#"
|
344
|
-
onclick="toggleCode('M000235-source');return false;">[Source]</a></p>
|
345
|
-
<div class="method-source-code" id="M000235-source">
|
346
|
-
<pre>
|
347
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 43</span>
|
348
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lookup_stats</span>(<span class="ruby-identifier">metric_name</span>, <span class="ruby-identifier">scope_name</span> = <span class="ruby-keyword kw">nil</span>)
|
349
|
-
<span class="ruby-identifier">stats_hash</span>[<span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">MetricSpec</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">metric_name</span>, <span class="ruby-identifier">scope_name</span>)] <span class="ruby-operator">||</span>
|
350
|
-
<span class="ruby-identifier">stats_hash</span>[<span class="ruby-identifier">metric_name</span>]
|
351
|
-
<span class="ruby-keyword kw">end</span>
|
352
|
-
</pre>
|
353
|
-
</div>
|
354
|
-
</div>
|
355
|
-
</div>
|
356
|
-
|
357
|
-
<div id="method-M000231" class="method-detail">
|
358
|
-
<a name="M000231"></a>
|
359
|
-
|
360
|
-
<div class="method-heading">
|
361
|
-
<a href="#M000231" class="method-signature">
|
362
|
-
<span class="method-name">metrics</span><span class="method-args">()</span>
|
363
|
-
</a>
|
364
|
-
</div>
|
365
|
-
|
366
|
-
<div class="method-description">
|
367
|
-
<p><a class="source-toggle" href="#"
|
368
|
-
onclick="toggleCode('M000231-source');return false;">[Source]</a></p>
|
369
|
-
<div class="method-source-code" id="M000231-source">
|
370
|
-
<pre>
|
371
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 11</span>
|
372
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">metrics</span>
|
373
|
-
<span class="ruby-identifier">stats_hash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">:to_s</span>)
|
374
|
-
<span class="ruby-keyword kw">end</span>
|
375
|
-
</pre>
|
376
|
-
</div>
|
377
|
-
</div>
|
378
|
-
</div>
|
379
|
-
|
380
|
-
<div id="method-M000238" class="method-detail">
|
381
|
-
<a name="M000238"></a>
|
382
|
-
|
383
|
-
<div class="method-heading">
|
384
|
-
<a href="#M000238" class="method-signature">
|
385
|
-
<span class="method-name">reset_stats</span><span class="method-args">()</span>
|
386
|
-
</a>
|
387
|
-
</div>
|
388
|
-
|
389
|
-
<div class="method-description">
|
390
|
-
<p>
|
391
|
-
Reset each of the stats, such as when a new passenger instance starts up.
|
392
|
-
</p>
|
393
|
-
<p><a class="source-toggle" href="#"
|
394
|
-
onclick="toggleCode('M000238-source');return false;">[Source]</a></p>
|
395
|
-
<div class="method-source-code" id="M000238-source">
|
396
|
-
<pre>
|
397
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 108</span>
|
398
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset_stats</span>
|
399
|
-
<span class="ruby-identifier">stats_hash</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">reset</span> }
|
400
|
-
<span class="ruby-keyword kw">end</span>
|
401
|
-
</pre>
|
402
|
-
</div>
|
403
|
-
</div>
|
404
|
-
</div>
|
405
|
-
|
406
|
-
<div id="method-M000239" class="method-detail">
|
407
|
-
<a name="M000239"></a>
|
408
|
-
|
409
|
-
<div class="method-heading">
|
410
|
-
<a href="#M000239" class="method-signature">
|
411
|
-
<span class="method-name">stats_hash</span><span class="method-args">()</span>
|
412
|
-
</a>
|
413
|
-
</div>
|
414
|
-
|
415
|
-
<div class="method-description">
|
416
|
-
<p><a class="source-toggle" href="#"
|
417
|
-
onclick="toggleCode('M000239-source');return false;">[Source]</a></p>
|
418
|
-
<div class="method-source-code" id="M000239-source">
|
419
|
-
<pre>
|
420
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/metric_stats.rb, line 112</span>
|
421
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats_hash</span>
|
422
|
-
<span class="ruby-ivar">@stats_hash</span> <span class="ruby-operator">||=</span> {}
|
423
|
-
<span class="ruby-keyword kw">end</span>
|
424
|
-
</pre>
|
425
|
-
</div>
|
426
|
-
</div>
|
427
|
-
</div>
|
428
|
-
|
429
|
-
|
430
|
-
</div>
|
431
|
-
|
432
|
-
|
433
|
-
</div>
|
434
|
-
|
435
|
-
|
436
|
-
<div id="validator-badges">
|
437
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
438
|
-
</div>
|
439
|
-
|
440
|
-
</body>
|
441
|
-
</html>
|
@@ -1,237 +0,0 @@
|
|
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>Module: NewRelic::Agent::StatsEngine::Samplers</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>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">NewRelic::Agent::StatsEngine::Samplers</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/new_relic/agent/stats_engine/samplers_rb.html">
|
59
|
-
lib/new_relic/agent/stats_engine/samplers.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000220">add_harvest_sampler</a>
|
84
|
-
<a href="#M000219">add_sampler</a>
|
85
|
-
<a href="#M000218">spawn_sampler_thread</a>
|
86
|
-
</div>
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
|
92
|
-
<!-- if includes -->
|
93
|
-
|
94
|
-
<div id="section">
|
95
|
-
|
96
|
-
|
97
|
-
<div id="constants-list">
|
98
|
-
<h3 class="section-bar">Constants</h3>
|
99
|
-
|
100
|
-
<div class="name-list">
|
101
|
-
<table summary="Constants">
|
102
|
-
<tr class="top-aligned-row context-row">
|
103
|
-
<td class="context-item-name">POLL_PERIOD</td>
|
104
|
-
<td>=</td>
|
105
|
-
<td class="context-item-value">20</td>
|
106
|
-
<td width="3em"> </td>
|
107
|
-
<td class="context-item-desc">
|
108
|
-
By default a sampler polls on harvest time, once a minute. However you can
|
109
|
-
override use_harvest_sampler? to return false and it will sample every
|
110
|
-
POLL_PERIOD seconds on a background thread.
|
111
|
-
|
112
|
-
</td>
|
113
|
-
</tr>
|
114
|
-
</table>
|
115
|
-
</div>
|
116
|
-
</div>
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
<!-- if method_list -->
|
124
|
-
<div id="methods">
|
125
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
126
|
-
|
127
|
-
<div id="method-M000220" class="method-detail">
|
128
|
-
<a name="M000220"></a>
|
129
|
-
|
130
|
-
<div class="method-heading">
|
131
|
-
<a href="#M000220" class="method-signature">
|
132
|
-
<span class="method-name">add_harvest_sampler</span><span class="method-args">(sampler)</span>
|
133
|
-
</a>
|
134
|
-
</div>
|
135
|
-
|
136
|
-
<div class="method-description">
|
137
|
-
<p>
|
138
|
-
Add a sampler to be invoked just before each harvest.
|
139
|
-
</p>
|
140
|
-
<p><a class="source-toggle" href="#"
|
141
|
-
onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
|
142
|
-
<div class="method-source-code" id="M000220-source">
|
143
|
-
<pre>
|
144
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/samplers.rb, line 48</span>
|
145
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_harvest_sampler</span> <span class="ruby-identifier">sampler</span>
|
146
|
-
<span class="ruby-identifier">harvest_samplers</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sampler</span>
|
147
|
-
<span class="ruby-identifier">sampler</span>.<span class="ruby-identifier">stats_engine</span> = <span class="ruby-keyword kw">self</span>
|
148
|
-
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"Adding harvest time sampler: #{sampler.id.to_s}"</span>
|
149
|
-
<span class="ruby-keyword kw">end</span>
|
150
|
-
</pre>
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
</div>
|
154
|
-
|
155
|
-
<div id="method-M000219" class="method-detail">
|
156
|
-
<a name="M000219"></a>
|
157
|
-
|
158
|
-
<div class="method-heading">
|
159
|
-
<a href="#M000219" class="method-signature">
|
160
|
-
<span class="method-name">add_sampler</span><span class="method-args">(sampler)</span>
|
161
|
-
</a>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div class="method-description">
|
165
|
-
<p>
|
166
|
-
Add an instance of <a href="../Sampler.html">Sampler</a> to be invoked
|
167
|
-
about every 10 seconds on a background thread.
|
168
|
-
</p>
|
169
|
-
<p><a class="source-toggle" href="#"
|
170
|
-
onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
|
171
|
-
<div class="method-source-code" id="M000219-source">
|
172
|
-
<pre>
|
173
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/samplers.rb, line 38</span>
|
174
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_sampler</span> <span class="ruby-identifier">sampler</span>
|
175
|
-
<span class="ruby-identifier">periodic_samplers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
176
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Sampler #{sampler.id} is already registered. Don't call add_sampler directly anymore."</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sampler</span>.<span class="ruby-identifier">id</span>
|
177
|
-
<span class="ruby-keyword kw">end</span>
|
178
|
-
<span class="ruby-identifier">periodic_samplers</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sampler</span>
|
179
|
-
<span class="ruby-identifier">sampler</span>.<span class="ruby-identifier">stats_engine</span> = <span class="ruby-keyword kw">self</span>
|
180
|
-
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">"Adding sampler #{sampler.id.to_s}"</span>
|
181
|
-
<span class="ruby-keyword kw">end</span>
|
182
|
-
</pre>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
<div id="method-M000218" class="method-detail">
|
188
|
-
<a name="M000218"></a>
|
189
|
-
|
190
|
-
<div class="method-heading">
|
191
|
-
<a href="#M000218" class="method-signature">
|
192
|
-
<span class="method-name">spawn_sampler_thread</span><span class="method-args">()</span>
|
193
|
-
</a>
|
194
|
-
</div>
|
195
|
-
|
196
|
-
<div class="method-description">
|
197
|
-
<p><a class="source-toggle" href="#"
|
198
|
-
onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
|
199
|
-
<div class="method-source-code" id="M000218-source">
|
200
|
-
<pre>
|
201
|
-
<span class="ruby-comment cmt"># File lib/new_relic/agent/stats_engine/samplers.rb, line 17</span>
|
202
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_sampler_thread</span>
|
203
|
-
|
204
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@sampler_process</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@sampler_process</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$$</span>
|
205
|
-
|
206
|
-
<span class="ruby-comment cmt"># start up a thread that will periodically poll for metric samples</span>
|
207
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">periodic_samplers</span>.<span class="ruby-identifier">empty?</span>
|
208
|
-
|
209
|
-
<span class="ruby-ivar">@sampler_thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
210
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">do</span>
|
211
|
-
<span class="ruby-keyword kw">begin</span>
|
212
|
-
<span class="ruby-identifier">sleep</span> <span class="ruby-constant">POLL_PERIOD</span>
|
213
|
-
<span class="ruby-identifier">poll</span> <span class="ruby-identifier">periodic_samplers</span>
|
214
|
-
<span class="ruby-keyword kw">end</span>
|
215
|
-
<span class="ruby-keyword kw">end</span>
|
216
|
-
<span class="ruby-keyword kw">end</span>
|
217
|
-
<span class="ruby-ivar">@sampler_thread</span>[<span class="ruby-value str">'newrelic_label'</span>] = <span class="ruby-value str">'Sampler Tasks'</span>
|
218
|
-
<span class="ruby-ivar">@sampler_process</span> = <span class="ruby-identifier">$$</span>
|
219
|
-
<span class="ruby-keyword kw">end</span>
|
220
|
-
</pre>
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
</div>
|
224
|
-
|
225
|
-
|
226
|
-
</div>
|
227
|
-
|
228
|
-
|
229
|
-
</div>
|
230
|
-
|
231
|
-
|
232
|
-
<div id="validator-badges">
|
233
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
234
|
-
</div>
|
235
|
-
|
236
|
-
</body>
|
237
|
-
</html>
|