Repository: curator
Updated Branches:
  refs/heads/CURATOR-3.0 693211e41 -> d034aeaed


[CURATOR-349] Expose extra metrics in TracerDriver


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d034aeae
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d034aeae
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d034aeae

Branch: refs/heads/CURATOR-3.0
Commit: d034aeaedf43a22f25db76fbe257caef53d40897
Parents: 693211e
Author: allenlyu <allen...@fb.com>
Authored: Tue Sep 20 14:56:47 2016 -0700
Committer: lvfangmin <lvfang...@gmail.com>
Committed: Wed Oct 19 17:33:21 2016 -0700

----------------------------------------------------------------------
 .../org/apache/curator/ConnectionState.java     |  36 ++++-
 .../apache/curator/CuratorZookeeperClient.java  |  13 +-
 .../main/java/org/apache/curator/RetryLoop.java |   5 +-
 .../curator/drivers/AdvancedTracerDriver.java   |  50 ++++++
 .../org/apache/curator/drivers/EventTrace.java  |  53 ++++++
 .../apache/curator/drivers/OperationTrace.java  | 162 +++++++++++++++++++
 .../framework/imps/BackgroundSyncImpl.java      |   9 +-
 .../framework/imps/CreateBuilderImpl.java       |  67 ++++----
 .../framework/imps/CuratorFrameworkImpl.java    |   4 +-
 .../framework/imps/DeleteBuilderImpl.java       |  10 +-
 .../framework/imps/ExistsBuilderImpl.java       |  14 +-
 .../FindAndDeleteProtectedNodeInBackground.java |   6 +-
 .../framework/imps/GetACLBuilderImpl.java       |  10 +-
 .../framework/imps/GetChildrenBuilderImpl.java  |  10 +-
 .../framework/imps/GetDataBuilderImpl.java      |  10 +-
 .../framework/imps/SetACLBuilderImpl.java       |  10 +-
 .../framework/imps/SetDataBuilderImpl.java      |  13 +-
 .../curator/framework/imps/SyncBuilderImpl.java |   6 +-
 .../framework/imps/TempGetDataBuilderImpl.java  |   6 +-
 src/site/confluence/logging.confluence          |   2 +-
 20 files changed, 400 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-client/src/main/java/org/apache/curator/ConnectionState.java
----------------------------------------------------------------------
diff --git 
a/curator-client/src/main/java/org/apache/curator/ConnectionState.java 
b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
index d79ec58..4191778 100644
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@ -19,6 +19,8 @@
 package org.apache.curator;
 
 import org.apache.curator.connection.ConnectionHandlingPolicy;
+import org.apache.curator.drivers.EventTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.drivers.TracerDriver;
 import org.apache.curator.ensemble.EnsembleProvider;
 import org.apache.curator.utils.CloseableUtils;
@@ -84,7 +86,7 @@ class ConnectionState implements Watcher, Closeable
         Exception exception = backgroundExceptions.poll();
         if ( exception != null )
         {
-            tracer.get().addCount("background-exceptions", 1);
+            new EventTrace("background-exceptions", tracer.get()).commit();
             throw exception;
         }
 
@@ -176,9 +178,9 @@ class ConnectionState implements Watcher, Closeable
 
         for ( Watcher parentWatcher : parentWatchers )
         {
-            TimeTrace timeTrace = new 
TimeTrace("connection-state-parent-process", tracer.get());
+            OperationTrace trace = new 
OperationTrace("connection-state-parent-process", tracer.get());
             parentWatcher.process(event);
-            timeTrace.commit();
+            trace.commit();
         }
     }
 
@@ -248,7 +250,7 @@ class ConnectionState implements Watcher, Closeable
                     long elapsed = System.currentTimeMillis() - 
connectionStartMs;
                     log.error(String.format("Connection timed out for 
connection string (%s) and timeout (%d) / elapsed (%d)", 
zooKeeper.getConnectionString(), connectionTimeoutMs, elapsed), 
connectionLossException);
                 }
-                tracer.get().addCount("connections-timed-out", 1);
+                new EventTrace("connections-timed-out", tracer.get(), 
getSessionId()).commit();
                 throw connectionLossException;
             }
 
@@ -260,6 +262,24 @@ class ConnectionState implements Watcher, Closeable
         }
     }
 
+    /**
+     * Return the current session id
+     */
+    public long getSessionId() {
+        long sessionId = -1;
+        if (isConnected()) {
+            try {
+                ZooKeeper zk = zooKeeper.getZooKeeper();
+                if (zk != null) {
+                    sessionId = zk.getSessionId();
+                }
+            } catch (Exception e) {
+                // Ignore the exception
+            }
+        }
+        return sessionId;
+    }
+
     private boolean checkState(Event.KeeperState state, boolean wasConnected)
     {
         boolean isConnected = wasConnected;
@@ -301,6 +321,10 @@ class ConnectionState implements Watcher, Closeable
             break;
         }
         }
+        // the session expired is logged in handleExpiredSession, so not log 
here
+        if (state != Event.KeeperState.Expired) {
+            new EventTrace(state.toString(), tracer.get(), 
getSessionId()).commit();
+        }
 
         if ( checkNewConnectionString )
         {
@@ -317,7 +341,7 @@ class ConnectionState implements Watcher, Closeable
     private void handleNewConnectionString(String newConnectionString)
     {
         log.info("Connection string changed to: " + newConnectionString);
-        tracer.get().addCount("connection-string-changed", 1);
+        new EventTrace("connection-string-changed", tracer.get(), 
getSessionId()).commit();
 
         try
         {
@@ -348,7 +372,7 @@ class ConnectionState implements Watcher, Closeable
     private void handleExpiredSession()
     {
         log.warn("Session expired event received");
-        tracer.get().addCount("session-expired", 1);
+        new EventTrace("session-expired", tracer.get(), 
getSessionId()).commit();
 
         try
         {

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
----------------------------------------------------------------------
diff --git 
a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java 
b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
index ad5c55c..7549c29 100644
--- 
a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
+++ 
b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
@@ -22,6 +22,7 @@ package org.apache.curator;
 import com.google.common.base.Preconditions;
 import org.apache.curator.connection.ClassicConnectionHandlingPolicy;
 import org.apache.curator.connection.ConnectionHandlingPolicy;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.drivers.TracerDriver;
 import org.apache.curator.ensemble.EnsembleProvider;
 import org.apache.curator.ensemble.fixed.FixedEnsembleProvider;
@@ -184,7 +185,7 @@ public class CuratorZookeeperClient implements Closeable
         Preconditions.checkState(started.get(), "Client is not started");
 
         log.debug("blockUntilConnectedOrTimedOut() start");
-        TimeTrace trace = startTracer("blockUntilConnectedOrTimedOut");
+        OperationTrace       trace = 
startAdvancedTracer("blockUntilConnectedOrTimedOut");
 
         internalBlockUntilConnectedOrTimedOut();
 
@@ -265,6 +266,16 @@ public class CuratorZookeeperClient implements Closeable
     }
 
     /**
+     * Start a new advanced tracer with more metrics being recorded
+     * @param name name of the event
+     * @return the new tracer ({@link OperationTrace#commit()} must be called)
+     */
+    public OperationTrace          startAdvancedTracer(String name)
+    {
+        return new OperationTrace(name, tracer.get(), state.getSessionId());
+    }
+
+    /**
      * Return the current tracing driver
      *
      * @return tracing driver

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-client/src/main/java/org/apache/curator/RetryLoop.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/RetryLoop.java 
b/curator-client/src/main/java/org/apache/curator/RetryLoop.java
index e58ce20..2ea6f97 100644
--- a/curator-client/src/main/java/org/apache/curator/RetryLoop.java
+++ b/curator-client/src/main/java/org/apache/curator/RetryLoop.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator;
 
+import org.apache.curator.drivers.EventTrace;
 import org.apache.curator.drivers.TracerDriver;
 import org.apache.curator.utils.DebugUtils;
 import org.apache.zookeeper.KeeperException;
@@ -172,7 +173,7 @@ public class RetryLoop
 
             if ( retryPolicy.allowRetry(retryCount++, 
System.currentTimeMillis() - startTimeMs, sleeper) )
             {
-                tracer.get().addCount("retries-allowed", 1);
+                new EventTrace("retries-allowed", tracer.get()).commit();
                 if ( 
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                 {
                     log.debug("Retrying operation");
@@ -181,7 +182,7 @@ public class RetryLoop
             }
             else
             {
-                tracer.get().addCount("retries-disallowed", 1);
+                new EventTrace("retries-disallowed", tracer.get()).commit();
                 if ( 
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                 {
                     log.debug("Retry policy not allowing retry");

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-client/src/main/java/org/apache/curator/drivers/AdvancedTracerDriver.java
----------------------------------------------------------------------
diff --git 
a/curator-client/src/main/java/org/apache/curator/drivers/AdvancedTracerDriver.java
 
b/curator-client/src/main/java/org/apache/curator/drivers/AdvancedTracerDriver.java
new file mode 100644
index 0000000..40faa99
--- /dev/null
+++ 
b/curator-client/src/main/java/org/apache/curator/drivers/AdvancedTracerDriver.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.curator.drivers;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ *  Expose more metrics for the operations and events
+ */
+public abstract class AdvancedTracerDriver implements TracerDriver
+{
+    /**
+     * Record the given trace event
+     *
+     * @param trace the metrics of the operation
+     */
+    public abstract void     addTrace(OperationTrace trace);
+
+    /**
+     * Add to a named counter
+     *
+     * @param name name of the counter
+     * @param increment amount to increment
+     */
+    public abstract void     addEvent(EventTrace trace);
+
+    @Deprecated
+    @Override
+    public final void     addTrace(String name, long time, TimeUnit unit) {}
+
+    @Deprecated
+    @Override
+    public final void     addCount(String name, int increment) {}
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-client/src/main/java/org/apache/curator/drivers/EventTrace.java
----------------------------------------------------------------------
diff --git 
a/curator-client/src/main/java/org/apache/curator/drivers/EventTrace.java 
b/curator-client/src/main/java/org/apache/curator/drivers/EventTrace.java
new file mode 100644
index 0000000..1c6e031
--- /dev/null
+++ b/curator-client/src/main/java/org/apache/curator/drivers/EventTrace.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.curator.drivers;
+
+public class EventTrace
+{
+  private final String name;
+  private final TracerDriver driver;
+  private final long sessionId;
+
+  public EventTrace(String name, TracerDriver driver) {
+    this(name, driver, -1);
+  }
+
+  public EventTrace(String name, TracerDriver driver, long sessionId) {
+    this.name = name;
+    this.driver = driver;
+    this.sessionId = sessionId;
+  }
+
+  public String getName() {
+    return this.name;
+  }
+
+  public long getSessionId() {
+    return this.sessionId;
+  }
+
+  public void commit() {
+    if (this.driver instanceof AdvancedTracerDriver) {
+      ((AdvancedTracerDriver) this.driver).addEvent(this);
+    } else {
+      this.driver.addCount(this.name, 1);
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-client/src/main/java/org/apache/curator/drivers/OperationTrace.java
----------------------------------------------------------------------
diff --git 
a/curator-client/src/main/java/org/apache/curator/drivers/OperationTrace.java 
b/curator-client/src/main/java/org/apache/curator/drivers/OperationTrace.java
new file mode 100644
index 0000000..b8de3a3
--- /dev/null
+++ 
b/curator-client/src/main/java/org/apache/curator/drivers/OperationTrace.java
@@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.curator.drivers;
+
+import org.apache.curator.drivers.TracerDriver;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.data.Stat;
+
+import java.io.UnsupportedEncodingException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Used to trace the metrics of a certain Zookeeper operation.
+ */
+public class OperationTrace
+{
+    private final String name;
+    private final TracerDriver driver;
+
+    private int returnCode = KeeperException.Code.OK.intValue();
+    private long latencyMs;
+    private long requestBytesLength;
+    private long responseBytesLength;
+    private String path;
+    private boolean withWatcher;
+    private long sessionId;
+    private Stat stat;
+
+    private final long startTimeNanos = System.nanoTime();
+
+    public OperationTrace(String name, TracerDriver driver) {
+      this(name, driver, -1);
+    }
+
+    public OperationTrace(String name, TracerDriver driver, long sessionId) {
+      this.name = name;
+      this.driver = driver;
+      this.sessionId = sessionId;
+    }
+
+    public OperationTrace setReturnCode(int returnCode) {
+      this.returnCode = returnCode;
+      return this;
+    }
+
+    public OperationTrace setRequestBytesLength(long length) {
+      this.requestBytesLength = length;
+      return this;
+    }
+
+    public OperationTrace setRequestBytesLength(String data) {
+      if (data == null) {
+        return this;
+      }
+
+      try {
+        this.setRequestBytesLength(data.getBytes("UTF-8").length);
+      } catch (UnsupportedEncodingException e) {
+        // Ignore the exception.
+      }
+
+      return this;
+    }
+
+    public OperationTrace setRequestBytesLength(byte[] data) {
+      if (data == null) {
+        return this;
+      }
+
+      return this.setRequestBytesLength(data.length);
+    }
+
+    public OperationTrace setResponseBytesLength(long length) {
+      this.responseBytesLength = length;
+      return this;
+    }
+
+    public OperationTrace setResponseBytesLength(byte[] data) {
+      if (data == null) {
+        return this;
+      }
+
+      return this.setResponseBytesLength(data.length);
+    }
+
+    public OperationTrace setPath(String path) {
+      this.path = path;
+      return this;
+    }
+
+    public OperationTrace setWithWatcher(boolean withWatcher) {
+      this.withWatcher = withWatcher;
+      return this;
+    }
+
+    public OperationTrace setStat(Stat stat) {
+      this.stat = stat;
+      return this;
+    }
+
+    public String getName() {
+      return this.name;
+    }
+
+    public int getReturnCode() {
+      return this.returnCode;
+    }
+
+    public long getLatencyMs() {
+      return this.latencyMs;
+    }
+
+    public long getRequestBytesLength() {
+      return this.requestBytesLength;
+    }
+
+    public long getResponseBytesLength() {
+      return this.responseBytesLength;
+    }
+
+    public long getSessionId() {
+      return this.sessionId;
+    }
+
+    public String getPath() {
+      return this.path;
+    }
+
+    public boolean isWithWatcher() {
+      return this.withWatcher;
+    }
+
+    public Stat getStat() {
+      return this.stat;
+    }
+
+    public void commit() {
+      long elapsed = System.nanoTime() - startTimeNanos;
+      this.latencyMs = TimeUnit.MILLISECONDS.convert(elapsed, 
TimeUnit.NANOSECONDS);
+      if (this.driver instanceof AdvancedTracerDriver) {
+        ((AdvancedTracerDriver) this.driver).addTrace(this);
+      } else {
+        this.driver.addTrace(this.name, elapsed, TimeUnit.NANOSECONDS);
+      }
+    }
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/BackgroundSyncImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/BackgroundSyncImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/BackgroundSyncImpl.java
index f0994e3..ef0b870 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/BackgroundSyncImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/BackgroundSyncImpl.java
@@ -18,7 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.CuratorEventType;
 import org.apache.zookeeper.AsyncCallback;
 
@@ -36,16 +36,17 @@ class BackgroundSyncImpl implements 
BackgroundOperation<String>
     @Override
     public void performBackgroundOperation(final OperationAndData<String> 
operationAndData) throws Exception
     {
-        final TimeTrace trace = 
client.getZookeeperClient().startTracer("BackgroundSyncImpl");
+        final OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("BackgroundSyncImpl");
+        final String data = operationAndData.getData();
         client.getZooKeeper().sync
         (
-            operationAndData.getData(),
+            data,
             new AsyncCallback.VoidCallback()
             {
                 @Override
                 public void processResult(int rc, String path, Object ctx)
                 {
-                    trace.commit();
+                    
trace.setReturnCode(rc).setRequestBytesLength(data).commit();
                     CuratorEventImpl event = new CuratorEventImpl(client, 
CuratorEventType.SYNC, rc, path, null, ctx, null, null, null, null, null, null);
                     client.processBackgroundOperation(operationAndData, event);
                 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
index d7126dc..4bed564 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.*;
 import org.apache.curator.framework.api.transaction.OperationType;
 import org.apache.curator.framework.api.transaction.TransactionCreateBuilder;
@@ -140,7 +140,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
                 storingStat = stat;
                 return asCreateBackgroundModeACLable();
             }
-            
+
             @Override
             public ACLCreateModePathAndBytesable<String> 
creatingParentsIfNeeded()
             {
@@ -535,14 +535,15 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
     {
         try
         {
-            final TimeTrace trace = 
client.getZookeeperClient().startTracer("CreateBuilderImpl-Background");
+            final OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("CreateBuilderImpl-Background");
+            final byte[] data = operationAndData.getData().getData();
 
             if(storingStat == null)
             {
                 client.getZooKeeper().create
                 (
                     operationAndData.getData().getPath(),
-                    operationAndData.getData().getData(),
+                    data,
                     acling.getAclList(operationAndData.getData().getPath()),
                     createMode,
                     new AsyncCallback.StringCallback()
@@ -550,7 +551,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
                         @Override
                         public void processResult(int rc, String path, Object 
ctx, String name)
                         {
-                            trace.commit();
+                            
trace.setReturnCode(rc).setRequestBytesLength(data).setPath(path).commit();
 
                             if ( (rc == 
KeeperException.Code.NONODE.intValue()) && createParentsIfNeeded )
                             {
@@ -617,11 +618,11 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             backgrounding.checkError(e, null);
         }
     }
-    
+
     @Override
     public CreateProtectACLCreateModePathAndBytesable<String> 
storingStatIn(Stat stat) {
         storingStat = stat;
-        
+
         return new CreateProtectACLCreateModePathAndBytesable<String>() {
 
             @Override
@@ -688,7 +689,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             @Override
             public ProtectACLCreateModePathAndBytesable<String> 
creatingParentContainersIfNeeded() {
                 return 
CreateBuilderImpl.this.creatingParentContainersIfNeeded();
-            }  
+            }
         };
     }
 
@@ -818,72 +819,72 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             }
         };
     }
-    
+
     private CreateBackgroundModeACLable asCreateBackgroundModeACLable()
     {
         return new CreateBackgroundModeACLable() {
-            
+
             @Override
             public BackgroundPathAndBytesable<String> withACL(List<ACL> 
aclList) {
                 return CreateBuilderImpl.this.withACL(aclList);
             }
-            
+
             @Override
             public ACLBackgroundPathAndBytesable<String> withMode(CreateMode 
mode) {
                 return CreateBuilderImpl.this.withMode(mode);
             }
-            
+
             @Override
             public String forPath(String path) throws Exception {
                 return CreateBuilderImpl.this.forPath(path);
             }
-            
+
             @Override
             public String forPath(String path, byte[] data) throws Exception {
                 return CreateBuilderImpl.this.forPath(path, data);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback, Object context, Executor executor) {
                 return CreateBuilderImpl.this.inBackground(callback, context, 
executor);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback, Executor executor) {
                 return CreateBuilderImpl.this.inBackground(callback, executor);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback, Object context) {
                 return CreateBuilderImpl.this.inBackground(callback, context);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback) {
                 return CreateBuilderImpl.this.inBackground(callback);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> inBackground(Object 
context) {
                 return CreateBuilderImpl.this.inBackground(context);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> inBackground() {
                 return CreateBuilderImpl.this.inBackground();
             }
-            
+
             @Override
             public ACLPathAndBytesable<String> 
withProtectedEphemeralSequential() {
                 return 
CreateBuilderImpl.this.withProtectedEphemeralSequential();
             }
-            
+
             @Override
             public ACLCreateModePathAndBytesable<String> 
creatingParentsIfNeeded() {
                 createParentsIfNeeded = true;
                 return asACLCreateModePathAndBytesable();
             }
-            
+
             @Override
             public ACLCreateModePathAndBytesable<String> 
creatingParentContainersIfNeeded() {
                 setCreateParentsAsContainers();
@@ -891,7 +892,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             }
         };
     }
-    
+
     private ACLCreateModeStatBackgroundPathAndBytesable<String> 
asACLCreateModeStatBackgroundPathAndBytesable()
     {
         return new ACLCreateModeStatBackgroundPathAndBytesable<String>()
@@ -910,22 +911,22 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback, Object context, Executor executor) {
                 return CreateBuilderImpl.this.inBackground(callback, context, 
executor);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback, Executor executor) {
                 return CreateBuilderImpl.this.inBackground(callback, executor);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback, Object context) {
                 return CreateBuilderImpl.this.inBackground(callback, context);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> 
inBackground(BackgroundCallback callback) {
                 return CreateBuilderImpl.this.inBackground(callback);
             }
-            
+
             @Override
             public ErrorListenerPathAndBytesable<String> inBackground(Object 
context) {
                 return CreateBuilderImpl.this.inBackground(context);
@@ -935,7 +936,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             public String forPath(String path) throws Exception {
                 return CreateBuilderImpl.this.forPath(path);
             }
-            
+
             @Override
             public String forPath(String path, byte[] data) throws Exception {
                 return CreateBuilderImpl.this.forPath(path, data);
@@ -950,7 +951,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
             public ACLCreateModeBackgroundPathAndBytesable<String> 
storingStatIn(Stat stat) {
                 storingStat = stat;
                 return CreateBuilderImpl.this;
-            }            
+            }
         };
     }
 
@@ -1028,7 +1029,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
 
     private String pathInForeground(final String path, final byte[] data, 
final List<ACL> aclList) throws Exception
     {
-        TimeTrace trace = 
client.getZookeeperClient().startTracer("CreateBuilderImpl-Foreground");
+        OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("CreateBuilderImpl-Foreground");
 
         final AtomicBoolean firstTime = new AtomicBoolean(true);
         String returnPath = RetryLoop.callWithRetry
@@ -1090,13 +1091,13 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
                 }
             );
 
-        trace.commit();
+        trace.setRequestBytesLength(data).setPath(path).commit();
         return returnPath;
     }
 
     private String findProtectedNodeInForeground(final String path) throws 
Exception
     {
-        TimeTrace trace = 
client.getZookeeperClient().startTracer("CreateBuilderImpl-findProtectedNodeInForeground");
+        OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("CreateBuilderImpl-findProtectedNodeInForeground");
 
         String returnPath = RetryLoop.callWithRetry
             (
@@ -1123,7 +1124,7 @@ class CreateBuilderImpl implements CreateBuilder, 
BackgroundOperation<PathAndByt
                 }
             );
 
-        trace.commit();
+        trace.setPath(path).commit();
         return returnPath;
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index aba14c6..7b620d3 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableList;
 import org.apache.curator.CuratorConnectionLossException;
 import org.apache.curator.CuratorZookeeperClient;
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.AuthInfo;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
@@ -970,7 +970,7 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
             {
                 try
                 {
-                    TimeTrace trace = client.startTracer("EventListener");
+                    OperationTrace trace = 
client.startAdvancedTracer("EventListener");
                     listener.eventReceived(CuratorFrameworkImpl.this, 
curatorEvent);
                     trace.commit();
                 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
index 78eafd8..abe27c4 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/DeleteBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.*;
 import org.apache.curator.framework.api.transaction.OperationType;
 import org.apache.curator.framework.api.transaction.TransactionDeleteBuilder;
@@ -153,7 +153,7 @@ class DeleteBuilderImpl implements DeleteBuilder, 
BackgroundOperation<String>, E
     {
         try
         {
-            final TimeTrace trace = 
client.getZookeeperClient().startTracer("DeleteBuilderImpl-Background");
+            final OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("DeleteBuilderImpl-Background");
             client.getZooKeeper().delete
                 (
                     operationAndData.getData(),
@@ -163,7 +163,7 @@ class DeleteBuilderImpl implements DeleteBuilder, 
BackgroundOperation<String>, E
                         @Override
                         public void processResult(int rc, String path, Object 
ctx)
                         {
-                            trace.commit();
+                            trace.setReturnCode(rc).setPath(path).commit();
                             if ( (rc == 
KeeperException.Code.NOTEMPTY.intValue()) && deletingChildrenIfNeeded )
                             {
                                 
backgroundDeleteChildrenThenNode(operationAndData);
@@ -248,7 +248,7 @@ class DeleteBuilderImpl implements DeleteBuilder, 
BackgroundOperation<String>, E
 
     private void pathInForeground(final String path, String unfixedPath) 
throws Exception
     {
-        TimeTrace trace = 
client.getZookeeperClient().startTracer("DeleteBuilderImpl-Foreground");
+        OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("DeleteBuilderImpl-Foreground");
         try
         {
             RetryLoop.callWithRetry
@@ -296,6 +296,6 @@ class DeleteBuilderImpl implements DeleteBuilder, 
BackgroundOperation<String>, E
             }
             throw e;
         }
-        trace.commit();
+        trace.setPath(path).commit();
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/ExistsBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/ExistsBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/ExistsBuilderImpl.java
index 97e8147..058ac5d 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/ExistsBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/ExistsBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.*;
 import org.apache.curator.utils.ZKPaths;
 import org.apache.zookeeper.AsyncCallback;
@@ -126,14 +126,14 @@ class ExistsBuilderImpl implements ExistsBuilder, 
BackgroundOperation<String>, E
     {
         try
         {
-            final TimeTrace   trace = 
client.getZookeeperClient().startTracer("ExistsBuilderImpl-Background");
+            final OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("ExistsBuilderImpl-Background");
             AsyncCallback.StatCallback callback = new 
AsyncCallback.StatCallback()
             {
                 @Override
                 public void processResult(int rc, String path, Object ctx, 
Stat stat)
                 {
                     watching.commitWatcher(rc, true);
-                    trace.commit();
+                    
trace.setReturnCode(rc).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(stat).commit();
                     CuratorEvent event = new CuratorEventImpl(client, 
CuratorEventType.EXISTS, rc, path, null, ctx, stat, null, null, null, null, 
null);
                     client.processBackgroundOperation(operationAndData, event);
                 }
@@ -188,7 +188,7 @@ class ExistsBuilderImpl implements ExistsBuilder, 
BackgroundOperation<String>, E
             final String parent = ZKPaths.getPathAndNode(path).getPath();
             if ( !parent.equals(ZKPaths.PATH_SEPARATOR) )
             {
-                TimeTrace   trace = 
client.getZookeeperClient().startTracer("ExistsBuilderImpl-Foreground-CreateParents");
+                OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("ExistsBuilderImpl-Foreground-CreateParents");
                 RetryLoop.callWithRetry
                 (
                     client.getZookeeperClient(),
@@ -213,7 +213,7 @@ class ExistsBuilderImpl implements ExistsBuilder, 
BackgroundOperation<String>, E
                         }
                     }
                 );
-                trace.commit();
+                trace.setPath(path).commit();
             }
         }
         return pathInForegroundStandard(path);
@@ -221,7 +221,7 @@ class ExistsBuilderImpl implements ExistsBuilder, 
BackgroundOperation<String>, E
 
     private Stat pathInForegroundStandard(final String path) throws Exception
     {
-        TimeTrace   trace = 
client.getZookeeperClient().startTracer("ExistsBuilderImpl-Foreground");
+        OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("ExistsBuilderImpl-Foreground");
         Stat        returnStat = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -245,7 +245,7 @@ class ExistsBuilderImpl implements ExistsBuilder, 
BackgroundOperation<String>, E
                 }
             }
         );
-        trace.commit();
+        
trace.setPath(path).setWithWatcher(watching.hasWatcher()).setStat(returnStat).commit();
         return returnStat;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/FindAndDeleteProtectedNodeInBackground.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/FindAndDeleteProtectedNodeInBackground.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/FindAndDeleteProtectedNodeInBackground.java
index 208b7b7..de91552 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/FindAndDeleteProtectedNodeInBackground.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/FindAndDeleteProtectedNodeInBackground.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import com.google.common.annotations.VisibleForTesting;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.CuratorEventType;
 import org.apache.curator.utils.ThreadUtils;
 import org.apache.curator.utils.ZKPaths;
@@ -66,13 +66,13 @@ class FindAndDeleteProtectedNodeInBackground implements 
BackgroundOperation<Void
     @Override
     public void performBackgroundOperation(final OperationAndData<Void> 
operationAndData) throws Exception
     {
-        final TimeTrace trace = 
client.getZookeeperClient().startTracer("FindAndDeleteProtectedNodeInBackground");
+        final OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("FindAndDeleteProtectedNodeInBackground");
         AsyncCallback.Children2Callback callback = new 
AsyncCallback.Children2Callback()
         {
             @Override
             public void processResult(int rc, String path, Object o, 
List<String> strings, Stat stat)
             {
-                trace.commit();
+                trace.setReturnCode(rc).setPath(path).setStat(stat).commit();
 
                 if ( debugInsertError.compareAndSet(true, false) )
                 {

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/GetACLBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetACLBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetACLBuilderImpl.java
index 7b313cf..e60b0da 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetACLBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetACLBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEventType;
 import org.apache.curator.framework.api.ErrorListenerPathable;
@@ -108,13 +108,13 @@ class GetACLBuilderImpl implements GetACLBuilder, 
BackgroundOperation<String>, E
     {
         try
         {
-            final TimeTrace             trace = 
client.getZookeeperClient().startTracer("GetACLBuilderImpl-Background");
+            final OperationTrace             trace = 
client.getZookeeperClient().startAdvancedTracer("GetACLBuilderImpl-Background");
             AsyncCallback.ACLCallback   callback = new 
AsyncCallback.ACLCallback()
             {
                 @Override
                 public void processResult(int rc, String path, Object ctx, 
List<ACL> acl, Stat stat)
                 {
-                    trace.commit();
+                    
trace.setReturnCode(rc).setPath(path).setStat(stat).commit();
                     CuratorEventImpl event = new CuratorEventImpl(client, 
CuratorEventType.GET_ACL, rc, path, null, ctx, stat, null, null, null, acl, 
null);
                     client.processBackgroundOperation(operationAndData, event);
                 }
@@ -146,7 +146,7 @@ class GetACLBuilderImpl implements GetACLBuilder, 
BackgroundOperation<String>, E
 
     private List<ACL> pathInForeground(final String path) throws Exception
     {
-        TimeTrace    trace = 
client.getZookeeperClient().startTracer("GetACLBuilderImpl-Foreground");
+        OperationTrace    trace = 
client.getZookeeperClient().startAdvancedTracer("GetACLBuilderImpl-Foreground");
         List<ACL>    result = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -159,7 +159,7 @@ class GetACLBuilderImpl implements GetACLBuilder, 
BackgroundOperation<String>, E
                 }
             }
         );
-        trace.commit();
+        trace.setPath(path).setStat(responseStat).commit();
         return result;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/GetChildrenBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetChildrenBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetChildrenBuilderImpl.java
index d26f270..be6910c 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetChildrenBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetChildrenBuilderImpl.java
@@ -20,7 +20,7 @@ package org.apache.curator.framework.imps;
 
 import com.google.common.collect.Lists;
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.BackgroundPathable;
 import org.apache.curator.framework.api.CuratorEventType;
@@ -163,14 +163,14 @@ class GetChildrenBuilderImpl implements 
GetChildrenBuilder, BackgroundOperation<
     {
         try
         {
-            final TimeTrace       trace = 
client.getZookeeperClient().startTracer("GetChildrenBuilderImpl-Background");
+            final OperationTrace       trace = 
client.getZookeeperClient().startAdvancedTracer("GetChildrenBuilderImpl-Background");
             AsyncCallback.Children2Callback callback = new 
AsyncCallback.Children2Callback()
             {
                 @Override
                 public void processResult(int rc, String path, Object o, 
List<String> strings, Stat stat)
                 {
                     watching.commitWatcher(rc, false);
-                    trace.commit();
+                    
trace.setReturnCode(rc).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(stat).commit();
                     if ( strings == null )
                     {
                         strings = Lists.newArrayList();
@@ -215,7 +215,7 @@ class GetChildrenBuilderImpl implements GetChildrenBuilder, 
BackgroundOperation<
 
     private List<String> pathInForeground(final String path) throws Exception
     {
-        TimeTrace       trace = 
client.getZookeeperClient().startTracer("GetChildrenBuilderImpl-Foreground");
+        OperationTrace       trace = 
client.getZookeeperClient().startAdvancedTracer("GetChildrenBuilderImpl-Foreground");
         List<String>    children = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -238,7 +238,7 @@ class GetChildrenBuilderImpl implements GetChildrenBuilder, 
BackgroundOperation<
                 }
             }
         );
-        trace.commit();
+        
trace.setPath(path).setWithWatcher(watching.hasWatcher()).setStat(responseStat).commit();
         return children;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
index 8d92f8d..328119d 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.*;
 import org.apache.curator.utils.ThreadUtils;
 import org.apache.zookeeper.AsyncCallback;
@@ -233,14 +233,14 @@ class GetDataBuilderImpl implements GetDataBuilder, 
BackgroundOperation<String>,
     {
         try
         {
-            final TimeTrace   trace = 
client.getZookeeperClient().startTracer("GetDataBuilderImpl-Background");
+            final OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("GetDataBuilderImpl-Background");
             AsyncCallback.DataCallback callback = new 
AsyncCallback.DataCallback()
             {
                 @Override
                 public void processResult(int rc, String path, Object ctx, 
byte[] data, Stat stat)
                 {
                     watching.commitWatcher(rc, false);
-                    trace.commit();
+                    
trace.setReturnCode(rc).setResponseBytesLength(data).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(stat).commit();
                     if ( decompress && (data != null) )
                     {
                         try
@@ -294,7 +294,7 @@ class GetDataBuilderImpl implements GetDataBuilder, 
BackgroundOperation<String>,
 
     private byte[] pathInForeground(final String path) throws Exception
     {
-        TimeTrace   trace = 
client.getZookeeperClient().startTracer("GetDataBuilderImpl-Foreground");
+        OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("GetDataBuilderImpl-Foreground");
         byte[]      responseData = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -317,7 +317,7 @@ class GetDataBuilderImpl implements GetDataBuilder, 
BackgroundOperation<String>,
                 }
             }
         );
-        trace.commit();
+        
trace.setResponseBytesLength(responseData).setPath(path).setWithWatcher(watching.hasWatcher()).setStat(responseStat).commit();
 
         return decompress ? client.getCompressionProvider().decompress(path, 
responseData) : responseData;
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/SetACLBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/SetACLBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/SetACLBuilderImpl.java
index 44adfe2..738e82f 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/SetACLBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/SetACLBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.*;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEventType;
@@ -135,7 +135,7 @@ class SetACLBuilderImpl implements SetACLBuilder, 
BackgroundPathable<Stat>, Back
     {
         try
         {
-            final TimeTrace     trace = 
client.getZookeeperClient().startTracer("SetACLBuilderImpl-Background");
+            final OperationTrace     trace = 
client.getZookeeperClient().startAdvancedTracer("SetACLBuilderImpl-Background");
             String              path = operationAndData.getData();
             client.getZooKeeper().setACL
             (
@@ -148,7 +148,7 @@ class SetACLBuilderImpl implements SetACLBuilder, 
BackgroundPathable<Stat>, Back
                     @Override
                     public void processResult(int rc, String path, Object ctx, 
Stat stat)
                     {
-                        trace.commit();
+                        
trace.setReturnCode(rc).setPath(path).setStat(stat).commit();
                         CuratorEvent event = new CuratorEventImpl(client, 
CuratorEventType.SET_ACL, rc, path, null, ctx, stat, null, null, null, null, 
null);
                         client.processBackgroundOperation(operationAndData, 
event);
                     }
@@ -164,7 +164,7 @@ class SetACLBuilderImpl implements SetACLBuilder, 
BackgroundPathable<Stat>, Back
 
     private Stat pathInForeground(final String path, final List<ACL> aclList) 
throws Exception
     {
-        TimeTrace   trace = 
client.getZookeeperClient().startTracer("SetACLBuilderImpl-Foreground");
+        OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("SetACLBuilderImpl-Foreground");
         Stat        resultStat = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -177,7 +177,7 @@ class SetACLBuilderImpl implements SetACLBuilder, 
BackgroundPathable<Stat>, Back
                 }
             }
         );
-        trace.commit();
+        trace.setPath(path).setStat(resultStat).commit();
         return resultStat;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java
index e84a3bd..3231be5 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.*;
 import org.apache.curator.framework.api.transaction.OperationType;
 import org.apache.curator.framework.api.transaction.TransactionSetDataBuilder;
@@ -207,11 +207,12 @@ class SetDataBuilderImpl implements SetDataBuilder, 
BackgroundOperation<PathAndB
     {
         try
         {
-            final TimeTrace   trace = 
client.getZookeeperClient().startTracer("SetDataBuilderImpl-Background");
+            final OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("SetDataBuilderImpl-Background");
+            final byte[] data = operationAndData.getData().getData();
             client.getZooKeeper().setData
             (
                 operationAndData.getData().getPath(),
-                operationAndData.getData().getData(),
+                data,
                 version,
                 new AsyncCallback.StatCallback()
                 {
@@ -219,7 +220,7 @@ class SetDataBuilderImpl implements SetDataBuilder, 
BackgroundOperation<PathAndB
                     @Override
                     public void processResult(int rc, String path, Object ctx, 
Stat stat)
                     {
-                        trace.commit();
+                        
trace.setReturnCode(rc).setRequestBytesLength(data).setPath(path).setStat(stat).commit();
                         CuratorEvent event = new CuratorEventImpl(client, 
CuratorEventType.SET_DATA, rc, path, null, ctx, stat, null, null, null, null, 
null);
                         client.processBackgroundOperation(operationAndData, 
event);
                     }
@@ -270,7 +271,7 @@ class SetDataBuilderImpl implements SetDataBuilder, 
BackgroundOperation<PathAndB
 
     private Stat pathInForeground(final String path, final byte[] data) throws 
Exception
     {
-        TimeTrace   trace = 
client.getZookeeperClient().startTracer("SetDataBuilderImpl-Foreground");
+        OperationTrace   trace = 
client.getZookeeperClient().startAdvancedTracer("SetDataBuilderImpl-Foreground");
         Stat        resultStat = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -283,7 +284,7 @@ class SetDataBuilderImpl implements SetDataBuilder, 
BackgroundOperation<PathAndB
                 }
             }
         );
-        trace.commit();
+        
trace.setRequestBytesLength(data).setPath(path).setStat(resultStat).commit();
         return resultStat;
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/SyncBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/SyncBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/SyncBuilderImpl.java
index 1483ae6..542b834 100755
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/SyncBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/SyncBuilderImpl.java
@@ -18,7 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorEventType;
@@ -94,7 +94,7 @@ public class SyncBuilderImpl implements SyncBuilder, 
BackgroundOperation<String>
     {
         try
         {
-            final TimeTrace trace = 
client.getZookeeperClient().startTracer("SyncBuilderImpl-Background");
+            final OperationTrace trace = 
client.getZookeeperClient().startAdvancedTracer("SyncBuilderImpl-Background");
             final String path = operationAndData.getData();
             String adjustedPath = client.fixForNamespace(path);
 
@@ -103,7 +103,7 @@ public class SyncBuilderImpl implements SyncBuilder, 
BackgroundOperation<String>
                 @Override
                 public void processResult(int rc, String path, Object ctx)
                 {
-                    trace.commit();
+                    trace.setReturnCode(rc).setPath(path).commit();
                     CuratorEvent event = new CuratorEventImpl(client, 
CuratorEventType.SYNC, rc, path, path, ctx, null, null, null, null, null, null);
                     client.processBackgroundOperation(operationAndData, event);
                 }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/curator-framework/src/main/java/org/apache/curator/framework/imps/TempGetDataBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/TempGetDataBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/TempGetDataBuilderImpl.java
index 061794b..8ee527e 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/TempGetDataBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/TempGetDataBuilderImpl.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import org.apache.curator.RetryLoop;
-import org.apache.curator.TimeTrace;
+import org.apache.curator.drivers.OperationTrace;
 import org.apache.curator.framework.api.Pathable;
 import org.apache.curator.framework.api.StatPathable;
 import org.apache.curator.framework.api.TempGetDataBuilder;
@@ -58,7 +58,7 @@ class TempGetDataBuilderImpl implements TempGetDataBuilder
     {
         final String    localPath = client.fixForNamespace(path);
 
-        TimeTrace       trace = 
client.getZookeeperClient().startTracer("GetDataBuilderImpl-Foreground");
+        OperationTrace       trace = 
client.getZookeeperClient().startAdvancedTracer("GetDataBuilderImpl-Foreground");
         byte[]          responseData = RetryLoop.callWithRetry
         (
             client.getZookeeperClient(),
@@ -71,7 +71,7 @@ class TempGetDataBuilderImpl implements TempGetDataBuilder
                 }
             }
         );
-        trace.commit();
+        
trace.setResponseBytesLength(responseData).setPath(path).setStat(responseStat).commit();
 
         return decompress ? client.getCompressionProvider().decompress(path, 
responseData) : responseData;
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/d034aeae/src/site/confluence/logging.confluence
----------------------------------------------------------------------
diff --git a/src/site/confluence/logging.confluence 
b/src/site/confluence/logging.confluence
index 002c655..9f87c52 100644
--- a/src/site/confluence/logging.confluence
+++ b/src/site/confluence/logging.confluence
@@ -9,6 +9,6 @@ Curator uses SLF4J ([[http://www.slf4j.org/]]) for logging. 
SLF4J is a facade ov
 plug in any (or no) logging framework. See the SLF4J website for details.
 
 h2. Tracing
-Connect Curator tracing to your tracing framework via an instance of 
{{TracerDriver}}.
+Connect Curator tracing to your tracing framework via an instance of 
{{TracerDriver}} or {{AdvancedTracerDriver}}.
 Curator calls the various methods (e.g. addTrace() or addCount() ) and your 
instance proxies the calls to your tracing
 framework. Inform Curator of your tracing driver instance by calling 
{{CuratorZookeeperClient.setTracerDriver()}}.

Reply via email to