@Test public void testConvertSpanTwoReferencesChildOf() { JaegerSpan parent = tracer.buildSpan("foo").start(); JaegerSpan parent2 = tracer.buildSpan("foo").start(); JaegerSpan child = tracer.buildSpan("foo") .asChildOf(parent) .asChildOf(parent2) .start(); io.jaegertracing.thriftjava.Span span = JaegerThriftSpanConverter.convertSpan(child); assertEquals(0, span.getParentSpanId()); assertEquals(2, span.getReferences().size()); assertEquals(buildReference(parent.context(), References.CHILD_OF),span.getReferences().get(0)); assertEquals(buildReference(parent2.context(), References.CHILD_OF),span.getReferences().get(1)); }
public static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan) { JaegerSpanContext context = jaegerSpan.context(); boolean oneChildOfParent = jaegerSpan.getReferences().size() == 1 && References.CHILD_OF.equals(jaegerSpan.getReferences().get(0).getType()); List<SpanRef> references = oneChildOfParent ? Collections.<SpanRef>emptyList() : buildReferences(jaegerSpan.getReferences()); return new io.jaegertracing.thriftjava.Span( context.getTraceIdLow(), context.getTraceIdHigh(), context.getSpanId(), oneChildOfParent ? context.getParentId() : 0, jaegerSpan.getOperationName(), context.getFlags(), jaegerSpan.getStart(), jaegerSpan.getDuration() ) .setReferences(references) .setTags(buildTags(jaegerSpan.getTags())) .setLogs(buildLogs(jaegerSpan.getLogs())); }
JaegerThriftSpanConverter { public static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan) { JaegerSpanContext context = jaegerSpan.context(); boolean oneChildOfParent = jaegerSpan.getReferences().size() == 1 && References.CHILD_OF.equals(jaegerSpan.getReferences().get(0).getType()); List<SpanRef> references = oneChildOfParent ? Collections.<SpanRef>emptyList() : buildReferences(jaegerSpan.getReferences()); return new io.jaegertracing.thriftjava.Span( context.getTraceIdLow(), context.getTraceIdHigh(), context.getSpanId(), oneChildOfParent ? context.getParentId() : 0, jaegerSpan.getOperationName(), context.getFlags(), jaegerSpan.getStart(), jaegerSpan.getDuration() ) .setReferences(references) .setTags(buildTags(jaegerSpan.getTags())) .setLogs(buildLogs(jaegerSpan.getLogs())); } }
JaegerThriftSpanConverter { public static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan) { JaegerSpanContext context = jaegerSpan.context(); boolean oneChildOfParent = jaegerSpan.getReferences().size() == 1 && References.CHILD_OF.equals(jaegerSpan.getReferences().get(0).getType()); List<SpanRef> references = oneChildOfParent ? Collections.<SpanRef>emptyList() : buildReferences(jaegerSpan.getReferences()); return new io.jaegertracing.thriftjava.Span( context.getTraceIdLow(), context.getTraceIdHigh(), context.getSpanId(), oneChildOfParent ? context.getParentId() : 0, jaegerSpan.getOperationName(), context.getFlags(), jaegerSpan.getStart(), jaegerSpan.getDuration() ) .setReferences(references) .setTags(buildTags(jaegerSpan.getTags())) .setLogs(buildLogs(jaegerSpan.getLogs())); } private  JaegerThriftSpanConverter(); }
JaegerThriftSpanConverter { public static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan) { JaegerSpanContext context = jaegerSpan.context(); boolean oneChildOfParent = jaegerSpan.getReferences().size() == 1 && References.CHILD_OF.equals(jaegerSpan.getReferences().get(0).getType()); List<SpanRef> references = oneChildOfParent ? Collections.<SpanRef>emptyList() : buildReferences(jaegerSpan.getReferences()); return new io.jaegertracing.thriftjava.Span( context.getTraceIdLow(), context.getTraceIdHigh(), context.getSpanId(), oneChildOfParent ? context.getParentId() : 0, jaegerSpan.getOperationName(), context.getFlags(), jaegerSpan.getStart(), jaegerSpan.getDuration() ) .setReferences(references) .setTags(buildTags(jaegerSpan.getTags())) .setLogs(buildLogs(jaegerSpan.getLogs())); } private  JaegerThriftSpanConverter(); static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan); static List<Tag> buildTags(Map<String, ?> tags); }
JaegerThriftSpanConverter { public static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan) { JaegerSpanContext context = jaegerSpan.context(); boolean oneChildOfParent = jaegerSpan.getReferences().size() == 1 && References.CHILD_OF.equals(jaegerSpan.getReferences().get(0).getType()); List<SpanRef> references = oneChildOfParent ? Collections.<SpanRef>emptyList() : buildReferences(jaegerSpan.getReferences()); return new io.jaegertracing.thriftjava.Span( context.getTraceIdLow(), context.getTraceIdHigh(), context.getSpanId(), oneChildOfParent ? context.getParentId() : 0, jaegerSpan.getOperationName(), context.getFlags(), jaegerSpan.getStart(), jaegerSpan.getDuration() ) .setReferences(references) .setTags(buildTags(jaegerSpan.getTags())) .setLogs(buildLogs(jaegerSpan.getLogs())); } private  JaegerThriftSpanConverter(); static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan); static List<Tag> buildTags(Map<String, ?> tags);  }