use of io.jaegertracing.internal.JaegerSpan in project jaeger-client-java by jaegertracing.
the class JaegerThriftSpanConverterTest method testConvertSpanOneReferenceChildOf.
@Test
public void testConvertSpanOneReferenceChildOf() {
JaegerSpan parent = tracer.buildSpan("foo").start();
JaegerSpan child = tracer.buildSpan("foo").asChildOf(parent).start();
io.jaegertracing.thriftjava.Span span = JaegerThriftSpanConverter.convertSpan(child);
assertEquals(child.context().getParentId(), span.getParentSpanId());
assertEquals(0, span.getReferences().size());
}
use of io.jaegertracing.internal.JaegerSpan in project jaeger-client-java by jaegertracing.
the class JaegerThriftSpanConverterTest method testConvertSpanWith128BitTraceId.
@Test
public void testConvertSpanWith128BitTraceId() {
JaegerSpan span = tracer128.buildSpan("operation-name").start();
io.jaegertracing.thriftjava.Span thriftSpan = JaegerThriftSpanConverter.convertSpan(span);
assertEquals(span.context().getTraceIdLow(), thriftSpan.getTraceIdLow());
assertEquals(span.context().getTraceIdHigh(), thriftSpan.getTraceIdHigh());
}
use of io.jaegertracing.internal.JaegerSpan in project jaeger-client-java by jaegertracing.
the class JaegerThriftSpanConverterTest method testConvertSpan.
@Test
public void testConvertSpan() {
Map<String, Object> fields = new HashMap<String, Object>();
fields.put("k", "v");
JaegerSpan span = tracer.buildSpan("operation-name").start();
span = span.log(1, fields);
span = span.setBaggageItem("foo", "bar");
io.jaegertracing.thriftjava.Span thriftSpan = JaegerThriftSpanConverter.convertSpan(span);
assertEquals("operation-name", thriftSpan.getOperationName());
assertEquals(2, thriftSpan.getLogs().size());
Log thriftLog = thriftSpan.getLogs().get(0);
assertEquals(1, thriftLog.getTimestamp());
assertEquals(1, thriftLog.getFields().size());
Tag thriftTag = thriftLog.getFields().get(0);
assertEquals("k", thriftTag.getKey());
assertEquals("v", thriftTag.getVStr());
thriftLog = thriftSpan.getLogs().get(1);
assertEquals(3, thriftLog.getFields().size());
thriftTag = thriftLog.getFields().get(0);
assertEquals("event", thriftTag.getKey());
assertEquals("baggage", thriftTag.getVStr());
thriftTag = thriftLog.getFields().get(1);
assertEquals("value", thriftTag.getKey());
assertEquals("bar", thriftTag.getVStr());
thriftTag = thriftLog.getFields().get(2);
assertEquals("key", thriftTag.getKey());
assertEquals("foo", thriftTag.getVStr());
}
use of io.jaegertracing.internal.JaegerSpan in project jaeger-client-java by jaegertracing.
the class JaegerThriftSpanConverterTest method testConvertSpanTwoReferencesChildOf.
@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));
}
use of io.jaegertracing.internal.JaegerSpan in project jaeger-client-java by jaegertracing.
the class EndToEndBehaviorResourceTest method validateSpans.
private void validateSpans(List<JaegerSpan> spans, CreateTracesRequest request) {
assertEquals(request.getCount(), spans.size());
for (JaegerSpan s : spans) {
assertEquals(request.getOperation(), s.getOperationName());
Map<String, Object> tags = s.getTags();
for (Map.Entry<String, String> entry : request.getTags().entrySet()) {
assertTrue(tags.containsKey(entry.getKey()));
Object value = tags.get(entry.getKey());
assertEquals(entry.getValue(), value);
}
}
}
Aggregations