Search in sources :

Example 16 with SpanId

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);
}
Also used : TraceScope(org.apache.htrace.core.TraceScope) SpanId(org.apache.htrace.core.SpanId)

Aggregations

SpanId (org.apache.htrace.core.SpanId)16 Test (org.junit.Test)9 Response (javax.ws.rs.core.Response)7 TraceScope (org.apache.htrace.core.TraceScope)3 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 BookStoreService (org.apache.cxf.systest.jaxws.tracing.BookStoreService)1 QuotaExceededException (org.apache.hadoop.hdfs.protocol.QuotaExceededException)1 BaseHeaderProto (org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BaseHeaderProto)1 ReleaseShortCircuitAccessRequestProto (org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.ReleaseShortCircuitAccessRequestProto)1 ShortCircuitShmRequestProto (org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.ShortCircuitShmRequestProto)1 MultipleIOException (org.apache.hadoop.io.MultipleIOException)1