use of com.nike.wingtips.Tracer in project riposte by Nike-Inc.
the class DTraceStartHandler method startTrace.
protected void startTrace(HttpRequest request) {
Tracer tracer = Tracer.getInstance();
// Start the distributed trace.
RequestWithHeaders requestWrapper = new RequestWithHeadersNettyAdapter(request);
final Span parentSpan = HttpRequestTracingUtils.fromRequestWithHeaders(requestWrapper, userIdHeaderKeys);
if (parentSpan != null) {
logger.debug("Found Parent Span {}", parentSpan.toString());
tracer.startRequestWithChildSpan(parentSpan, getSpanName(request));
} else {
Span newSpan = tracer.startRequestWithRootSpan(getSpanName(request), HttpRequestTracingUtils.getUserIdFromRequestWithHeaders(requestWrapper, userIdHeaderKeys));
logger.debug("Parent Span not found, starting a new trace with root span {}", newSpan);
}
}
Aggregations