use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITHttpServer method childCompletesBeforeServer.
/**
* The child completes before the response code is established, so it should be contained
* completely by the server's interval.
*/
@Test
public void childCompletesBeforeServer() throws IOException {
get("/child");
MutableSpan child = testSpanHandler.takeLocalSpan();
MutableSpan server = testSpanHandler.takeRemoteSpan(SERVER);
assertChildOf(child, server);
// sanity check
assertThat(child.name()).isEqualTo("child");
assertSpanInInterval(child, server.startTimestamp(), server.finishTimestamp());
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITHttpServer method defaultSpanNameIsMethodNameOrRoute.
@Test
public void defaultSpanNameIsMethodNameOrRoute() throws IOException {
get("/foo");
MutableSpan span = testSpanHandler.takeRemoteSpan(SERVER);
if (!span.name().equals("GET")) {
assertThat(span.name()).isEqualTo("GET /foo");
}
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITHttpServer method httpStatusCodeTagMatchesResponse_onUncaughtException.
Response httpStatusCodeTagMatchesResponse_onUncaughtException(String path, String errorMessage) throws IOException {
Response response = get(path);
String responseCode = String.valueOf(response.code());
MutableSpan span = testSpanHandler.takeRemoteSpanWithErrorMessage(SERVER, errorMessage);
assertThat(span.tags()).containsEntry("http.status_code", responseCode);
return response;
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITTracingFilter_Consumer method setError_onUnimplemented.
@Test
public void setError_onUnimplemented() {
assertThatThrownBy(() -> wrongClient.get().sayHello("jorge")).isInstanceOf(RpcException.class);
MutableSpan span = testSpanHandler.takeRemoteSpanWithErrorMessage(CLIENT, ".*Not found exported service.*");
assertThat(span.tags()).containsEntry("dubbo.error_code", "1");
}
use of brave.handler.MutableSpan in project brave by openzipkin.
the class ITTracingFilter_Consumer method setError_onUnimplemented_legacy.
/**
* Shows if you aren't using RpcTracing, the old "dubbo.error_code" works
*/
@Test
public void setError_onUnimplemented_legacy() {
((TracingFilter) ExtensionLoader.getExtensionLoader(Filter.class).getExtension("tracing")).isInit = false;
((TracingFilter) ExtensionLoader.getExtensionLoader(Filter.class).getExtension("tracing")).setTracing(tracing);
assertThatThrownBy(() -> wrongClient.get().sayHello("jorge")).isInstanceOf(RpcException.class);
MutableSpan span = testSpanHandler.takeRemoteSpanWithErrorMessage(CLIENT, ".*Not found exported service.*");
assertThat(span.tags()).containsEntry("dubbo.error_code", "1");
}
Aggregations