Search in sources :

Example 56 with Span

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

the class ITEnsureIndexTemplate method createZipkinIndexTemplate_getTraces_returnsSuccess.

@Test
void createZipkinIndexTemplate_getTraces_returnsSuccess(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    storage = newStorageBuilder(testInfo).templatePriority(10).build();
    try {
        // Delete all templates in order to create the "catch-all" index template, because
        // ES does not allow multiple index templates of the same index_patterns and priority
        http(DELETE, "/_template/*");
        setUpCatchAllTemplate();
        // Implicitly creates an index template
        checkStorage();
        // Get all templates. We don't assert on this at the moment. This is for logging on ES_DEBUG.
        http(GET, "/_template");
        // Now, add a span, which should be indexed differently than default.
        Span span = spanBuilder(testSuffix).putTag("queryTest", "ok").build();
        accept(asList(span));
        // Assert that Zipkin's templates work and source is returned
        assertGetTracesReturns(requestBuilder().parseAnnotationQuery("queryTest=" + span.tags().get("queryTest")).build(), asList(span));
    } finally {
        // Delete "catch-all" index template so it does not interfere with any other test
        http(DELETE, catchAllIndexPath());
    }
}
Also used : Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Example 57 with Span

use of io.opentelemetry.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 58 with Span

use of io.opentelemetry.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 59 with Span

use of io.opentelemetry.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 60 with Span

use of io.opentelemetry.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)

Aggregations

Span (zipkin2.Span)335 Test (org.junit.Test)237 Test (org.junit.jupiter.api.Test)84 ArrayList (java.util.ArrayList)47 Endpoint (zipkin2.Endpoint)43 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)41 Span (io.opentelemetry.proto.trace.v1.Span)35 List (java.util.List)23 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)20 V1Span (zipkin2.v1.V1Span)17 Span (com.google.devtools.cloudtrace.v2.Span)16 Map (java.util.Map)14 AggregateCall (zipkin2.internal.AggregateCall)13 ResourceSpans (io.opentelemetry.proto.trace.v1.ResourceSpans)11 Arrays.asList (java.util.Arrays.asList)11 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)11 Annotation (wavefront.report.Annotation)11 Trace (com.google.devtools.cloudtrace.v1.Trace)10 TraceSpan (com.google.devtools.cloudtrace.v1.TraceSpan)10 AttributeValue (com.google.devtools.cloudtrace.v2.AttributeValue)10