Search in sources :

Example 1 with SpanRef

use of com.uber.jaeger.thriftjava.SpanRef in project jaeger-client-java by jaegertracing.

the class JaegerThriftSpanConverter method convertSpan.

public static com.uber.jaeger.thriftjava.Span convertSpan(Span span) {
    SpanContext context = span.context();
    boolean oneChildOfParent = span.getReferences().size() == 1 && References.CHILD_OF.equals(span.getReferences().get(0).getType());
    return new com.uber.jaeger.thriftjava.Span(context.getTraceId(), // TraceIdHigh is currently not supported
    0, context.getSpanId(), oneChildOfParent ? context.getParentId() : 0, span.getOperationName(), context.getFlags(), span.getStart(), span.getDuration()).setReferences(oneChildOfParent ? Collections.<SpanRef>emptyList() : buildReferences(span.getReferences())).setTags(buildTags(span.getTags())).setLogs(buildLogs(span.getLogs()));
}
Also used : SpanContext(com.uber.jaeger.SpanContext) SpanRef(com.uber.jaeger.thriftjava.SpanRef)

Example 2 with SpanRef

use of com.uber.jaeger.thriftjava.SpanRef in project jaeger-client-java by jaegertracing.

the class JaegerThriftSpanConverter method buildReferences.

static List<SpanRef> buildReferences(List<Reference> references) {
    List<SpanRef> thriftReferences = new ArrayList<SpanRef>(references.size());
    for (Reference reference : references) {
        SpanRefType thriftRefType = References.CHILD_OF.equals(reference.getType()) ? SpanRefType.CHILD_OF : SpanRefType.FOLLOWS_FROM;
        thriftReferences.add(new SpanRef(thriftRefType, reference.getSpanContext().getTraceId(), 0, reference.getSpanContext().getSpanId()));
    }
    return thriftReferences;
}
Also used : Reference(com.uber.jaeger.Reference) SpanRef(com.uber.jaeger.thriftjava.SpanRef) SpanRefType(com.uber.jaeger.thriftjava.SpanRefType) ArrayList(java.util.ArrayList)

Aggregations

SpanRef (com.uber.jaeger.thriftjava.SpanRef)2 Reference (com.uber.jaeger.Reference)1 SpanContext (com.uber.jaeger.SpanContext)1 SpanRefType (com.uber.jaeger.thriftjava.SpanRefType)1 ArrayList (java.util.ArrayList)1