[ 
https://issues.apache.org/jira/browse/HTRACE-317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15047861#comment-15047861
 ] 

Sean Busbey commented on HTRACE-317:
------------------------------------

Additionally, the docs on wrapping for thread changes are incorrect.

{code}
Thread t1 = new Thread(Trace.wrap(new MyRunnable()));

That’s it! Trace.wrap() takes a single argument (a runnable or a callable) and 
if the current thread is a part of a trace, returns a wrapped version of the 
argument. The wrapped version of a callable and runnable just knows about the 
span that created it and will start a new span in the new thread that is the 
child of the span that created the runnable/callable. There may be situations 
in which a simple Trace.wrap() does not suffice. In these cases all you need to 
do is keep a reference to the “parent span” (the span before the thread change) 
and once you’re in the new thread start a new span that is the “child” of the 
parent span you stored.
{code}

There is no {{Trace}}. From looking through the API, I think this is meant to 
be {{Tracer.wrap}}. That method takes two args, either a runnable or callable 
and a description (that I think gets attached to any new scopes that get made 
in the thread, but it's not obvious).

> Docs for adding tracing to an application are incorrect
> -------------------------------------------------------
>
>                 Key: HTRACE-317
>                 URL: https://issues.apache.org/jira/browse/HTRACE-317
>             Project: HTrace
>          Issue Type: Bug
>          Components: docs
>    Affects Versions: 4.0.1
>            Reporter: Sean Busbey
>            Priority: Critical
>
> The docs for adding tracing state:
> {code}
> Span computationSpan = tracer.newScope("Expensive computation.");
> try {
>     //expensive computation here
> } finally {
>     computationSpan.stop();
> }
> {code}
> the {{tracer.newScope}} method returns a TraceScope object. That object has a 
> {{close}} method, not {{stop}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to