Search in sources :

Example 21 with Endpoint

use of org.jboss.remoting3.Endpoint 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 22 with Endpoint

use of org.jboss.remoting3.Endpoint in project zipkin by openzipkin.

the class ITDependencies method oneway_noClient.

/**
 * Async span starts from an uninstrumented source.
 */
@Test
protected void oneway_noClient(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    Endpoint kafka = suffixServiceName(TestObjects.KAFKA, testSuffix);
    List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").name("receive").timestamp(TODAY * 1000).kind(Kind.SERVER).localEndpoint(backend).remoteEndpoint(kafka).build(), Span.newBuilder().traceId(traceId).parentId("10").id("11").name("process").timestamp((TODAY + 25) * 1000L).duration(325L * 1000L).localEndpoint(backend).build());
    processDependencies(trace);
    assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(kafka.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 23 with Endpoint

use of org.jboss.remoting3.Endpoint 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 24 with Endpoint

use of org.jboss.remoting3.Endpoint 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)

Example 25 with Endpoint

use of org.jboss.remoting3.Endpoint in project zipkin by openzipkin.

the class ITSpanStore method getTraces_differentiateOnServiceName.

/**
 * This test makes sure that annotation queries pay attention to which host recorded data
 */
@Test
protected void getTraces_differentiateOnServiceName(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    Span trace1 = Span.newBuilder().traceId(newTraceId()).name("1").id(1).kind(CLIENT).timestamp((TODAY + 1) * 1000L).duration(3000L).localEndpoint(frontend).addAnnotation(((TODAY + 1) * 1000L) + 500, "web").putTag("local", "web").putTag("web-b", "web").build();
    Span trace1Server = Span.newBuilder().traceId(trace1.traceId()).name("1").id(1).kind(SERVER).shared(true).localEndpoint(backend).timestamp((TODAY + 2) * 1000L).duration(1000L).build();
    Span trace2 = Span.newBuilder().traceId(newTraceId()).name("2").id(2).timestamp((TODAY + 11) * 1000L).duration(3000L).kind(CLIENT).localEndpoint(backend).addAnnotation(((TODAY + 11) * 1000) + 500, "app").putTag("local", "app").putTag("app-b", "app").build();
    Span trace2Server = Span.newBuilder().traceId(trace2.traceId()).name("2").id(2).shared(true).kind(SERVER).localEndpoint(frontend).timestamp((TODAY + 12) * 1000L).duration(1000L).build();
    accept(trace1, trace1Server, trace2, trace2Server);
    // Sanity check
    assertGetTraceReturns(trace1.traceId(), asList(trace1, trace1Server));
    assertGetTraceReturns(trace2.traceId(), asList(trace2, trace2Server));
    assertGetTracesReturns(requestBuilder().build(), asList(trace1, trace1Server), asList(trace2, trace2Server));
    // We only return traces where the service specified caused the data queried.
    assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("web").build(), asList(trace1, trace1Server));
    assertGetTracesReturnsEmpty(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("web").build());
    assertGetTracesReturns(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("app").build(), asList(trace2, trace2Server));
    assertGetTracesReturnsEmpty(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("app").build());
    // tags are returned on annotation queries
    assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("web-b").build(), asList(trace1, trace1Server));
    assertGetTracesReturnsEmpty(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("web-b").build());
    assertGetTracesReturns(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("app-b").build(), asList(trace2, trace2Server));
    assertGetTracesReturnsEmpty(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("app-b").build());
    // We only return traces where the service specified caused the tag queried.
    assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("local=web").build(), asList(trace1, trace1Server));
    assertGetTracesReturnsEmpty(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("local=web").build());
    assertGetTracesReturns(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("local=app").build(), asList(trace2, trace2Server));
    assertGetTracesReturnsEmpty(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("local=app").build());
}
Also used : Endpoint(zipkin2.Endpoint) TestObjects.newClientSpan(zipkin2.TestObjects.newClientSpan) Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Aggregations

Endpoint (zipkin2.Endpoint)60 Span (zipkin2.Span)27 Test (org.junit.jupiter.api.Test)18 V1Span (zipkin2.v1.V1Span)16 Test (org.junit.Test)15 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)5 SpanSampler (com.wavefront.agent.sampler.SpanSampler)5 ByteBuf (io.netty.buffer.ByteBuf)5 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)5 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)5 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)5 ArrayList (java.util.ArrayList)5 Span (wavefront.report.Span)5 Endpoint (org.apache.woden.wsdl20.Endpoint)4 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)4 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Service (org.apache.woden.wsdl20.Service)3