Search in sources :

Example 11 with SERVER

use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.

the class KryoTest method kryoJavaSerialization_dependencyLink.

@Test
public void kryoJavaSerialization_dependencyLink() {
    Kryo kryo = new Kryo();
    kryo.register(DependencyLink.class, new JavaSerializer());
    DependencyLink link = DependencyLink.newBuilder().parent("client").child("server").callCount(2L).errorCount(23L).build();
    Output output = new Output(4096);
    kryo.writeObject(output, link);
    output.flush();
    byte[] serialized = output.getBuffer();
    assertThat(kryo.readObject(new Input(serialized), DependencyLink.class)).isEqualTo(link);
}
Also used : Input(com.esotericsoftware.kryo.io.Input) Output(com.esotericsoftware.kryo.io.Output) DependencyLink(zipkin2.DependencyLink) JavaSerializer(com.esotericsoftware.kryo.serializers.JavaSerializer) Kryo(com.esotericsoftware.kryo.Kryo) Test(org.junit.Test)

Example 12 with SERVER

use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.

the class SpanConverterTest method server.

@Test
public void server() {
    Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).putTag("http.path", "/api").putTag("finagle.version", "6.45.0").build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", BACKEND).addAnnotation(1472470996406000L, "ss", BACKEND).addBinaryAnnotation("http.path", "/api", BACKEND).addBinaryAnnotation("finagle.version", "6.45.0", BACKEND).addBinaryAnnotation("ca", FRONTEND).build();
    assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 13 with SERVER

use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.

the class Trace method compareEndpoint.

/**
 * Put spans with null endpoints first, so that their data can be attached to the first span with
 * the same ID and endpoint. It is possible that a server can get the same request on a different
 * port. Not addressing this.
 */
static int compareEndpoint(Endpoint left, Endpoint right) {
    if (left == null) {
        // nulls first
        return (right == null) ? 0 : -1;
    } else if (right == null) {
        return 1;
    }
    int byService = nullSafeCompareTo(left.serviceName(), right.serviceName(), false);
    if (byService != 0)
        return byService;
    int byIpV4 = nullSafeCompareTo(left.ipv4(), right.ipv4(), false);
    if (byIpV4 != 0)
        return byIpV4;
    return nullSafeCompareTo(left.ipv6(), right.ipv6(), false);
}
Also used : Endpoint(zipkin2.Endpoint)

Example 14 with SERVER

use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.

the class SpanConverterTest method redundantServiceNameOnAddressAnnotations_server.

/**
 * On server spans, ignore service name on remote address binary annotation that appear loopback
 * based on the service name. This could happen when finagle service labels are used incorrectly,
 * which as common in early instrumentation.
 *
 * <p>This prevents an uncorrectable scenario which results in extra (loopback) links on server
 * spans.
 */
@Test
public void redundantServiceNameOnAddressAnnotations_server() {
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").kind(Kind.SERVER).name("get").localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
    V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", FRONTEND).addAnnotation(1472470996406000L, "ss", FRONTEND).addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", FRONTEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 15 with SERVER

use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.

the class ITElasticsearchClientInitialization method doesntHangWhenAllDown.

/**
 * blocking a little is ok, but blocking forever is not.
 */
@Test(timeout = 3000L)
public void doesntHangWhenAllDown() throws IOException {
    TestPropertyValues.of("spring.config.name=zipkin-server", "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.timeout:1000", "zipkin.storage.elasticsearch.hosts:127.0.0.1:1234,127.0.0.1:5678").applyTo(context);
    Access.registerElasticsearch(context);
    context.refresh();
    try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
        CheckResult result = storage.check();
        assertThat(result.ok()).isFalse();
    }
}
Also used : ElasticsearchStorage(zipkin2.elasticsearch.ElasticsearchStorage) CheckResult(zipkin2.CheckResult) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)36 Test (org.junit.Test)31 Endpoint (zipkin2.Endpoint)17 Test (org.junit.jupiter.api.Test)9 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)7 Trace (com.google.devtools.cloudtrace.v1.Trace)5 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 Span (wavefront.report.Span)5 Task (io.crnk.monitor.brave.mock.models.Task)4 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)4 SpanBytesEncoder (zipkin2.codec.SpanBytesEncoder)4 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)3 Annotation (wavefront.report.Annotation)3 ElasticsearchStorage (zipkin2.elasticsearch.ElasticsearchStorage)3 V1Span (zipkin2.v1.V1Span)3