use of brave.opentracing.BraveSpan in project spring-cloud-sleuth by spring-cloud.
the class BraveTracerTest method implicitParentFromSpanManager_start.
@Test
public void implicitParentFromSpanManager_start() {
try (Scope scopeA = opentracing.buildSpan("spanA").startActive(true)) {
BraveSpan span = opentracing.buildSpan("spanB").start();
assertThat(span.unwrap().context().parentId()).isEqualTo(getTraceContext(scopeA).spanId());
}
}
use of brave.opentracing.BraveSpan in project spring-cloud-sleuth by spring-cloud.
the class BraveTracerTest method implicitParentFromSpanManager_start_ignoreActiveSpan.
@Test
public void implicitParentFromSpanManager_start_ignoreActiveSpan() {
try (Scope scopeA = opentracing.buildSpan("spanA").startActive(true)) {
BraveSpan span = opentracing.buildSpan("spanB").ignoreActiveSpan().start();
assertThat(span.unwrap().context().parentId()).isNull();
}
}
use of brave.opentracing.BraveSpan in project spring-cloud-sleuth by spring-cloud.
the class BraveTracerTest method injectTraceContext_baggage.
@Test
public void injectTraceContext_baggage() throws Exception {
BraveSpan span = opentracing.buildSpan("foo").start();
span.setBaggageItem("country-code", "FO");
Map<String, String> map = new LinkedHashMap<>();
TextMapInjectAdapter carrier = new TextMapInjectAdapter(map);
opentracing.inject(span.context(), Format.Builtin.HTTP_HEADERS, carrier);
assertThat(map).containsEntry("baggage-country-code", "FO");
}
use of brave.opentracing.BraveSpan in project spring-cloud-sleuth by spring-cloud.
the class BraveTracerTest method startWithOpenTracingAndFinishWithBrave.
@Test
public void startWithOpenTracingAndFinishWithBrave() {
io.opentracing.Span openTracingSpan = opentracing.buildSpan("encode").withTag("lc", "codec").withStartTimestamp(1L).start();
Span braveSpan = ((BraveSpan) openTracingSpan).unwrap();
braveSpan.annotate(2L, "pump fake");
braveSpan.finish(3L);
checkSpanReportedToZipkin();
}
Aggregations