use of brave.ScopedSpan in project brave by openzipkin.
the class DeprecatedHttpClientHandlerTest method handleSend_makesAChild.
@Test
public void handleSend_makesAChild() {
ScopedSpan parent = httpTracing.tracing().tracer().startScopedSpan("test");
try {
assertThat(handler.handleSend(injector, request)).extracting(brave.Span::isNoop, s -> s.context().parentId()).containsExactly(false, parent.context().spanId());
} finally {
parent.finish();
}
spanHandler.takeLocalSpan();
}
use of brave.ScopedSpan in project brave by openzipkin.
the class ITTracingStatementInterceptor method makesChildOfCurrentSpan.
@Test
public void makesChildOfCurrentSpan() throws Exception {
ScopedSpan parent = tracing.tracer().startScopedSpan("test");
try {
prepareExecuteSelect(QUERY);
} finally {
parent.finish();
}
assertThat(spans).hasSize(2);
}
use of brave.ScopedSpan in project brave by openzipkin.
the class ITTracingQueryInterceptor method makesChildOfCurrentSpan.
@Test
public void makesChildOfCurrentSpan() throws Exception {
ScopedSpan parent = tracing.tracer().startScopedSpan("test");
try {
prepareExecuteSelect(QUERY);
} finally {
parent.finish();
}
assertThat(spans).hasSize(2);
}
use of brave.ScopedSpan in project brave by openzipkin.
the class TracingJdbcEventListenerTest method handleAfterExecute_without_beforeExecute_getting_called.
@Test
public void handleAfterExecute_without_beforeExecute_getting_called() {
ScopedSpan parent = tracing.tracer().startScopedSpan("test");
try {
TracingJdbcEventListener listener = new TracingJdbcEventListener("", false, logOptions);
listener.onAfterAnyExecute(statementInformation, 1, null);
listener.onAfterAnyExecute(statementInformation, 1, null);
} finally {
parent.finish();
}
}
use of brave.ScopedSpan in project brave by openzipkin.
the class SkeletalSpansTest method acceptTwoServerRequests.
/**
* Simulates some service calls
*/
static void acceptTwoServerRequests(Tracer server1Tracer, Tracer server2Tracer) {
Span server1 = server1Tracer.newTrace().name("get").kind(Kind.SERVER).start();
Span server2 = server1Tracer.newTrace().name("get").kind(Kind.SERVER).start();
try {
Span client1 = server1Tracer.newChild(server1.context()).name("post").kind(Kind.CLIENT).start();
server2Tracer.joinSpan(fakeUseOfHeaders(client1.context())).name("post").kind(Kind.SERVER).start().finish();
ScopedSpan local1 = server1Tracer.startScopedSpanWithParent("controller", server1.context());
try {
try {
server1Tracer.newTrace().name("async1").start().finish();
server2Tracer.newTrace().name("async2").start().finish();
ScopedSpan local2 = server1Tracer.startScopedSpanWithParent("controller2", server2.context());
Span client2 = server1Tracer.nextSpan().name("post").kind(Kind.CLIENT).start();
try {
server2Tracer.joinSpan(fakeUseOfHeaders(client2.context())).name("post").kind(Kind.SERVER).start().error(new RuntimeException()).finish();
server1Tracer.nextSpan().name("post").kind(Kind.CLIENT).start().remoteServiceName("uninstrumentedServer").error(new RuntimeException()).finish();
} finally {
client2.finish();
local2.finish();
}
} finally {
server2.finish();
}
} finally {
client1.finish();
local1.finish();
}
} finally {
server1.finish();
}
}
Aggregations