use of org.apache.htrace.core.SpanId in project cxf by apache.
the class AbstractHTraceProvider method startTraceSpan.
protected TraceScopeHolder<TraceScope> startTraceSpan(final Map<String, List<String>> requestHeaders, String path, String method) {
// Try to extract the Span Id value from the request header
final SpanId spanId = getFirstValueOrDefault(requestHeaders, getSpanIdHeader(), SpanId.INVALID);
TraceScope traceScope = null;
if (SpanId.INVALID.equals(spanId)) {
traceScope = tracer.newScope(buildSpanDescription(path, method));
} else {
traceScope = tracer.newScope(buildSpanDescription(path, method), spanId);
}
// If the service resource is using asynchronous processing mode, the trace
// scope will be closed in another thread and as such should be detached.
boolean detached = false;
if (isAsyncResponse()) {
traceScope.detach();
propagateContinuationSpan(traceScope);
detached = true;
}
return new TraceScopeHolder<TraceScope>(traceScope, detached);
}
Aggregations