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());
}
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\":");
}
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");
}
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");
}
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);
}
Aggregations