use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITHttpServer method reportsClientAddress.
@Test
public void reportsClientAddress() throws Exception {
get("/foo");
Span span = takeSpan();
assertThat(span.remoteEndpoint()).isNotNull();
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITHttpServer method addsErrorTagOnException.
private void addsErrorTagOnException(String path) throws Exception {
Span span = reportsSpanOnException(path);
assertThat(span.tags()).containsKey("error");
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITHttpServer method addsStatusCode_badRequest.
@Test
public void addsStatusCode_badRequest() throws Exception {
try {
get("/badrequest");
} catch (RuntimeException e) {
// some servers think 400 is an error
}
Span span = takeSpan();
assertThat(span.tags()).containsEntry("http.status_code", "400").containsEntry("error", "400");
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITServlet25Container method canUseSpanAttribute.
/**
* Shows that a framework can directly use the "brave.Span" rather than relying on the
* current span.
*/
@Test
public void canUseSpanAttribute() throws Exception {
delegate = customHook;
get("/foo");
Span span = takeSpan();
assertThat(span.tags()).containsEntry("foo", "bar");
}
use of io.opencensus.proto.trace.v1.Span in project brave by openzipkin.
the class ITTracingFeature_Container method declarative_namingPolicy.
@Test
public void declarative_namingPolicy() throws Exception {
httpTracing = httpTracing.toBuilder().serverParser(new HttpServerParser() {
@Override
public <Req> String spanName(HttpAdapter<Req, ?> adapter, Req req) {
Method method = ((ContainerAdapter) adapter).resourceMethod(req);
return method.getName().toLowerCase();
}
}).build();
init();
get("/foo");
Span span = takeSpan();
assertThat(span.name()).isEqualTo("foo");
}
Aggregations