use of zipkin.Endpoint in project zipkin by openzipkin.
the class DependenciesTest method notInstrumentedClientAndServer.
/**
* This test confirms that the span store can detect dependency indicated by SERVER_ADDR and
* CLIENT_ADDR. In some cases an RPC call is made where one of the two services is not
* instrumented. However, if the other service is able to emit "sa" or "ca" annotation with a
* service name, the link can still be constructed.
*
* span1: CA SR SS: Dependency 1 by a not-instrumented client span2: intermediate call span3: CS
* CR SA: Dependency 2 to a not-instrumented server
*/
@Test
public void notInstrumentedClientAndServer() {
Endpoint someClient = Endpoint.create("some-client", 172 << 24 | 17 << 16 | 4);
List<Span> trace = asList(Span.builder().traceId(20L).id(20L).name("get").timestamp(TODAY * 1000).duration(350L * 1000).addAnnotation(Annotation.create(TODAY * 1000, SERVER_RECV, WEB_ENDPOINT)).addAnnotation(Annotation.create((TODAY + 350) * 1000, SERVER_SEND, WEB_ENDPOINT)).addBinaryAnnotation(BinaryAnnotation.address(CLIENT_ADDR, someClient)).build(), Span.builder().traceId(20L).parentId(20L).id(21L).name("get").timestamp((TODAY + 50L) * 1000).duration(250L * 1000).addAnnotation(Annotation.create((TODAY + 50) * 1000, CLIENT_SEND, WEB_ENDPOINT)).addAnnotation(Annotation.create((TODAY + 100) * 1000, SERVER_RECV, APP_ENDPOINT)).addAnnotation(Annotation.create((TODAY + 250) * 1000, SERVER_SEND, APP_ENDPOINT)).addAnnotation(Annotation.create((TODAY + 300) * 1000, CLIENT_RECV, WEB_ENDPOINT)).build(), Span.builder().traceId(20L).parentId(21L).id(22L).name("get").timestamp((TODAY + 150L) * 1000).duration(50L * 1000).addAnnotation(Annotation.create((TODAY + 150) * 1000, CLIENT_SEND, APP_ENDPOINT)).addAnnotation(Annotation.create((TODAY + 200) * 1000, CLIENT_RECV, APP_ENDPOINT)).addBinaryAnnotation(BinaryAnnotation.address(CLIENT_ADDR, APP_ENDPOINT)).addBinaryAnnotation(BinaryAnnotation.address(SERVER_ADDR, DB_ENDPOINT)).build());
processDependencies(trace);
assertThat(store().getDependencies(TODAY + 1000L, null)).containsOnly(DependencyLink.create("some-client", "web", 1), DependencyLink.create("web", "app", 1), DependencyLink.create("app", "db", 1));
}
use of zipkin.Endpoint in project zipkin by openzipkin.
the class CorrectForClockSkewTest method childSpan.
static Span childSpan(Span parent, Endpoint to, long begin, long duration, long skew) {
long spanId = parent.id + 1;
Endpoint from = parent.annotations.get(0).endpoint;
long networkLatency = 10L;
return Span.builder().traceId(parent.traceId).id(spanId).parentId(parent.id).name("span" + spanId).timestamp(begin).addAnnotation(Annotation.create(begin, CLIENT_SEND, from)).addAnnotation(Annotation.create(begin + skew + networkLatency, SERVER_RECV, to)).addAnnotation(Annotation.create(begin + skew + duration - networkLatency, SERVER_SEND, to)).addAnnotation(Annotation.create(begin + duration, CLIENT_RECV, from)).build();
}
use of zipkin.Endpoint in project zipkin by openzipkin.
the class CorrectForClockSkewTest method ipsMatch_falseWhenIpv6Different.
@Test
public void ipsMatch_falseWhenIpv6Different() throws UnknownHostException {
Endpoint different = ipv6.toBuilder().ipv6(Inet6Address.getByName("2001:db8::c002").getAddress()).build();
assertFalse(ipsMatch(different, ipv6));
assertFalse(ipsMatch(ipv6, different));
}
use of zipkin.Endpoint in project zipkin by openzipkin.
the class CorrectForClockSkewTest method ipsMatch_falseWhenNoIp.
@Test
public void ipsMatch_falseWhenNoIp() {
Endpoint noIp = Endpoint.builder().serviceName("foo").build();
assertFalse(ipsMatch(noIp, ipv4));
assertFalse(ipsMatch(noIp, ipv6));
assertFalse(ipsMatch(ipv4, noIp));
assertFalse(ipsMatch(ipv6, noIp));
}
Aggregations