Search in sources :

Example 21 with FRONTEND

use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.

the class ITDependencies method oneway.

/**
 * Span starts on one host and ends on the other. In both cases, a response is neither sent nor
 * received.
 */
@Test
protected void oneway(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").timestamp((TODAY + 50) * 1000).kind(Kind.CLIENT).localEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).id("10").shared(true).timestamp((TODAY + 100) * 1000).kind(Kind.SERVER).localEndpoint(backend).build());
    processDependencies(trace);
    assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
Also used : Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) V1Span(zipkin2.v1.V1Span) Test(org.junit.jupiter.api.Test)

Example 22 with FRONTEND

use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.

the class ITDependencies method instrumentedClientAndServer.

@Test
protected void instrumentedClientAndServer(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    Endpoint db = suffixServiceName(TestObjects.DB, testSuffix);
    List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").name("get").timestamp((TODAY + 50L) * 1000L).duration(250L * 1000L).kind(Kind.CLIENT).localEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).id("10").name("get").shared(true).timestamp((TODAY + 100) * 1000L).duration(150L * 1000L).kind(Kind.SERVER).localEndpoint(backend).build(), Span.newBuilder().traceId(traceId).parentId("10").id("11").name("get").timestamp((TODAY + 150L) * 1000L).duration(50L * 1000L).kind(Kind.CLIENT).localEndpoint(backend).remoteEndpoint(db).build());
    processDependencies(trace);
    assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(backend.serviceName()).child(db.serviceName()).callCount(1).build());
}
Also used : Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) V1Span(zipkin2.v1.V1Span) Test(org.junit.jupiter.api.Test)

Example 23 with FRONTEND

use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.

the class ITDependencies method spanKindIsNotRequiredWhenEndpointsArePresent.

@Test
protected void spanKindIsNotRequiredWhenEndpointsArePresent(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint kafka = suffixServiceName(TestObjects.KAFKA, testSuffix);
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    Endpoint db = suffixServiceName(TestObjects.DB, testSuffix);
    List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("20").name("get").timestamp(TODAY * 1000L).duration(350L * 1000L).localEndpoint(kafka).remoteEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).parentId("20").id("21").name("get").timestamp((TODAY + 50) * 1000L).duration(250L * 1000L).localEndpoint(frontend).remoteEndpoint(backend).build(), Span.newBuilder().traceId(traceId).parentId("21").id("22").name("get").timestamp((TODAY + 150) * 1000L).duration(50L * 1000L).localEndpoint(backend).remoteEndpoint(db).build());
    processDependencies(trace);
    assertThat(store().getDependencies(TODAY + 1000, 1000L).execute()).containsOnly(DependencyLink.newBuilder().parent(kafka.serviceName()).child(frontend.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(backend.serviceName()).child(db.serviceName()).callCount(1).build());
}
Also used : Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) V1Span(zipkin2.v1.V1Span) Test(org.junit.jupiter.api.Test)

Example 24 with FRONTEND

use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.

the class ITDependencies method duplicateAddress.

/**
 * This test confirms that the span store can process trace with intermediate spans like the below
 * properly.
 * <p>
 * span1: SR SS span2: intermediate call span3: CS SR SS CR: Dependency 1
 */
@Test
protected void duplicateAddress(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    V1SpanConverter converter = V1SpanConverter.create();
    List<Span> trace = new ArrayList<>();
    converter.convert(V1Span.newBuilder().traceId(traceId).id("20").name("get").timestamp(TODAY * 1000L).duration(350L * 1000L).addAnnotation(TODAY * 1000, "sr", frontend).addAnnotation((TODAY + 350) * 1000, "ss", frontend).addBinaryAnnotation("ca", frontend).addBinaryAnnotation("sa", frontend).build(), trace);
    converter.convert(V1Span.newBuilder().traceId(traceId).parentId("21").id("22").name("get").timestamp((TODAY + 50) * 1000L).duration(250L * 1000L).addAnnotation((TODAY + 50) * 1000, "cs", frontend).addAnnotation((TODAY + 300) * 1000, "cr", frontend).addBinaryAnnotation("ca", backend).addBinaryAnnotation("sa", backend).build(), trace);
    processDependencies(trace);
    assertThat(store().getDependencies(TODAY + 1000, 1000L).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
Also used : Endpoint(zipkin2.Endpoint) V1SpanConverter(zipkin2.v1.V1SpanConverter) ArrayList(java.util.ArrayList) Span(zipkin2.Span) V1Span(zipkin2.v1.V1Span) Test(org.junit.jupiter.api.Test)

Example 25 with FRONTEND

use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.

the class ITSpanStore method getTraces_considersBitsAbove64bit.

@Test
protected void getTraces_considersBitsAbove64bit(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    // 64-bit trace ID
    Span span1 = Span.newBuilder().traceId(traceId.substring(16)).id("1").putTag("foo", "1").timestamp(TODAY * 1000L).localEndpoint(frontend).build();
    // 128-bit trace ID prefixed by above
    Span span2 = span1.toBuilder().traceId(traceId).putTag("foo", "2").build();
    // Different 128-bit trace ID prefixed by above
    Span span3 = span1.toBuilder().traceId("1" + span1.traceId()).putTag("foo", "3").build();
    accept(span1, span2, span3);
    for (Span span : Arrays.asList(span1, span2, span3)) {
        assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("foo=" + span.tags().get("foo")).build(), asList(span));
    }
}
Also used : Endpoint(zipkin2.Endpoint) TestObjects.newClientSpan(zipkin2.TestObjects.newClientSpan) Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Aggregations

Span (zipkin2.Span)50 Test (org.junit.Test)35 Endpoint (zipkin2.Endpoint)21 Test (org.junit.jupiter.api.Test)17 V1Span (zipkin2.v1.V1Span)12 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)6 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)4 SpanSampler (com.wavefront.agent.sampler.SpanSampler)4 ByteBuf (io.netty.buffer.ByteBuf)4 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)4 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)4 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)4 Span (wavefront.report.Span)4 SpanBytesEncoder (zipkin2.codec.SpanBytesEncoder)4 Annotation (wavefront.report.Annotation)3 DurationSampler (com.wavefront.sdk.entities.tracing.sampling.DurationSampler)2 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)2 ArrayList (java.util.ArrayList)2 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2