I.2. Client Modifications

Currently, you must turn on tracing in your client code. To do this, you simply turn on tracing for requests you think are interesting, and turn it off when the request is done.

For example, if you wanted to trace all of your get operations, you change this:

HTable table = new HTable(...);
Get get = new Get(...);

into:

Span getSpan = Trace.startSpan(“doing get”, Sampler.ALWAYS);
try {
  HTable table = new HTable(...);
  Get get = new Get(...);
...
} finally {
  getSpan.stop();
}

If you wanted to trace half of your ‘get’ operations, you would pass in:

new ProbabilitySampler(0.5)

in lieu of Sampler.ALWAYS to Trace.startSpan(). See the HTrace README for more information on Samplers.

comments powered by Disqus