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/04/25 11:01:58 UTC

svn commit: r1740775 - in /sling/site/trunk/content/documentation/bundles: log-tracers.mdtext tracer-config.png

Author: chetanm
Date: Mon Apr 25 09:01:58 2016
New Revision: 1740775

URL: http://svn.apache.org/viewvc?rev=1740775&view=rev
Log:
SLING-5459 - Recording of tracer logs

Modified:
    sling/site/trunk/content/documentation/bundles/log-tracers.mdtext
    sling/site/trunk/content/documentation/bundles/tracer-config.png

Modified: sling/site/trunk/content/documentation/bundles/log-tracers.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/log-tracers.mdtext?rev=1740775&r1=1740774&r2=1740775&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/log-tracers.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/log-tracers.mdtext Mon Apr 25 09:01:58 2016
@@ -159,6 +159,85 @@ This would result in following server si
     2015-05-11 17:34:56,548 DEBUG NA [qtp1395423247-193] o.a.j.o.s.a.u.LoginModuleImpl - Adding Credentials to shared state. 
     2015-05-11 17:34:56,548 DEBUG NA [qtp1395423247-193] o.a.j.o.s.a.u.LoginModuleImpl - Adding login name to shared state. 
 
+## Tracer Recording
+
+Apart from routing the logs to the server logs they can also be stored in memory and accessed in
+json form from Felix Web Console. By default support for recording is disabled and it needs to be
+explicitly enabled via OSGi config
+
+Recording features works as explained below
+
+1. Client sends an HTTP request with header `Sling-Tracer-Record`​ set to `true`
+
+        curl -D - -u admin:admin \
+          -H "Sling-Tracer-Record : true" \
+         -d "./jcr:content/jcr:title=Summer Collection" \
+         -d ":name=summer-collection" \
+         -d "./jcr:primaryType=sling:Folder" \
+         -d "./jcr:content/jcr:primaryType=nt:unstructured" \
+         -d "tracers=oak-writes" \
+         http://localhost:4802/content/dam/
+2. Server includes a request id as part of `Sling-Tracer-Request-Id` response headers  
+
+        HTTP/1.1 201 Created
+        Date: Wed, 27 Jan 2016 07:30:22 GMT
+        Sling-Tracer-Request-Id: 9b5b01f6-f269-47c3-a889-2dc8d4d7938f
+        X-Content-Type-Options: nosniff
+        X-Frame-Options: SAMEORIGIN
+        Location: /content/dam/summer-collection
+        Content-Type: text/html; charset=UTF-8
+        Transfer-Encoding: chunked
+3. The logs in json format can then be fetched from server at `/system/console/tracer` like 
+   http://localhost:8080/system/console/tracer/9b5b01f6-f269-47c3-a889-2dc8d4d7938f.json. Below
+   is a json output for GET request
+
+        curl -s -D - -H "Sling-Tracer-Record : true" -H "Sling-Tracers : oak-query" \
+        -H "Sling-Tracer-Config : org.apache.jackrabbit.oak.query" \
+        -u admin:admin http://localhost:4512/assets.html/content/dam -o /dev/null
+
+        ::javascript
+        {
+          "method": "GET",
+          "time": 15140,
+          "timestamp": 1461574009024,
+          "requestProgressLogs": [
+            "0 TIMER_START{Request Processing}",
+            "0 COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message>",
+            ...
+          ],
+          "queries": [{
+            "query": "/jcr:root/etc/workflow/instances//element(*,app:Workflow)[@status='RUNNING'] order by @startTime descending",
+            "plan": "[app:Workflow] as [a] /* property status = RUNNING where ([a].[status] = 'RUNNING') and (isdescendantnode([a], [/etc/workflow/instances])) */",
+            "caller": "com.example.WorkflowManager.getWorkflowInstances(WorkflowManager.java:902)"
+          }
+          ],
+          "logs": [{
+            "timestamp": 1461574022401,
+            "level": "DEBUG",
+            "logger": "org.apache.jackrabbit.oak.query.QueryEngineImpl",
+            "message": "Parsing xpath statement: /jcr:root/etc/workflow/instances//element(*,cq:Workflow)[@status='RUNNING'] order by @startTime descending",
+            "params": [
+              "xpath",
+              "/jcr:root/etc/workflow/instances//element(*,cq:Workflow)[@status='RUNNING'] order by @startTime descending"
+            ]
+          }
+            ...
+          ]
+        }
+        
+JSON output consist of following sections
+
+1. `method` - Request method
+2. `time` - Time in mills spent in request processing on server
+3. `timestamp` - Request start time
+4. `requestProgressLogs` - Sling Request Progress Tracker log for the given request
+5. `queries` - List of queries fired along with details around `query`, `plan` and `caller` i.e. from where
+    the query is invoked
+6. `logs` - List of log entries captured (as enabled by tracer config) for current request
+
+The recordings are held in memory for 15 mins (per default setting) and can be seen listed at http://localhost:8080/system/console/tracer. Look into the OSGi config for more config options
+around this.
+
 ## Installation
 
 Download the bundle from [here][5] or use following Maven dependency

Modified: sling/site/trunk/content/documentation/bundles/tracer-config.png
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/tracer-config.png?rev=1740775&r1=1740774&r2=1740775&view=diff
==============================================================================
Binary files - no diff available.