use of org.apache.cxf.tracing.brave.internal.HttpAdapterFactory.Request in project cxf by apache.
the class AbstractBraveProvider method startTraceSpan.
protected TraceScopeHolder<TraceScope> startTraceSpan(final Map<String, List<String>> requestHeaders, URI uri, String method) {
final Request request = HttpAdapterFactory.request(requestHeaders, uri, method);
final HttpServerAdapter<Request, ?> adapter = HttpServerAdapterFactory.create(request);
@SuppressWarnings("unchecked") final HttpServerHandler<Request, ?> handler = HttpServerHandler.create(brave, adapter);
Span span = handler.handleReceive(brave.tracing().propagation().extractor(adapter::requestHeader), request);
// If the service resource is using asynchronous processing mode, the trace
// scope will be closed in another thread and as such should be detached.
SpanInScope scope = null;
if (isAsyncResponse() && span != null) {
// Do not modify the current context span
propagateContinuationSpan(span);
} else if (span != null) {
scope = brave.tracing().tracer().withSpanInScope(span);
}
return new TraceScopeHolder<TraceScope>(new TraceScope(span, scope), scope == null);
}
use of org.apache.cxf.tracing.brave.internal.HttpAdapterFactory.Request in project cxf by apache.
the class AbstractBraveClientProvider method startTraceSpan.
protected TraceScopeHolder<TraceScope> startTraceSpan(final Map<String, List<String>> requestHeaders, URI uri, String method) {
final Request request = HttpAdapterFactory.request(requestHeaders, uri, method);
final HttpClientAdapter<Request, ?> adapter = HttpClientAdapterFactory.create(request);
@SuppressWarnings("unchecked") final HttpClientHandler<Request, ?> handler = HttpClientHandler.create(brave, adapter);
final Span span = handler.handleSend(brave.tracing().propagation().injector(inject(requestHeaders)), request);
// In case of asynchronous client invocation, the span should be detached as JAX-RS
// client request / response filters are going to be executed in different threads.
SpanInScope scope = null;
if (!isAsyncInvocation() && span != null) {
scope = brave.tracing().tracer().withSpanInScope(span);
}
return new TraceScopeHolder<TraceScope>(new TraceScope(span, scope), scope == null);
}
Aggregations