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

svn commit: r1724157 - /sling/site/trunk/content/documentation/bundles/metrics.mdtext

Author: chetanm
Date: Tue Jan 12 05:16:03 2016
New Revision: 1724157

URL: http://svn.apache.org/viewvc?rev=1724157&view=rev
Log:
CMS commit to sling by chetanm

Modified:
    sling/site/trunk/content/documentation/bundles/metrics.mdtext

Modified: sling/site/trunk/content/documentation/bundles/metrics.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/metrics.mdtext?rev=1724157&r1=1724156&r2=1724157&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/metrics.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/metrics.mdtext Tue Jan 12 05:16:03 2016
@@ -32,7 +32,7 @@ application.
     }
     
     public void onSessionCreation(){
-        counter.inc();
+        counter.increment();
     }
     
 To make use of `MetricsService`
@@ -46,6 +46,14 @@ Refer to [Metric Getting Started][2] gui
 of Metric instances can be used. Note that when using Sling Commons Metrics
 bundle class names belong to `org.apache.sling.commons.metrics` package
 
+## Best Practices
+
+1. Use descriptive names - Qualify the name with class/package name where the
+   metric is being used
+2. 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.
+
 ## API
 
 Sling Metrics bundle provides its own Metric classes which are modelled on 
@@ -82,7 +90,7 @@ Metric API if required.
 
     :::java
     @Reference(target = "(name=sling)")
-    private volatile MetricRegistry dataSource;
+    private MetricRegistry registry;
   
 Also the wrapper Metric instance can be converted to actual instance via `adaptTo` calls.