Search in sources :

Example 1 with TODAY

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

the class CassandraSpanConsumerTest method doesntIndexWhenOnlyIncludesTimestamp.

@Test
public void doesntIndexWhenOnlyIncludesTimestamp() {
    Span span = Span.newBuilder().traceId("a").id("1").timestamp(TODAY * 1000L).build();
    assertThat(consumer.accept(singletonList(span))).isInstanceOf(ResultSetFutureCall.class);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 2 with TODAY

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

the class ElasticsearchSpanConsumerTest method addsTimestamp_millisIntoJson.

@Test
void addsTimestamp_millisIntoJson() throws Exception {
    server.enqueue(SUCCESS_RESPONSE);
    Span span = Span.newBuilder().traceId("20").id("20").name("get").timestamp(TODAY * 1000).build();
    accept(span);
    assertThat(server.takeRequest().request().contentUtf8()).contains("\n{\"timestamp_millis\":" + TODAY + ",\"traceId\":");
}
Also used : Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Example 3 with TODAY

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

the class BulkIndexWriterTest method spanSearchFields_readableByNormalJsonCodec.

@Test
public void spanSearchFields_readableByNormalJsonCodec() {
    Span span = Span.newBuilder().traceId("20").id("20").name("get").timestamp(TODAY * 1000).build();
    BulkIndexWriter.SPAN.writeDocument(span, buffer);
    assertThat(SpanBytesDecoder.JSON_V2.decodeOne(ByteBufUtil.getBytes(buffer.buffer()))).isEqualTo(// ignores timestamp_millis field
    span);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 4 with TODAY

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

the class InMemoryStorageTest method getTraces_byTraceIds.

@Test
public void getTraces_byTraceIds() throws IOException {
    Span trace1Span1 = Span.newBuilder().traceId("1").id("1").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
    Span trace1Span2 = Span.newBuilder().traceId("1").parentId("1").id("2").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
    Span trace2Span1 = Span.newBuilder().traceId("2").id("1").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
    Span trace2Span2 = Span.newBuilder().traceId("2").parentId("1").id("2").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
    storage.accept(asList(trace1Span1, trace1Span2, trace2Span1, trace2Span2)).execute();
    assertThat(storage.getTraces(asList("1", "2")).execute()).containsExactly(asList(trace1Span1, trace1Span2), asList(trace2Span1, trace2Span2));
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 5 with TODAY

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

the class InMemoryStorageTest method replayOverwrites.

/**
 * It should be safe to run dependency link jobs twice
 */
@Test
public void replayOverwrites() throws IOException {
    Span span = Span.newBuilder().traceId("10").id("10").name("receive").kind(Span.Kind.CONSUMER).localEndpoint(Endpoint.newBuilder().serviceName("app").build()).remoteEndpoint(Endpoint.newBuilder().serviceName("kafka").build()).timestamp(TODAY * 1000).build();
    storage.accept(asList(span)).execute();
    storage.accept(asList(span)).execute();
    assertThat(storage.getDependencies(TODAY + 1000L, TODAY).execute()).containsOnly(DependencyLink.newBuilder().parent("kafka").child("app").callCount(1L).build());
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)38 Test (org.junit.jupiter.api.Test)28 Endpoint (zipkin2.Endpoint)20 V1Span (zipkin2.v1.V1Span)13 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)10 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)3 Map (java.util.Map)2 QueryRequest (zipkin2.storage.QueryRequest)2 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 Request (okhttp3.Request)1 Response (okhttp3.Response)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 DependencyLink (zipkin2.DependencyLink)1 SpanBytesEncoder (zipkin2.codec.SpanBytesEncoder)1 V1SpanConverter (zipkin2.v1.V1SpanConverter)1