use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method clientAndServer_loopback.
@Test
public void clientAndServer_loopback() {
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996250000L, "sr", FRONTEND).addAnnotation(1472470996350000L, "ss", FRONTEND).addAnnotation(1472470996406000L, "cr", FRONTEND).build();
Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("get");
Span clientV2 = newBuilder.clone().kind(Kind.CLIENT).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
Span serverV2 = newBuilder.clone().kind(Kind.SERVER).shared(true).localEndpoint(FRONTEND).timestamp(1472470996250000L).duration(100000L).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(clientV2, serverV2);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method client_unfinished.
@Test
public void client_unfinished() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").kind(Kind.CLIENT).localEndpoint(FRONTEND).timestamp(1472470996199000L).addAnnotation(1472470996238000L, "ws").build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996238000L, "ws", FRONTEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method client.
@Test
public void client() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").kind(Kind.CLIENT).localEndpoint(FRONTEND).remoteEndpoint(BACKEND).timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996238000L, "ws").addAnnotation(1472470996403000L, "wr").putTag("http.path", "/api").putTag("clnt/finagle.version", "6.45.0").build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "cs", FRONTEND).addAnnotation(1472470996238000L, "ws", // ts order retained
FRONTEND).addAnnotation(1472470996403000L, "wr", FRONTEND).addAnnotation(1472470996406000L, "cr", FRONTEND).addBinaryAnnotation("http.path", "/api", FRONTEND).addBinaryAnnotation("clnt/finagle.version", "6.45.0", FRONTEND).addBinaryAnnotation("sa", BACKEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method producerAndConsumer.
/**
* shared v1 IDs for messaging spans isn't supported, but shouldn't break
*/
@Test
public void producerAndConsumer() {
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("whatev").addAnnotation(1472470996199000L, "ms", FRONTEND).addAnnotation(1472470996238000L, "ws", FRONTEND).addAnnotation(1472470996403000L, "wr", BACKEND).addAnnotation(1472470996406000L, "mr", BACKEND).addBinaryAnnotation("ma", kafka).build();
Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("whatev");
Span producer = newBuilder.clone().kind(Kind.PRODUCER).localEndpoint(FRONTEND).remoteEndpoint(kafka).timestamp(1472470996199000L).duration(1472470996238000L - 1472470996199000L).build();
Span consumer = newBuilder.clone().kind(Kind.CONSUMER).shared(true).localEndpoint(BACKEND).remoteEndpoint(kafka).timestamp(1472470996403000L).duration(1472470996406000L - 1472470996403000L).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(producer, consumer);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method producer.
@Test
public void producer() {
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("send").addAnnotation(1472470996199000L, "ms", FRONTEND).build();
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("send").kind(Kind.PRODUCER).localEndpoint(FRONTEND).timestamp(1472470996199000L).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Aggregations