Search in sources :

Example 21 with Span

use of zipkin2.proto3.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();
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 22 with Span

use of zipkin2.proto3.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");
}
Also used : Span(zipkin2.Span)

Example 23 with Span

use of zipkin2.proto3.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");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 24 with Span

use of zipkin2.proto3.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");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 25 with Span

use of zipkin2.proto3.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");
}
Also used : Method(java.lang.reflect.Method) Span(zipkin2.Span) HttpServerParser(brave.http.HttpServerParser) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)290 Test (org.junit.Test)203 Test (org.junit.jupiter.api.Test)69 Endpoint (zipkin2.Endpoint)62 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 ArrayList (java.util.ArrayList)29 V1Span (zipkin2.v1.V1Span)23 List (java.util.List)19 Map (java.util.Map)18 Annotation (zipkin2.Annotation)13 AggregateCall (zipkin2.internal.AggregateCall)13 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)12 IOException (java.io.IOException)10 LinkedHashMap (java.util.LinkedHashMap)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 Arrays.asList (java.util.Arrays.asList)9 Span (com.google.devtools.cloudtrace.v2.Span)8 Trace (com.google.devtools.cloudtrace.v1.Trace)7 Call (zipkin2.Call)7 Span (zipkin2.proto3.Span)7