Search in sources :

Example 1 with FRONTEND

use of zipkin2.TestObjects.FRONTEND in project zipkin-gcp by openzipkin.

the class SpanTranslatorTest method translate_clientSpan.

/**
 * This test is intentionally sensitive, so changing other parts makes obvious impact here
 */
@Test
public void translate_clientSpan() {
    Span zipkinSpan = Span.newBuilder().traceId("7180c278b62e8f6a216a2aea45d08fc9").parentId("6b221d5bc9e6496c").id("5b4185666d50f68b").name("get").kind(Span.Kind.CLIENT).localEndpoint(Endpoint.newBuilder().serviceName("frontend").build()).remoteEndpoint(Endpoint.newBuilder().serviceName("backend").ip("192.168.99.101").port(9000).build()).timestamp(// 1 second after epoch
    1_000_000L).duration(123_456L).addAnnotation(1_123_000L, "foo").putTag("http.path", "/api").putTag("clnt/finagle.version", "6.45.0").build();
    TraceSpan translated = SpanTranslator.translate(TraceSpan.newBuilder(), zipkinSpan).build();
    assertThat(translated).isEqualTo(TraceSpan.newBuilder().setSpanId(Long.parseUnsignedLong(zipkinSpan.id(), 16) ^ 0x3f6a2ec3c810c2abL).setParentSpanId(Long.parseUnsignedLong(zipkinSpan.parentId(), 16)).setKind(TraceSpan.SpanKind.RPC_CLIENT).setName("get").setStartTime(Timestamp.newBuilder().setSeconds(1).build()).setEndTime(Timestamp.newBuilder().setSeconds(1).setNanos(123_456_000).build()).putLabels("zipkin.io/clnt/finagle.version", "6.45.0").putLabels("zipkin.io/http.path", "/api").putLabels("/component", "frontend").putLabels("zipkin.io/foo", "1970-01-01 (00:00:01.123)").build());
}
Also used : TraceSpan(com.google.devtools.cloudtrace.v1.TraceSpan) TraceSpan(com.google.devtools.cloudtrace.v1.TraceSpan) Span(zipkin2.Span) Test(org.junit.Test)

Example 2 with FRONTEND

use of zipkin2.TestObjects.FRONTEND 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 3 with FRONTEND

use of zipkin2.TestObjects.FRONTEND 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 4 with FRONTEND

use of zipkin2.TestObjects.FRONTEND 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 5 with FRONTEND

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

the class SpanConverterTest method onlyAddressAnnotations.

@Test
public void onlyAddressAnnotations() {
    V1Span v1 = V1Span.newBuilder().traceId(1).parentId(2).id(3).name("rpc").addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", BACKEND).build();
    Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("rpc").localEndpoint(FRONTEND).remoteEndpoint(BACKEND).build();
    assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Also used : Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Span (zipkin2.Span)50 Test (org.junit.Test)35 Endpoint (zipkin2.Endpoint)21 Test (org.junit.jupiter.api.Test)17 V1Span (zipkin2.v1.V1Span)12 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)6 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)4 SpanSampler (com.wavefront.agent.sampler.SpanSampler)4 ByteBuf (io.netty.buffer.ByteBuf)4 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)4 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)4 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)4 Span (wavefront.report.Span)4 SpanBytesEncoder (zipkin2.codec.SpanBytesEncoder)4 Annotation (wavefront.report.Annotation)3 DurationSampler (com.wavefront.sdk.entities.tracing.sampling.DurationSampler)2 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)2 ArrayList (java.util.ArrayList)2 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2