use of brave.http.HttpServerParser in project brave by openzipkin.
the class ITVertxWebTracing method handlesReroute.
void handlesReroute(String path) throws Exception {
httpTracing = httpTracing.toBuilder().serverParser(new HttpServerParser() {
@Override
public <Req> void request(HttpAdapter<Req, ?> adapter, Req req, SpanCustomizer customizer) {
super.request(adapter, req, customizer);
// just the path is logged by default
customizer.tag("http.url", adapter.url(req));
}
}).build();
init();
get(path);
Span span = takeSpan();
assertThat(span.tags()).containsEntry("http.path", path).containsEntry("http.url", url(path));
}
use of brave.http.HttpServerParser 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");
}
use of brave.http.HttpServerParser in project brave by openzipkin.
the class ITHttpServer method supportsPortableCustomization.
@Test
public void supportsPortableCustomization() throws Exception {
httpTracing = httpTracing.toBuilder().serverParser(new HttpServerParser() {
@Override
public <Req> void request(HttpAdapter<Req, ?> adapter, Req req, SpanCustomizer customizer) {
// just the path is logged by default
customizer.tag("http.url", adapter.url(req));
customizer.tag("context.visible", String.valueOf(currentTraceContext.get() != null));
customizer.tag("request_customizer.is_span", (customizer instanceof brave.Span) + "");
}
@Override
public <Resp> void response(HttpAdapter<?, Resp> adapter, Resp res, Throwable error, SpanCustomizer customizer) {
super.response(adapter, res, error, customizer);
customizer.tag("response_customizer.is_span", (customizer instanceof brave.Span) + "");
}
}).build();
init();
String uri = "/foo?z=2&yAA=1";
get(uri);
Span span = takeSpan();
assertThat(span.tags()).containsEntry("http.url", url(uri)).containsEntry("context.visible", "true").containsEntry("request_customizer.is_span", "false").containsEntry("response_customizer.is_span", "false");
}
Aggregations