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()));
}
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;
}
Aggregations