use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method producer_duration.
@Test
public void producer_duration() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("send").kind(Kind.PRODUCER).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(51000L).build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("send").timestamp(1472470996199000L).duration(51000L).addAnnotation(1472470996199000L, "ms", FRONTEND).addAnnotation(1472470996250000L, "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 noAnnotationsExceptAddresses.
@Test
public void noAnnotationsExceptAddresses() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("get").localEndpoint(FRONTEND).remoteEndpoint(BACKEND).timestamp(1472470996199000L).duration(207000L).build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addBinaryAnnotation("lc", "", 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 ITSpanConsumer method insertEntry_niceToString.
/**
* It is easier to use a real Cassandra connection than mock a prepared statement.
*/
@Test
public void insertEntry_niceToString() {
// This test can use fake data as it is never written to cassandra
Span clientSpan = CLIENT_SPAN;
AggregateCall<?, ?> acceptCall = (AggregateCall<?, ?>) storage.spanConsumer().accept(asList(clientSpan));
List<Call<?>> insertEntryCalls = acceptCall.delegate().stream().filter(c -> c instanceof InsertEntry).collect(Collectors.toList());
assertThat(insertEntryCalls.get(0)).hasToString("INSERT INTO span_by_service (service, span) VALUES (frontend,get)");
assertThat(insertEntryCalls.get(1)).hasToString("INSERT INTO remote_service_by_service (service, remote_service) VALUES (frontend,backend)");
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method dataMissingEndpointGoesOnFirstSpan.
@Test
public void dataMissingEndpointGoesOnFirstSpan() {
V1Span v1 = V1Span.newBuilder().traceId(1).id(2).name("missing").addAnnotation(1472470996199000L, "foo", FRONTEND).addAnnotation(1472470996238000L, "bar", FRONTEND).addAnnotation(1472470996250000L, "baz", BACKEND).addAnnotation(1472470996350000L, "qux", BACKEND).addAnnotation(1472470996403000L, "missing", null).addBinaryAnnotation("foo", "bar", FRONTEND).addBinaryAnnotation("baz", "qux", BACKEND).addBinaryAnnotation("missing", "", null).build();
Span.Builder newBuilder = Span.newBuilder().traceId("1").id("2").name("missing");
Span first = newBuilder.clone().localEndpoint(FRONTEND).addAnnotation(1472470996199000L, "foo").addAnnotation(1472470996238000L, "bar").addAnnotation(1472470996403000L, "missing").putTag("foo", "bar").putTag("missing", "").build();
Span second = newBuilder.clone().localEndpoint(BACKEND).addAnnotation(1472470996250000L, "baz").addAnnotation(1472470996350000L, "qux").putTag("baz", "qux").build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(first, second);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method producerAndConsumer_loopback_shared.
/**
* shared v1 IDs for messaging spans isn't supported, but shouldn't break
*/
@Test
public void producerAndConsumer_loopback_shared() {
V1Span v1 = V1Span.newBuilder().traceId(1).parentId(2).id(3).name("message").addAnnotation(1472470996199000L, "ms", FRONTEND).addAnnotation(1472470996238000L, "ws", FRONTEND).addAnnotation(1472470996403000L, "wr", FRONTEND).addAnnotation(1472470996406000L, "mr", FRONTEND).build();
Span.Builder newBuilder = Span.newBuilder().traceId("1").parentId("2").id("3").name("message");
Span producer = newBuilder.clone().kind(Kind.PRODUCER).localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(1472470996238000L - 1472470996199000L).build();
Span consumer = newBuilder.clone().kind(Kind.CONSUMER).shared(true).localEndpoint(FRONTEND).timestamp(1472470996403000L).duration(1472470996406000L - 1472470996403000L).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(producer, consumer);
}
Aggregations