You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bu...@apache.org on 2016/01/12 06:16:24 UTC

svn commit: r977525 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/metrics.html

Author: buildbot
Date: Tue Jan 12 05:16:24 2016
New Revision: 977525

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/bundles/metrics.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Jan 12 05:16:24 2016
@@ -1 +1 @@
-1723811
+1724157

Modified: websites/staging/sling/trunk/content/documentation/bundles/metrics.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/metrics.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles/metrics.html Tue Jan 12 05:16:24 2016
@@ -143,7 +143,7 @@ application. </p>
 <span class="o">}</span>
 
 <span class="kd">public</span> <span class="kt">void</span> <span class="nf">onSessionCreation</span><span class="o">(){</span>
-    <span class="n">counter</span><span class="o">.</span><span class="na">inc</span><span class="o">();</span>
+    <span class="n">counter</span><span class="o">.</span><span class="na">increment</span><span class="o">();</span>
 <span class="o">}</span>
 </pre></div>
 
@@ -158,6 +158,14 @@ application. </p>
 <p>Refer to <a href="https://dropwizard.github.io/metrics/3.1.0/getting-started/#counters">Metric Getting Started</a> guide to see how various types
 of Metric instances can be used. Note that when using Sling Commons Metrics
 bundle class names belong to <code>org.apache.sling.commons.metrics</code> package</p>
+<h2 id="best-practices">Best Practices<a class="headerlink" href="#best-practices" title="Permanent link">&para;</a></h2>
+<ol>
+<li>Use descriptive names - Qualify the name with class/package name where the
+   metric is being used</li>
+<li>Do not use the metrics for operation which take less than 1E-7s i.e. 1000 nano 
+   seconds otherwise timer overhead (Metrics makes use of System.nanoTime)
+   would start affecting the performance.</li>
+</ol>
 <h2 id="api">API<a class="headerlink" href="#api" title="Permanent link">&para;</a></h2>
 <p>Sling Metrics bundle provides its own Metric classes which are modelled on 
 <a href="http://metrics.dropwizard.io/">Dropwizard Metrics</a> library. The metric interfaces defined by Sling bundle
@@ -188,7 +196,7 @@ The instance registered has a service pr
 from any other registered <code>MetricRegistry</code> instance). It can be used to get direct access to Dropwizard 
 Metric API if required.</p>
 <div class="codehilite"><pre><span class="nd">@Reference</span><span class="o">(</span><span class="n">target</span> <span class="o">=</span> <span class="s">&quot;(name=sling)&quot;</span><span class="o">)</span>
-<span class="kd">private</span> <span class="kd">volatile</span> <span class="n">MetricRegistry</span> <span class="n">dataSource</span><span class="o">;</span>
+<span class="kd">private</span> <span class="n">MetricRegistry</span> <span class="n">registry</span><span class="o">;</span>
 </pre></div>
 
 
@@ -218,7 +226,7 @@ use of same name in different registry i
 <span class="nt">&lt;/dependency&gt;</span>
 </pre></div>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1723811 by olli on Fri, 8 Jan 2016 22:30:37 +0000
+        Rev. 1724157 by chetanm on Tue, 12 Jan 2016 05:16:03 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project