incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/3] git commit: Adding tracing logic to thrift and shard server. Controller still need to be modified to propogate traceid.
Date Wed, 20 Nov 2013 14:29:19 GMT
Updated Branches:
  refs/heads/apache-blur-0.2 6d180b869 -> 32733114c


Adding tracing logic to thrift and shard server.  Controller still need to be modified to propogate traceid.


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

Branch: refs/heads/apache-blur-0.2
Commit: e3f18c33265d4ca8577a5f8b288f2964910e1576
Parents: 6d180b8
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Wed Nov 20 09:14:48 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Wed Nov 20 09:14:48 2013 -0500

----------------------------------------------------------------------
 .../apache/blur/server/BlurServerContext.java   |  18 +-
 .../apache/blur/server/FilteredBlurServer.java  |   4 +
 .../blur/thrift/BlurControllerServer.java       |   6 +
 .../org/apache/blur/thrift/BlurShardServer.java |   6 +
 .../blur/thrift/ThriftBlurShardServer.java      |   6 +-
 .../java/org/apache/blur/utils/BlurUtil.java    |  38 ++
 .../java/org/apache/blur/thrift/BlurClient.java |   5 +
 .../org/apache/blur/thrift/generated/Blur.java  | 438 +++++++++++++++++++
 .../org/apache/blur/thrift/util/StatsTable.java |  11 +-
 .../org/apache/blur/trace/LogTraceReporter.java |  32 ++
 .../main/java/org/apache/blur/trace/Trace.java  | 117 +++++
 .../org/apache/blur/trace/TraceCollector.java   |  79 ++++
 .../org/apache/blur/trace/TraceReporter.java    |  23 +
 .../main/java/org/apache/blur/trace/Tracer.java |  23 +
 .../java/org/apache/blur/trace/TracerImpl.java  |  68 +++
 .../java/org/apache/blur/trace/UsingTrace.java  |  63 +++
 .../java/org/apache/blur/trace/TraceTest.java   | 123 ++++++
 .../src/main/scripts/interface/Blur.thrift      |   8 +
 .../main/scripts/interface/gen-html/Blur.html   |   7 +
 .../main/scripts/interface/gen-html/index.html  |   1 +
 .../org/apache/blur/thrift/generated/Blur.java  | 438 +++++++++++++++++++
 .../src/main/scripts/interface/gen-js/Blur.js   |  93 ++++
 .../scripts/interface/gen-perl/Blur/Blur.pm     | 150 +++++++
 .../src/main/scripts/interface/gen-rb/blur.rb   |  45 ++
 docs/Blur.html                                  |   7 +
 25 files changed, 1799 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-core/src/main/java/org/apache/blur/server/BlurServerContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/BlurServerContext.java b/blur-core/src/main/java/org/apache/blur/server/BlurServerContext.java
index 84ac238..61c4f01 100644
--- a/blur-core/src/main/java/org/apache/blur/server/BlurServerContext.java
+++ b/blur-core/src/main/java/org/apache/blur/server/BlurServerContext.java
@@ -24,20 +24,22 @@ import org.apache.blur.thirdparty.thrift_0_9_0.server.ServerContext;
 import org.apache.blur.thrift.generated.User;
 
 public class BlurServerContext implements ServerContext {
-  
+
   private static final Log LOG = LogFactory.getLog(BlurServerContext.class);
-  
+
   private User _user;
   private final SocketAddress _localSocketAddress;
   private final SocketAddress _remoteSocketAddress;
   private final String _connectionString;
 
+  private String _traceId;
+
   public BlurServerContext(SocketAddress localSocketAddress, SocketAddress remoteSocketAddress) {
     _localSocketAddress = localSocketAddress;
     _remoteSocketAddress = remoteSocketAddress;
     _connectionString = _localSocketAddress.toString() + "\t" + _remoteSocketAddress.toString();
   }
-  
+
   public void setUser(User user) {
     LOG.info("User [{0}] for context [{1}]", user, this);
     _user = user;
@@ -46,7 +48,15 @@ public class BlurServerContext implements ServerContext {
   public User getUser() {
     return _user;
   }
-  
+
+  public String getTraceId() {
+    return _traceId;
+  }
+
+  public void setTraceId(String traceId) {
+    _traceId = traceId;
+  }
+
   public SocketAddress getRocalSocketAddress() {
     return _localSocketAddress;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java b/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
index 98f8605..a610c9e 100644
--- a/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
+++ b/blur-core/src/main/java/org/apache/blur/server/FilteredBlurServer.java
@@ -42,6 +42,10 @@ import org.apache.blur.thrift.generated.User;
 public class FilteredBlurServer implements Iface {
   
   protected final Iface _iface;
+  public void startTrace(String traceId) throws TException {
+    _iface.startTrace(traceId);
+  }
+
   protected final boolean _shard;
   protected final BlurConfiguration _configuration;
   

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
index e2a0072..ee74504 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
@@ -1179,4 +1179,10 @@ public class BlurControllerServer extends TableAdmin implements Iface {
     context.setUser(user);
   }
 
+  @Override
+  public void startTrace(String traceId) throws TException {
+    ControllerServerContext context = ControllerServerContext.getControllerServerContext();
+    context.setTraceId(traceId);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index 4dfe043..05a7389 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -489,4 +489,10 @@ public class BlurShardServer extends TableAdmin implements Iface {
     context.setUser(user);
   }
 
+  @Override
+  public void startTrace(String traceId) throws TException {
+    ShardServerContext context = ShardServerContext.getShardServerContext();
+    context.setTraceId(traceId);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index 4281e01..506a8b3 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -86,6 +86,8 @@ import org.apache.blur.thirdparty.thrift_0_9_0.server.TServlet;
 import org.apache.blur.thirdparty.thrift_0_9_0.transport.TNonblockingServerSocket;
 import org.apache.blur.thrift.generated.Blur;
 import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.trace.LogTraceReporter;
+import org.apache.blur.trace.Trace;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.utils.GCWatcher;
 import org.apache.blur.utils.MemoryReporter;
@@ -229,10 +231,12 @@ public class ThriftBlurShardServer extends ThriftServer {
     shardServer.setMaxRecordsPerRowFetchRequest(configuration.getInt(BLUR_MAX_RECORDS_PER_ROW_FETCH_REQUEST, 1000));
     shardServer.setConfiguration(configuration);
     shardServer.init();
+    
+    Trace.setReporter(new LogTraceReporter());
 
     Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, shardServer, true);
-
     iface = BlurUtil.recordMethodCallsAndAverageTimes(iface, Iface.class, false);
+    iface = BlurUtil.runTrace(iface, false);
     if (httpServer != null) {
       WebAppContext context = httpServer.getContext();
       context.addServlet(new ServletHolder(new TServlet(new Blur.Processor<Blur.Iface>(iface),

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index d95371b..9a6c004 100644
--- a/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -65,6 +65,7 @@ import org.apache.blur.manager.results.BlurResultComparator;
 import org.apache.blur.manager.results.BlurResultIterable;
 import org.apache.blur.manager.results.BlurResultPeekableIteratorComparator;
 import org.apache.blur.manager.results.PeekableIterator;
+import org.apache.blur.server.BlurServerContext;
 import org.apache.blur.server.ControllerServerContext;
 import org.apache.blur.server.FilteredBlurServer;
 import org.apache.blur.server.ShardServerContext;
@@ -87,6 +88,7 @@ import org.apache.blur.thrift.generated.RowMutation;
 import org.apache.blur.thrift.generated.RowMutationType;
 import org.apache.blur.thrift.generated.Selector;
 import org.apache.blur.thrift.util.ResetableTMemoryBuffer;
+import org.apache.blur.trace.Trace;
 import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -917,4 +919,40 @@ public class BlurUtil {
     }
     return iface;
   }
+
+  public static Iface runTrace(final Iface iface, final boolean controller) {
+    InvocationHandler handler = new InvocationHandler() {
+      @Override
+      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        if (method.getName().equals("startTrace")) {
+          try {
+            return method.invoke(iface, args);
+          } catch (InvocationTargetException e) {
+            throw e.getTargetException();
+          }
+        }
+        BlurServerContext context = getServerContext(controller);
+        String traceId = context.getTraceId();
+        if (traceId != null) {
+          Trace.setupTrace(traceId);
+        }
+        try {
+          return method.invoke(iface, args);
+        } catch (InvocationTargetException e) {
+          throw e.getTargetException();
+        } finally {
+          Trace.tearDownTrace();
+          context.setTraceId(null);
+        }
+      }
+
+      private BlurServerContext getServerContext(boolean controller) {
+        if (controller) {
+          return ControllerServerContext.getControllerServerContext();
+        }
+        return ShardServerContext.getShardServerContext();
+      }
+    };
+    return (Iface) Proxy.newProxyInstance(Iface.class.getClassLoader(), new Class[] { Iface.class }, handler);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-thrift/src/main/java/org/apache/blur/thrift/BlurClient.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/BlurClient.java b/blur-thrift/src/main/java/org/apache/blur/thrift/BlurClient.java
index 086a1ad..9bf98dd 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/BlurClient.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/BlurClient.java
@@ -31,6 +31,7 @@ import org.apache.blur.thrift.generated.Blur.Client;
 import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.thrift.generated.User;
+import org.apache.blur.trace.Trace;
 
 public class BlurClient {
 
@@ -79,6 +80,10 @@ public class BlurClient {
               if (_setUser) {
                 client.setUser(user);
               }
+              String traceId = Trace.getTraceId();
+              if (traceId != null) {
+                client.startTrace(traceId);
+              }
               return method.invoke(client, args);
             }
           } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
index 8e63a43..8182634 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Blur.java
@@ -366,6 +366,13 @@ public class Blur {
      */
     public Map<String,Metric> metrics(Set<String> metrics) throws BlurException, org.apache.blur.thirdparty.thrift_0_9_0.TException;
 
+    /**
+     * Starts a trace with the given trace id.
+     * 
+     * @param traceId the trace id.
+     */
+    public void startTrace(String traceId) throws org.apache.blur.thirdparty.thrift_0_9_0.TException;
+
   }
 
   public interface AsyncIface {
@@ -438,6 +445,8 @@ public class Blur {
 
     public void metrics(Set<String> metrics, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<AsyncClient.metrics_call> resultHandler) throws org.apache.blur.thirdparty.thrift_0_9_0.TException;
 
+    public void startTrace(String traceId, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<AsyncClient.startTrace_call> resultHandler) throws org.apache.blur.thirdparty.thrift_0_9_0.TException;
+
   }
 
   public static class Client extends org.apache.blur.thirdparty.thrift_0_9_0.TServiceClient implements Iface {
@@ -1314,6 +1323,18 @@ public class Blur {
       throw new org.apache.blur.thirdparty.thrift_0_9_0.TApplicationException(org.apache.blur.thirdparty.thrift_0_9_0.TApplicationException.MISSING_RESULT, "metrics failed: unknown result");
     }
 
+    public void startTrace(String traceId) throws org.apache.blur.thirdparty.thrift_0_9_0.TException
+    {
+      send_startTrace(traceId);
+    }
+
+    public void send_startTrace(String traceId) throws org.apache.blur.thirdparty.thrift_0_9_0.TException
+    {
+      startTrace_args args = new startTrace_args();
+      args.setTraceId(traceId);
+      sendBase("startTrace", args);
+    }
+
   }
   public static class AsyncClient extends org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncClient implements AsyncIface {
     public static class Factory implements org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncClientFactory<AsyncClient> {
@@ -2461,6 +2482,37 @@ public class Blur {
       }
     }
 
+    public void startTrace(String traceId, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<startTrace_call> resultHandler) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      checkReady();
+      startTrace_call method_call = new startTrace_call(traceId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class startTrace_call extends org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncMethodCall {
+      private String traceId;
+      public startTrace_call(String traceId, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<startTrace_call> resultHandler, org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncClient client, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolFactory protocolFactory, org.apache.blur.thirdparty.thrift_0_9_0.transport.TNonblockingTransport transport) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        super(client, protocolFactory, transport, resultHandler, true);
+        this.traceId = traceId;
+      }
+
+      public void write_args(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        prot.writeMessageBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMessage("startTrace", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMessageType.CALL, 0));
+        startTrace_args args = new startTrace_args();
+        args.setTraceId(traceId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public void getResult() throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        if (getState() != org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.blur.thirdparty.thrift_0_9_0.transport.TMemoryInputTransport memoryTransport = new org.apache.blur.thirdparty.thrift_0_9_0.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+      }
+    }
+
   }
 
   public static class Processor<I extends Iface> extends org.apache.blur.thirdparty.thrift_0_9_0.TBaseProcessor<I> implements org.apache.blur.thirdparty.thrift_0_9_0.TProcessor {
@@ -2508,6 +2560,7 @@ public class Blur {
       processMap.put("isInSafeMode", new isInSafeMode());
       processMap.put("configuration", new configuration());
       processMap.put("metrics", new metrics());
+      processMap.put("startTrace", new startTrace());
       return processMap;
     }
 
@@ -3325,6 +3378,25 @@ public class Blur {
       }
     }
 
+    public static class startTrace<I extends Iface> extends org.apache.blur.thirdparty.thrift_0_9_0.ProcessFunction<I, startTrace_args> {
+      public startTrace() {
+        super("startTrace");
+      }
+
+      public startTrace_args getEmptyArgsInstance() {
+        return new startTrace_args();
+      }
+
+      protected boolean isOneway() {
+        return true;
+      }
+
+      public org.apache.blur.thirdparty.thrift_0_9_0.TBase getResult(I iface, startTrace_args args) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        iface.startTrace(args.traceId);
+        return null;
+      }
+    }
+
   }
 
   public static class createTable_args implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<createTable_args, createTable_args._Fields>, java.io.Serializable, Cloneable   {
@@ -32336,4 +32408,370 @@ public class Blur {
 
   }
 
+  public static class startTrace_args implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<startTrace_args, startTrace_args._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct STRUCT_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct("startTrace_args");
+
+    private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField TRACE_ID_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("traceId", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new startTrace_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new startTrace_argsTupleSchemeFactory());
+    }
+
+    /**
+     * the trace id.
+     */
+    public String traceId; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum {
+      /**
+       * the trace id.
+       */
+      TRACE_ID((short)1, "traceId");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // TRACE_ID
+            return TRACE_ID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.TRACE_ID, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("traceId", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, 
+          new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(startTrace_args.class, metaDataMap);
+    }
+
+    public startTrace_args() {
+    }
+
+    public startTrace_args(
+      String traceId)
+    {
+      this();
+      this.traceId = traceId;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public startTrace_args(startTrace_args other) {
+      if (other.isSetTraceId()) {
+        this.traceId = other.traceId;
+      }
+    }
+
+    public startTrace_args deepCopy() {
+      return new startTrace_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.traceId = null;
+    }
+
+    /**
+     * the trace id.
+     */
+    public String getTraceId() {
+      return this.traceId;
+    }
+
+    /**
+     * the trace id.
+     */
+    public startTrace_args setTraceId(String traceId) {
+      this.traceId = traceId;
+      return this;
+    }
+
+    public void unsetTraceId() {
+      this.traceId = null;
+    }
+
+    /** Returns true if field traceId is set (has been assigned a value) and false otherwise */
+    public boolean isSetTraceId() {
+      return this.traceId != null;
+    }
+
+    public void setTraceIdIsSet(boolean value) {
+      if (!value) {
+        this.traceId = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case TRACE_ID:
+        if (value == null) {
+          unsetTraceId();
+        } else {
+          setTraceId((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case TRACE_ID:
+        return getTraceId();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case TRACE_ID:
+        return isSetTraceId();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof startTrace_args)
+        return this.equals((startTrace_args)that);
+      return false;
+    }
+
+    public boolean equals(startTrace_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_traceId = true && this.isSetTraceId();
+      boolean that_present_traceId = true && that.isSetTraceId();
+      if (this_present_traceId || that_present_traceId) {
+        if (!(this_present_traceId && that_present_traceId))
+          return false;
+        if (!this.traceId.equals(that.traceId))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    public int compareTo(startTrace_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      startTrace_args typedOther = (startTrace_args)other;
+
+      lastComparison = Boolean.valueOf(isSetTraceId()).compareTo(typedOther.isSetTraceId());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetTraceId()) {
+        lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.traceId, typedOther.traceId);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("startTrace_args(");
+      boolean first = true;
+
+      sb.append("traceId:");
+      if (this.traceId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.traceId);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(out)));
+      } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(in)));
+      } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class startTrace_argsStandardSchemeFactory implements SchemeFactory {
+      public startTrace_argsStandardScheme getScheme() {
+        return new startTrace_argsStandardScheme();
+      }
+    }
+
+    private static class startTrace_argsStandardScheme extends StandardScheme<startTrace_args> {
+
+      public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // TRACE_ID
+              if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) {
+                struct.traceId = iprot.readString();
+                struct.setTraceIdIsSet(true);
+              } else { 
+                org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.traceId != null) {
+          oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
+          oprot.writeString(struct.traceId);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class startTrace_argsTupleSchemeFactory implements SchemeFactory {
+      public startTrace_argsTupleScheme getScheme() {
+        return new startTrace_argsTupleScheme();
+      }
+    }
+
+    private static class startTrace_argsTupleScheme extends TupleScheme<startTrace_args> {
+
+      @Override
+      public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetTraceId()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetTraceId()) {
+          oprot.writeString(struct.traceId);
+        }
+      }
+
+      @Override
+      public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.traceId = iprot.readString();
+          struct.setTraceIdIsSet(true);
+        }
+      }
+    }
+
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-thrift/src/main/java/org/apache/blur/thrift/util/StatsTable.java
----------------------------------------------------------------------
diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/StatsTable.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/StatsTable.java
index 9b52eb1..a37a558 100644
--- a/blur-thrift/src/main/java/org/apache/blur/thrift/util/StatsTable.java
+++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/StatsTable.java
@@ -20,10 +20,9 @@ import java.io.IOException;
 
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
 import org.apache.blur.thrift.BlurClient;
-import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.thrift.generated.Blur.Iface;
-import org.apache.blur.thrift.generated.TableStats;
-
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.trace.Trace;
 
 public class StatsTable {
 
@@ -31,8 +30,10 @@ public class StatsTable {
     String connectionStr = args[0];
     final String tableName = args[1];
 
+    Trace.setupTrace("1234");
     Iface client = BlurClient.getClient(connectionStr);
-    TableStats tableStats = client.tableStats(tableName);
-    System.out.println(tableStats);
+    System.out.println(client.tableStats(tableName));
+    System.out.println(client.tableStats(tableName));
+    Trace.tearDownTrace();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/LogTraceReporter.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/LogTraceReporter.java b/blur-util/src/main/java/org/apache/blur/trace/LogTraceReporter.java
new file mode 100644
index 0000000..83e9b25
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/LogTraceReporter.java
@@ -0,0 +1,32 @@
+/**
+ * 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.blur.trace;
+
+import org.apache.blur.log.Log;
+import org.apache.blur.log.LogFactory;
+
+public class LogTraceReporter implements TraceReporter {
+
+  private static final Log LOG = LogFactory.getLog(LogTraceReporter.class);
+
+  @Override
+  public void report(TraceCollector collector) {
+    String json = collector.toJson();
+    LOG.info("Trace Complete [{0}]", json);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/Trace.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/Trace.java b/blur-util/src/main/java/org/apache/blur/trace/Trace.java
new file mode 100644
index 0000000..7446950
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/Trace.java
@@ -0,0 +1,117 @@
+/**
+ * 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.blur.trace;
+
+import java.util.concurrent.Callable;
+
+public class Trace {
+
+  private static final Tracer DO_NOTHING = new Tracer() {
+    @Override
+    public void done() {
+
+    }
+  };
+  private static ThreadLocal<TraceCollector> _tracer = new ThreadLocal<TraceCollector>();
+  private static TraceReporter _reporter;
+
+  public static void setupTrace(String id) {
+    TraceCollector collector = new TraceCollector(id);
+    _tracer.set(collector);
+  }
+
+  public static void tearDownTrace() {
+    TraceCollector collector = _tracer.get();
+    _tracer.set(null);
+    if (_reporter != null && collector != null) {
+      _reporter.report(collector);
+    }
+  }
+
+  public static Tracer trace(String name) {
+    TraceCollector collector = _tracer.get();
+    if (collector == null) {
+      return DO_NOTHING;
+    }
+    TracerImpl tracer = new TracerImpl(name, collector.getNextId(), collector.getParentThreadId());
+    collector.add(tracer);
+    return tracer;
+  }
+
+  public static TraceReporter getReporter() {
+    return _reporter;
+  }
+
+  public static void setReporter(TraceReporter reporter) {
+    _reporter = reporter;
+  }
+
+  public static Runnable getRunnable(final Runnable runnable) {
+    TraceCollector tc = _tracer.get();
+    if (tc == null) {
+      return runnable;
+    }
+    final TraceCollector traceCollector = new TraceCollector(tc);
+    return new Runnable() {
+      @Override
+      public void run() {
+        _tracer.set(traceCollector);
+        try {
+          runnable.run();
+        } finally {
+          _tracer.set(null);
+        }
+      }
+    };
+  }
+
+  public static <V> Callable<V> getRunnable(final Callable<V> callable) {
+    TraceCollector tc = _tracer.get();
+    if (tc == null) {
+      return callable;
+    }
+    final TraceCollector traceCollector = new TraceCollector(tc);
+    return new Callable<V>() {
+      @Override
+      public V call() throws Exception {
+        _tracer.set(traceCollector);
+        try {
+          return callable.call();
+        } finally {
+          _tracer.set(null);
+        }
+      }
+    };
+  }
+
+  public static String getTraceId() {
+    TraceCollector collector = _tracer.get();
+    if (collector == null) {
+      return null;
+    }
+    return collector._id;
+  }
+
+  public static boolean isTraceRunning() {
+    TraceCollector collector = _tracer.get();
+    if (collector == null) {
+      return false;
+    }
+    return true;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/TraceCollector.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/TraceCollector.java b/blur-util/src/main/java/org/apache/blur/trace/TraceCollector.java
new file mode 100644
index 0000000..d06ac1a
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/TraceCollector.java
@@ -0,0 +1,79 @@
+/**
+ * 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.blur.trace;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicLong;
+
+public class TraceCollector {
+
+  protected final String _id;
+  protected final List<TracerImpl> _traces;
+  protected final AtomicLong _traceCounter;
+  protected final long _parentThreadId;
+
+  public TraceCollector(String id) {
+    _id = id;
+    _traces = new CopyOnWriteArrayList<TracerImpl>();
+    _traceCounter = new AtomicLong();
+    _parentThreadId = Long.MAX_VALUE;
+  }
+
+  public TraceCollector(TraceCollector traceCollector) {
+    _id = traceCollector._id;
+    _traces = traceCollector._traces;
+    _traceCounter = traceCollector._traceCounter;
+    _parentThreadId = Thread.currentThread().getId();
+  }
+
+  public void add(TracerImpl tracer) {
+    _traces.add(tracer);
+  }
+
+  @Override
+  public String toString() {
+    return "TraceCollector [_id=" + _id + ", _traces=" + _traces + "]";
+  }
+
+  public String toJson() {
+    StringBuilder builder = new StringBuilder();
+    for (TracerImpl t : _traces) {
+      builder.append("    ").append(t.toJson()).append(",\n");
+
+    }
+
+    return "{\n  \"id\"=\"" + _id + "\",\n  \"traces\"=[\n" + builder.toString() + "  ]\n}";
+  }
+
+  public String getId() {
+    return _id;
+  }
+
+  public List<TracerImpl> getTraces() {
+    return _traces;
+  }
+
+  public long getNextId() {
+    return _traceCounter.incrementAndGet();
+  }
+
+  public long getParentThreadId() {
+    return _parentThreadId;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/TraceReporter.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/TraceReporter.java b/blur-util/src/main/java/org/apache/blur/trace/TraceReporter.java
new file mode 100644
index 0000000..fa73ac1
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/TraceReporter.java
@@ -0,0 +1,23 @@
+/**
+ * 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.blur.trace;
+
+public interface TraceReporter {
+
+  void report(TraceCollector collector);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/Tracer.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/Tracer.java b/blur-util/src/main/java/org/apache/blur/trace/Tracer.java
new file mode 100644
index 0000000..1251336
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/Tracer.java
@@ -0,0 +1,23 @@
+/**
+ * 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.blur.trace;
+
+public interface Tracer {
+  
+  void done();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java b/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
new file mode 100644
index 0000000..3056a73
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/TracerImpl.java
@@ -0,0 +1,68 @@
+/**
+ * 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.blur.trace;
+
+public class TracerImpl implements Tracer {
+
+  protected final String _name;
+  protected final long _start;
+  protected long _ended;
+  protected final String _threadName;
+  protected final long _id;
+  protected final long _parentThreadId;
+
+  public TracerImpl(String name, long id, long parentThreadId) {
+    _name = name;
+    _start = System.nanoTime();
+    _threadName = Thread.currentThread().getName();
+    _id = id;
+    _parentThreadId = parentThreadId;
+  }
+
+  @Override
+  public void done() {
+    _ended = System.nanoTime();
+  }
+
+  @Override
+  public String toString() {
+    return "Tracer [name=" + _name + ", id=" + _id + ", thread=" + _threadName + ", started=" + _start + ", took="
+        + (_ended - _start) + " ns]";
+  }
+
+  public String getName() {
+    return _name;
+  }
+
+  public long getStart() {
+    return _start;
+  }
+
+  public long getEnded() {
+    return _ended;
+  }
+
+  public String getThreadName() {
+    return _threadName;
+  }
+
+  public String toJson() {
+    return "{\"id\"=" + _id + ", \"parentThread\"=" + _parentThreadId + ", \"name\"=\"" + _name + "\", \"thread\"=\""
+        + _threadName + "\", \"took\"=" + (_ended - _start) + ", \"started\"=" + _start + ", \"ended\"=" + _ended + "}";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/main/java/org/apache/blur/trace/UsingTrace.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/trace/UsingTrace.java b/blur-util/src/main/java/org/apache/blur/trace/UsingTrace.java
new file mode 100644
index 0000000..c2f89a3
--- /dev/null
+++ b/blur-util/src/main/java/org/apache/blur/trace/UsingTrace.java
@@ -0,0 +1,63 @@
+/**
+ * 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.blur.trace;
+
+public class UsingTrace {
+
+  public static void main(String[] args) {
+
+    // Trace.setupTrace("cool");
+
+    Tracer trace = Trace.trace("1");
+    long meth1;
+    try {
+      meth1 = meth1();
+    } finally {
+      trace.done();
+    }
+    System.out.println(meth1);
+
+//    Trace.tearDownTrace();
+  }
+
+  private static long meth1() {
+    Tracer trace = Trace.trace("2");
+    try {
+      return meth2();
+    } finally {
+      trace.done();
+    }
+  }
+
+  private static long meth2() {
+    Tracer trace = Trace.trace("3");
+    try {
+      return meth3();
+    } finally {
+      trace.done();
+    }
+  }
+
+  private static long meth3() {
+    long t = 0;
+    for (long i = 0; i < 10000; i++) {
+      t *= i;
+    }
+    return t;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/blur-util/src/test/java/org/apache/blur/trace/TraceTest.java
----------------------------------------------------------------------
diff --git a/blur-util/src/test/java/org/apache/blur/trace/TraceTest.java b/blur-util/src/test/java/org/apache/blur/trace/TraceTest.java
new file mode 100644
index 0000000..f1fbdfa
--- /dev/null
+++ b/blur-util/src/test/java/org/apache/blur/trace/TraceTest.java
@@ -0,0 +1,123 @@
+/**
+ * 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.blur.trace;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class TraceTest {
+
+  @Test
+  public void testTrace() {
+    Trace.setReporter(new TraceReporter() {
+      @Override
+      public void report(TraceCollector collector) {
+        assertEquals("test", collector.getId());
+        assertEquals(3, collector.getTraces().size());
+      }
+    });
+    Trace.setupTrace("test");
+    Tracer trace = Trace.trace("1");
+    long meth1;
+    try {
+      meth1 = meth1();
+    } finally {
+      trace.done();
+    }
+    System.out.println(meth1);
+    Trace.tearDownTrace();
+  }
+
+  @Test
+  public void testNoTrace() {
+    Tracer trace = Trace.trace("1");
+    long meth1;
+    try {
+      meth1 = meth1();
+    } finally {
+      trace.done();
+    }
+    System.out.println(meth1);
+  }
+
+  @Test
+  public void testTraceThreadRunnable() throws InterruptedException {
+    Trace.setReporter(new TraceReporter() {
+      @Override
+      public void report(TraceCollector collector) {
+        System.out.println(collector.toJson());
+        assertEquals("test", collector.getId());
+        assertEquals(6, collector.getTraces().size());
+      }
+    });
+
+    Trace.setupTrace("test");
+    
+    final Runnable runnable = new Runnable() {
+      @Override
+      public void run() {
+        Tracer trace = Trace.trace("1");
+        long meth1;
+        try {
+          meth1 = meth1();
+        } finally {
+          trace.done();
+        }
+        System.out.println(meth1);
+      }
+    };
+    Thread thread = new Thread(Trace.getRunnable(runnable));
+    thread.start();
+    Tracer trace = Trace.trace("1");
+    long meth1;
+    try {
+      meth1 = meth1();
+    } finally {
+      trace.done();
+    }
+    System.out.println(meth1);
+    thread.join();
+    Trace.tearDownTrace();
+  }
+
+  private static long meth1() {
+    Tracer trace = Trace.trace("2");
+    try {
+      return meth2();
+    } finally {
+      trace.done();
+    }
+  }
+
+  private static long meth2() {
+    Tracer trace = Trace.trace("3");
+    try {
+      return meth3();
+    } finally {
+      trace.done();
+    }
+  }
+
+  private static long meth3() {
+    long t = 1;
+    for (long i = 1; i < 10000; i++) {
+      t += i;
+    }
+    return t;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/Blur.thrift
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/Blur.thrift b/distribution/src/main/scripts/interface/Blur.thrift
index 18dca49..0b37090 100644
--- a/distribution/src/main/scripts/interface/Blur.thrift
+++ b/distribution/src/main/scripts/interface/Blur.thrift
@@ -1084,6 +1084,14 @@ service Blur {
     1:set<string> metrics
   ) throws (1:BlurException ex)
 
+  /**
+   * Starts a trace with the given trace id.
+   */
+  oneway void startTrace(
+    /** the trace id. */
+    1:string traceId
+  )
+
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/gen-html/Blur.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-html/Blur.html b/distribution/src/main/scripts/interface/gen-html/Blur.html
index ced2295..4b6cd66 100644
--- a/distribution/src/main/scripts/interface/gen-html/Blur.html
+++ b/distribution/src/main/scripts/interface/gen-html/Blur.html
@@ -41,6 +41,7 @@
 <li><a href="Blur.html#Fn_Blur_shardServerLayout">shardServerLayout</a></li>
 <li><a href="Blur.html#Fn_Blur_shardServerLayoutState">shardServerLayoutState</a></li>
 <li><a href="Blur.html#Fn_Blur_shardServerList">shardServerList</a></li>
+<li><a href="Blur.html#Fn_Blur_startTrace">startTrace</a></li>
 <li><a href="Blur.html#Fn_Blur_tableList">tableList</a></li>
 <li><a href="Blur.html#Fn_Blur_tableListByCluster">tableListByCluster</a></li>
 <li><a href="Blur.html#Fn_Blur_tableStats">tableStats</a></li>
@@ -830,4 +831,10 @@ the shard given the same situation.
 <br/><br/><h4 id="Parameters_Blur_metrics">Parameters</h4>
 <table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>metrics</td><td>the names of the metrics to return.  If null all are returned.
 </td></tr>
+</table></div><div class="definition"><h4 id="Fn_Blur_startTrace">Function: Blur.startTrace</h4>
+<pre><code>void</code> startTrace(<code>string</code> traceId)
+</pre>Starts a trace with the given trace id.
+<br/><br/><h4 id="Parameters_Blur_startTrace">Parameters</h4>
+<table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>traceId</td><td>the trace id.
+</td></tr>
 </table></div></div></body></html>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/gen-html/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-html/index.html b/distribution/src/main/scripts/interface/gen-html/index.html
index a037946..b1aa6ac 100644
--- a/distribution/src/main/scripts/interface/gen-html/index.html
+++ b/distribution/src/main/scripts/interface/gen-html/index.html
@@ -37,6 +37,7 @@
 <li><a href="Blur.html#Fn_Blur_shardServerLayout">shardServerLayout</a></li>
 <li><a href="Blur.html#Fn_Blur_shardServerLayoutState">shardServerLayoutState</a></li>
 <li><a href="Blur.html#Fn_Blur_shardServerList">shardServerList</a></li>
+<li><a href="Blur.html#Fn_Blur_startTrace">startTrace</a></li>
 <li><a href="Blur.html#Fn_Blur_tableList">tableList</a></li>
 <li><a href="Blur.html#Fn_Blur_tableListByCluster">tableListByCluster</a></li>
 <li><a href="Blur.html#Fn_Blur_tableStats">tableStats</a></li>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Blur.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Blur.java b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Blur.java
index 8e63a43..8182634 100644
--- a/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Blur.java
+++ b/distribution/src/main/scripts/interface/gen-java/org/apache/blur/thrift/generated/Blur.java
@@ -366,6 +366,13 @@ public class Blur {
      */
     public Map<String,Metric> metrics(Set<String> metrics) throws BlurException, org.apache.blur.thirdparty.thrift_0_9_0.TException;
 
+    /**
+     * Starts a trace with the given trace id.
+     * 
+     * @param traceId the trace id.
+     */
+    public void startTrace(String traceId) throws org.apache.blur.thirdparty.thrift_0_9_0.TException;
+
   }
 
   public interface AsyncIface {
@@ -438,6 +445,8 @@ public class Blur {
 
     public void metrics(Set<String> metrics, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<AsyncClient.metrics_call> resultHandler) throws org.apache.blur.thirdparty.thrift_0_9_0.TException;
 
+    public void startTrace(String traceId, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<AsyncClient.startTrace_call> resultHandler) throws org.apache.blur.thirdparty.thrift_0_9_0.TException;
+
   }
 
   public static class Client extends org.apache.blur.thirdparty.thrift_0_9_0.TServiceClient implements Iface {
@@ -1314,6 +1323,18 @@ public class Blur {
       throw new org.apache.blur.thirdparty.thrift_0_9_0.TApplicationException(org.apache.blur.thirdparty.thrift_0_9_0.TApplicationException.MISSING_RESULT, "metrics failed: unknown result");
     }
 
+    public void startTrace(String traceId) throws org.apache.blur.thirdparty.thrift_0_9_0.TException
+    {
+      send_startTrace(traceId);
+    }
+
+    public void send_startTrace(String traceId) throws org.apache.blur.thirdparty.thrift_0_9_0.TException
+    {
+      startTrace_args args = new startTrace_args();
+      args.setTraceId(traceId);
+      sendBase("startTrace", args);
+    }
+
   }
   public static class AsyncClient extends org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncClient implements AsyncIface {
     public static class Factory implements org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncClientFactory<AsyncClient> {
@@ -2461,6 +2482,37 @@ public class Blur {
       }
     }
 
+    public void startTrace(String traceId, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<startTrace_call> resultHandler) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      checkReady();
+      startTrace_call method_call = new startTrace_call(traceId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class startTrace_call extends org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncMethodCall {
+      private String traceId;
+      public startTrace_call(String traceId, org.apache.blur.thirdparty.thrift_0_9_0.async.AsyncMethodCallback<startTrace_call> resultHandler, org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncClient client, org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolFactory protocolFactory, org.apache.blur.thirdparty.thrift_0_9_0.transport.TNonblockingTransport transport) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        super(client, protocolFactory, transport, resultHandler, true);
+        this.traceId = traceId;
+      }
+
+      public void write_args(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        prot.writeMessageBegin(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMessage("startTrace", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TMessageType.CALL, 0));
+        startTrace_args args = new startTrace_args();
+        args.setTraceId(traceId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public void getResult() throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        if (getState() != org.apache.blur.thirdparty.thrift_0_9_0.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.blur.thirdparty.thrift_0_9_0.transport.TMemoryInputTransport memoryTransport = new org.apache.blur.thirdparty.thrift_0_9_0.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+      }
+    }
+
   }
 
   public static class Processor<I extends Iface> extends org.apache.blur.thirdparty.thrift_0_9_0.TBaseProcessor<I> implements org.apache.blur.thirdparty.thrift_0_9_0.TProcessor {
@@ -2508,6 +2560,7 @@ public class Blur {
       processMap.put("isInSafeMode", new isInSafeMode());
       processMap.put("configuration", new configuration());
       processMap.put("metrics", new metrics());
+      processMap.put("startTrace", new startTrace());
       return processMap;
     }
 
@@ -3325,6 +3378,25 @@ public class Blur {
       }
     }
 
+    public static class startTrace<I extends Iface> extends org.apache.blur.thirdparty.thrift_0_9_0.ProcessFunction<I, startTrace_args> {
+      public startTrace() {
+        super("startTrace");
+      }
+
+      public startTrace_args getEmptyArgsInstance() {
+        return new startTrace_args();
+      }
+
+      protected boolean isOneway() {
+        return true;
+      }
+
+      public org.apache.blur.thirdparty.thrift_0_9_0.TBase getResult(I iface, startTrace_args args) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        iface.startTrace(args.traceId);
+        return null;
+      }
+    }
+
   }
 
   public static class createTable_args implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<createTable_args, createTable_args._Fields>, java.io.Serializable, Cloneable   {
@@ -32336,4 +32408,370 @@ public class Blur {
 
   }
 
+  public static class startTrace_args implements org.apache.blur.thirdparty.thrift_0_9_0.TBase<startTrace_args, startTrace_args._Fields>, java.io.Serializable, Cloneable   {
+    private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct STRUCT_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TStruct("startTrace_args");
+
+    private static final org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField TRACE_ID_FIELD_DESC = new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField("traceId", org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING, (short)1);
+
+    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+    static {
+      schemes.put(StandardScheme.class, new startTrace_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new startTrace_argsTupleSchemeFactory());
+    }
+
+    /**
+     * the trace id.
+     */
+    public String traceId; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.blur.thirdparty.thrift_0_9_0.TFieldIdEnum {
+      /**
+       * the trace id.
+       */
+      TRACE_ID((short)1, "traceId");
+
+      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // TRACE_ID
+            return TRACE_ID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> metaDataMap;
+    static {
+      Map<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.TRACE_ID, new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData("traceId", org.apache.blur.thirdparty.thrift_0_9_0.TFieldRequirementType.DEFAULT, 
+          new org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldValueMetaData(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING)));
+      metaDataMap = Collections.unmodifiableMap(tmpMap);
+      org.apache.blur.thirdparty.thrift_0_9_0.meta_data.FieldMetaData.addStructMetaDataMap(startTrace_args.class, metaDataMap);
+    }
+
+    public startTrace_args() {
+    }
+
+    public startTrace_args(
+      String traceId)
+    {
+      this();
+      this.traceId = traceId;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public startTrace_args(startTrace_args other) {
+      if (other.isSetTraceId()) {
+        this.traceId = other.traceId;
+      }
+    }
+
+    public startTrace_args deepCopy() {
+      return new startTrace_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.traceId = null;
+    }
+
+    /**
+     * the trace id.
+     */
+    public String getTraceId() {
+      return this.traceId;
+    }
+
+    /**
+     * the trace id.
+     */
+    public startTrace_args setTraceId(String traceId) {
+      this.traceId = traceId;
+      return this;
+    }
+
+    public void unsetTraceId() {
+      this.traceId = null;
+    }
+
+    /** Returns true if field traceId is set (has been assigned a value) and false otherwise */
+    public boolean isSetTraceId() {
+      return this.traceId != null;
+    }
+
+    public void setTraceIdIsSet(boolean value) {
+      if (!value) {
+        this.traceId = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, Object value) {
+      switch (field) {
+      case TRACE_ID:
+        if (value == null) {
+          unsetTraceId();
+        } else {
+          setTraceId((String)value);
+        }
+        break;
+
+      }
+    }
+
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case TRACE_ID:
+        return getTraceId();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case TRACE_ID:
+        return isSetTraceId();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof startTrace_args)
+        return this.equals((startTrace_args)that);
+      return false;
+    }
+
+    public boolean equals(startTrace_args that) {
+      if (that == null)
+        return false;
+
+      boolean this_present_traceId = true && this.isSetTraceId();
+      boolean that_present_traceId = true && that.isSetTraceId();
+      if (this_present_traceId || that_present_traceId) {
+        if (!(this_present_traceId && that_present_traceId))
+          return false;
+        if (!this.traceId.equals(that.traceId))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      return 0;
+    }
+
+    public int compareTo(startTrace_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+      startTrace_args typedOther = (startTrace_args)other;
+
+      lastComparison = Boolean.valueOf(isSetTraceId()).compareTo(typedOther.isSetTraceId());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetTraceId()) {
+        lastComparison = org.apache.blur.thirdparty.thrift_0_9_0.TBaseHelper.compareTo(this.traceId, typedOther.traceId);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+    }
+
+    public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("startTrace_args(");
+      boolean first = true;
+
+      sb.append("traceId:");
+      if (this.traceId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.traceId);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(out)));
+      } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.blur.thirdparty.thrift_0_9_0.protocol.TCompactProtocol(new org.apache.blur.thirdparty.thrift_0_9_0.transport.TIOStreamTransport(in)));
+      } catch (org.apache.blur.thirdparty.thrift_0_9_0.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class startTrace_argsStandardSchemeFactory implements SchemeFactory {
+      public startTrace_argsStandardScheme getScheme() {
+        return new startTrace_argsStandardScheme();
+      }
+    }
+
+    private static class startTrace_argsStandardScheme extends StandardScheme<startTrace_args> {
+
+      public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol iprot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        org.apache.blur.thirdparty.thrift_0_9_0.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // TRACE_ID
+              if (schemeField.type == org.apache.blur.thirdparty.thrift_0_9_0.protocol.TType.STRING) {
+                struct.traceId = iprot.readString();
+                struct.setTraceIdIsSet(true);
+              } else { 
+                org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol oprot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.traceId != null) {
+          oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
+          oprot.writeString(struct.traceId);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class startTrace_argsTupleSchemeFactory implements SchemeFactory {
+      public startTrace_argsTupleScheme getScheme() {
+        return new startTrace_argsTupleScheme();
+      }
+    }
+
+    private static class startTrace_argsTupleScheme extends TupleScheme<startTrace_args> {
+
+      @Override
+      public void write(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        TTupleProtocol oprot = (TTupleProtocol) prot;
+        BitSet optionals = new BitSet();
+        if (struct.isSetTraceId()) {
+          optionals.set(0);
+        }
+        oprot.writeBitSet(optionals, 1);
+        if (struct.isSetTraceId()) {
+          oprot.writeString(struct.traceId);
+        }
+      }
+
+      @Override
+      public void read(org.apache.blur.thirdparty.thrift_0_9_0.protocol.TProtocol prot, startTrace_args struct) throws org.apache.blur.thirdparty.thrift_0_9_0.TException {
+        TTupleProtocol iprot = (TTupleProtocol) prot;
+        BitSet incoming = iprot.readBitSet(1);
+        if (incoming.get(0)) {
+          struct.traceId = iprot.readString();
+          struct.setTraceIdIsSet(true);
+        }
+      }
+    }
+
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/gen-js/Blur.js
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-js/Blur.js b/distribution/src/main/scripts/interface/gen-js/Blur.js
index cc7c86d..b26e358 100644
--- a/distribution/src/main/scripts/interface/gen-js/Blur.js
+++ b/distribution/src/main/scripts/interface/gen-js/Blur.js
@@ -4672,6 +4672,87 @@ Blur_metrics_result.prototype.write = function(output) {
   return;
 };
 
+Blur_startTrace_args = function(args) {
+  this.traceId = null;
+  if (args) {
+    if (args.traceId !== undefined) {
+      this.traceId = args.traceId;
+    }
+  }
+};
+Blur_startTrace_args.prototype = {};
+Blur_startTrace_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.traceId = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_startTrace_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_startTrace_args');
+  if (this.traceId !== null && this.traceId !== undefined) {
+    output.writeFieldBegin('traceId', Thrift.Type.STRING, 1);
+    output.writeString(this.traceId);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_startTrace_result = function(args) {
+};
+Blur_startTrace_result.prototype = {};
+Blur_startTrace_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    input.skip(ftype);
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_startTrace_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_startTrace_result');
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
 BlurClient = function(input, output) {
     this.input = input;
     this.output = (!output) ? input : output;
@@ -5895,3 +5976,15 @@ BlurClient.prototype.recv_metrics = function() {
   }
   throw 'metrics failed: unknown result';
 };
+BlurClient.prototype.startTrace = function(traceId) {
+  this.send_startTrace(traceId);
+};
+
+BlurClient.prototype.send_startTrace = function(traceId) {
+  this.output.writeMessageBegin('startTrace', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_startTrace_args();
+  args.traceId = traceId;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
index 4abbba3..61a2877 100644
--- a/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
+++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
@@ -5341,6 +5341,116 @@ sub write {
   return $xfer;
 }
 
+package Blur::Blur_startTrace_args;
+use base qw(Class::Accessor);
+Blur::Blur_startTrace_args->mk_accessors( qw( traceId ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{traceId} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{traceId}) {
+      $self->{traceId} = $vals->{traceId};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_startTrace_args';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{traceId});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_startTrace_args');
+  if (defined $self->{traceId}) {
+    $xfer += $output->writeFieldBegin('traceId', TType::STRING, 1);
+    $xfer += $output->writeString($self->{traceId});
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::Blur_startTrace_result;
+use base qw(Class::Accessor);
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_startTrace_result';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_startTrace_result');
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
 package Blur::BlurIf;
 
 use strict;
@@ -5598,6 +5708,13 @@ sub metrics{
   die 'implement interface';
 }
 
+sub startTrace{
+  my $self = shift;
+  my $traceId = shift;
+
+  die 'implement interface';
+}
+
 package Blur::BlurRest;
 
 use strict;
@@ -5862,6 +5979,13 @@ sub metrics{
   return $self->{impl}->metrics($metrics);
 }
 
+sub startTrace{
+  my ($self, $request) = @_;
+
+  my $traceId = ($request->{'traceId'}) ? $request->{'traceId'} : undef;
+  return $self->{impl}->startTrace($traceId);
+}
+
 package Blur::BlurClient;
 
 
@@ -7423,6 +7547,24 @@ sub recv_metrics{
   }
   die "metrics failed: unknown result";
 }
+sub startTrace{
+  my $self = shift;
+  my $traceId = shift;
+
+    $self->send_startTrace($traceId);
+}
+
+sub send_startTrace{
+  my $self = shift;
+  my $traceId = shift;
+
+  $self->{output}->writeMessageBegin('startTrace', TMessageType::CALL, $self->{seqid});
+  my $args = new Blur::Blur_startTrace_args();
+  $args->{traceId} = $traceId;
+  $args->write($self->{output});
+  $self->{output}->writeMessageEnd();
+  $self->{output}->getTransport()->flush();
+}
 package Blur::BlurProcessor;
 
 use strict;
@@ -8026,4 +8168,12 @@ sub process_metrics {
     $output->getTransport()->flush();
 }
 
+sub process_startTrace {
+    my ($self, $seqid, $input, $output) = @_;
+    my $args = new Blur::Blur_startTrace_args();
+    $args->read($input);
+    $input->readMessageEnd();
+    $self->{handler}->startTrace($args->traceId);
+    return;
+}
 1;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/distribution/src/main/scripts/interface/gen-rb/blur.rb
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-rb/blur.rb b/distribution/src/main/scripts/interface/gen-rb/blur.rb
index 66a23b1..00d0a63 100644
--- a/distribution/src/main/scripts/interface/gen-rb/blur.rb
+++ b/distribution/src/main/scripts/interface/gen-rb/blur.rb
@@ -537,6 +537,13 @@ module Blur
         raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'metrics failed: unknown result')
       end
 
+      def startTrace(traceId)
+        send_startTrace(traceId)
+      end
+
+      def send_startTrace(traceId)
+        send_message('startTrace', StartTrace_args, :traceId => traceId)
+      end
     end
 
     class Processor
@@ -911,6 +918,12 @@ module Blur
         write_result(result, oprot, 'metrics', seqid)
       end
 
+      def process_startTrace(seqid, iprot, oprot)
+        args = read_args(iprot, StartTrace_args)
+        @handler.startTrace(args.traceId)
+        return
+      end
+
     end
 
     # HELPER FUNCTIONS AND STRUCTURES
@@ -2123,6 +2136,38 @@ module Blur
       ::Thrift::Struct.generate_accessors self
     end
 
+    class StartTrace_args
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      TRACEID = 1
+
+      FIELDS = {
+        # the trace id.
+        TRACEID => {:type => ::Thrift::Types::STRING, :name => 'traceId'}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
+    class StartTrace_result
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+
+      FIELDS = {
+
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
   end
 
 end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3f18c33/docs/Blur.html
----------------------------------------------------------------------
diff --git a/docs/Blur.html b/docs/Blur.html
index 1fc917b..56349a9 100644
--- a/docs/Blur.html
+++ b/docs/Blur.html
@@ -133,6 +133,7 @@ limitations under the License.
 <li><a href="#Fn_Blur_isInSafeMode">&nbsp;&nbsp;isInSafeMode</a></li>
 <li><a href="#Fn_Blur_configuration">&nbsp;&nbsp;configuration</a></li>
 <li><a href="#Fn_Blur_metrics">&nbsp;&nbsp;metrics</a></li>
+<li><a href="#Fn_Blur_startTrace">&nbsp;&nbsp;startTrace</a></li>
 </ul></li>
 </ul>
 </li>
@@ -889,6 +890,12 @@ throws <code><a href="Blur.html#Struct_BlurException">BlurException</a></code>
 <br/><br/><h4 id="Parameters_Blur_metrics">Parameters</h4>
 <table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>metrics</td><td>the names of the metrics to return.  If null all are returned.
 </td></tr>
+</table></p></section><section><div class="page-header"><h4 id="Fn_Blur_startTrace">Function: Blur.startTrace</h4></div><p class="lead">
+<pre><code>void</code> startTrace(<code>string</code> traceId)
+</pre>Starts a trace with the given trace id.
+<br/><br/><h4 id="Parameters_Blur_startTrace">Parameters</h4>
+<table class="table-bordered table-striped table-condensed"><thead><th>Name</th><th>Description</th></thead><tr><td>traceId</td><td>the trace id.
+</td></tr>
 </table></p></section>
 </div>
 </div>


Mime
View raw message