Search in sources :

Example 71 with Span

use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.

the class BulkIndexWriterTest method spanSearchFields_addsTimestampFieldWhenNoTags.

@Test
public void spanSearchFields_addsTimestampFieldWhenNoTags() {
    Span span = Span.newBuilder().traceId("20").id("22").name("").parentId("21").timestamp(1000L).localEndpoint(FRONTEND).kind(Kind.CLIENT).build();
    BulkIndexWriter.SPAN.writeDocument(span, buffer);
    assertThat(buffer.buffer().toString(StandardCharsets.UTF_8)).startsWith("{\"timestamp_millis\":1,\"traceId\":");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 72 with Span

use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.

the class BulkIndexWriterTest method spanSearchFields_addsQueryFieldForTags.

@Test
public void spanSearchFields_addsQueryFieldForTags() {
    Span span = Span.newBuilder().traceId("20").id("22").parentId("21").localEndpoint(FRONTEND).putTag("\"foo", "\"bar").build();
    BulkIndexWriter.SPAN.writeDocument(span, buffer);
    assertThat(buffer.buffer().toString(StandardCharsets.UTF_8)).startsWith("{\"_q\":[\"\\\"foo\",\"\\\"foo=\\\"bar\"],\"traceId");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 73 with Span

use of io.opencensus.proto.trace.v1.Span 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 74 with Span

use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.

the class BulkIndexWriterTest method spanSearchFields_addsQueryFieldForAnnotations.

@Test
public void spanSearchFields_addsQueryFieldForAnnotations() {
    Span span = Span.newBuilder().traceId("20").id("22").name("").parentId("21").localEndpoint(FRONTEND).addAnnotation(1L, "\"foo").build();
    BulkIndexWriter.SPAN.writeDocument(span, buffer);
    assertThat(buffer.buffer().toString(StandardCharsets.UTF_8)).startsWith("{\"_q\":[\"\\\"foo\"],\"traceId");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 75 with Span

use of io.opencensus.proto.trace.v1.Span in project zipkin by openzipkin.

the class CassandraSpanConsumerTest method serviceSpanKeys.

@Test
public void serviceSpanKeys() {
    Span span = spanWithoutAnnotationsOrTags;
    AggregateCall<?, Void> call = (AggregateCall<?, Void>) consumer.accept(singletonList(span));
    assertThat(call.delegate()).filteredOn(c -> c instanceof InsertEntry).extracting("input").containsExactly(entry(FRONTEND.serviceName(), span.name()));
}
Also used : AggregateCall(zipkin2.internal.AggregateCall) InsertEntry(zipkin2.storage.cassandra.internal.call.InsertEntry) Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)290 Test (org.junit.Test)192 Test (org.junit.jupiter.api.Test)67 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 Endpoint (zipkin2.Endpoint)37 ArrayList (java.util.ArrayList)24 V1Span (zipkin2.v1.V1Span)17 List (java.util.List)14 AggregateCall (zipkin2.internal.AggregateCall)13 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)12 Arrays.asList (java.util.Arrays.asList)9 Map (java.util.Map)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 Span (com.google.devtools.cloudtrace.v2.Span)8 LinkedHashMap (java.util.LinkedHashMap)8 Trace (com.google.devtools.cloudtrace.v1.Trace)7 Span (zipkin2.proto3.Span)7 SpanData (io.opencensus.trace.export.SpanData)6 SpanCustomizer (brave.SpanCustomizer)5 IOException (java.io.IOException)5