Search in sources :

Example 1 with Tracer

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);
    }
}
Also used : Tracer(com.nike.wingtips.Tracer) RequestWithHeaders(com.nike.wingtips.http.RequestWithHeaders) RequestWithHeadersNettyAdapter(com.nike.trace.netty.RequestWithHeadersNettyAdapter) Span(com.nike.wingtips.Span)

Aggregations

RequestWithHeadersNettyAdapter (com.nike.trace.netty.RequestWithHeadersNettyAdapter)1 Span (com.nike.wingtips.Span)1 Tracer (com.nike.wingtips.Tracer)1 RequestWithHeaders (com.nike.wingtips.http.RequestWithHeaders)1