Search in sources :

Example 76 with Span

use of com.google.devtools.cloudtrace.v2.Span 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 77 with Span

use of com.google.devtools.cloudtrace.v2.Span 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)

Example 78 with Span

use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.

the class InMemoryStorageTest method getSpanNames_skipsNullSpanName.

@Test
public void getSpanNames_skipsNullSpanName() throws IOException {
    Span span1 = Span.newBuilder().traceId("1").id("1").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
    Span span2 = Span.newBuilder().traceId("1").parentId("1").id("2").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).timestamp(TODAY * 1000).build();
    storage.accept(asList(span1, span2)).execute();
    assertThat(storage.getSpanNames("app").execute()).containsOnly("root");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 79 with Span

use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.

the class InMemoryStorageTest method getTagsAndThenValues.

@Test
public void getTagsAndThenValues() throws IOException {
    Span span1 = Span.newBuilder().traceId("1").id("1").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).putTag("environment", "dev").putTag("http.method", "GET").timestamp(TODAY * 1000).build();
    Span span2 = Span.newBuilder().traceId("1").parentId("1").id("2").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).putTag("environment", "dev").putTag("http.method", "POST").putTag("http.path", "/users").timestamp(TODAY * 1000).build();
    Span span3 = Span.newBuilder().traceId("2").id("3").name("root").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).putTag("environment", "dev").putTag("http.method", "GET").timestamp(TODAY * 1000).build();
    Span span4 = Span.newBuilder().traceId("2").parentId("3").id("4").localEndpoint(Endpoint.newBuilder().serviceName("app").build()).putTag("environment", "dev").putTag("http.method", "POST").putTag("http.path", "/users").timestamp(TODAY * 1000).build();
    storage.accept(asList(span1, span2, span3, span4)).execute();
    assertThat(storage.getKeys().execute()).containsOnlyOnce("http.path");
    assertThat(storage.getValues("http.path").execute()).containsOnlyOnce("/users");
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Example 80 with Span

use of com.google.devtools.cloudtrace.v2.Span in project zipkin by openzipkin.

the class SpanNodeTest method build_headless.

@Test
public void build_headless() {
    Span s2 = Span.newBuilder().traceId("a").parentId("a").id("b").name("s2").build();
    Span s3 = Span.newBuilder().traceId("a").parentId("a").id("c").name("s3").build();
    Span s4 = Span.newBuilder().traceId("a").parentId("a").id("d").name("s4").build();
    SpanNode root = new SpanNode.Builder(logger).build(asList(s2, s3, s4));
    assertThat(root.span()).isNull();
    assertThat(root.children()).extracting(SpanNode::span).containsExactly(s2, s3, s4);
    assertThat(messages).containsExactly("building trace tree: traceId=000000000000000a", "substituting dummy node for missing root span: traceId=000000000000000a");
}
Also used : 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