use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method healthCheckDisabled.
@Test
public void healthCheckDisabled() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.config.name=zipkin-server", "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.ensure-templates=false", "zipkin.storage.elasticsearch.timeout=200", "zipkin.storage.elasticsearch.health-check.enabled=false", "zipkin.storage.elasticsearch.health-check.interval=100ms", "zipkin.storage.elasticsearch.hosts=127.0.0.1:" + server1.httpPort() + ",127.0.0.1:" + server2.httpPort()).applyTo(context);
Access.registerElasticsearch(context);
context.refresh();
server1Health.setHealthy(false);
server2Health.setHealthy(false);
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
// Even though cluster health is false, we ignore that and continue to check index health,
// which is correctly returned by our mock server.
assertOk(storage.check());
}
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class ITDependencies method notInstrumentedClientAndServer.
/**
* This test confirms that the span store can detect dependency indicated by local and remote
* endpoint. Specifically, this detects an uninstrumented client before the trace and an
* uninstrumented server at the end of it.
*/
@Test
protected void notInstrumentedClientAndServer(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
String traceId = newTraceId();
Endpoint kafka = suffixServiceName(TestObjects.KAFKA, testSuffix);
Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
Endpoint db = suffixServiceName(TestObjects.DB, testSuffix);
List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("20").name("get").timestamp(TODAY * 1000L).duration(350L * 1000L).kind(Kind.SERVER).localEndpoint(frontend).remoteEndpoint(kafka).build(), Span.newBuilder().traceId(traceId).parentId("20").id("21").name("get").timestamp((TODAY + 50L) * 1000L).duration(250L * 1000L).kind(Kind.CLIENT).localEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).parentId("20").id("21").name("get").shared(true).timestamp((TODAY + 250) * 1000L).duration(50L * 1000L).kind(Kind.SERVER).localEndpoint(backend).build(), Span.newBuilder().traceId(traceId).parentId("21").id("22").name("get").timestamp((TODAY + 150L) * 1000L).duration(50L * 1000L).kind(Kind.CLIENT).localEndpoint(backend).remoteEndpoint(db).build());
processDependencies(trace);
assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(kafka.serviceName()).child(frontend.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build(), DependencyLink.newBuilder().parent(backend.serviceName()).child(db.serviceName()).callCount(1).build());
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class ITSpanStore method getTraces_differentiateOnServiceName.
/**
* This test makes sure that annotation queries pay attention to which host recorded data
*/
@Test
protected void getTraces_differentiateOnServiceName(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
Span trace1 = Span.newBuilder().traceId(newTraceId()).name("1").id(1).kind(CLIENT).timestamp((TODAY + 1) * 1000L).duration(3000L).localEndpoint(frontend).addAnnotation(((TODAY + 1) * 1000L) + 500, "web").putTag("local", "web").putTag("web-b", "web").build();
Span trace1Server = Span.newBuilder().traceId(trace1.traceId()).name("1").id(1).kind(SERVER).shared(true).localEndpoint(backend).timestamp((TODAY + 2) * 1000L).duration(1000L).build();
Span trace2 = Span.newBuilder().traceId(newTraceId()).name("2").id(2).timestamp((TODAY + 11) * 1000L).duration(3000L).kind(CLIENT).localEndpoint(backend).addAnnotation(((TODAY + 11) * 1000) + 500, "app").putTag("local", "app").putTag("app-b", "app").build();
Span trace2Server = Span.newBuilder().traceId(trace2.traceId()).name("2").id(2).shared(true).kind(SERVER).localEndpoint(frontend).timestamp((TODAY + 12) * 1000L).duration(1000L).build();
accept(trace1, trace1Server, trace2, trace2Server);
// Sanity check
assertGetTraceReturns(trace1.traceId(), asList(trace1, trace1Server));
assertGetTraceReturns(trace2.traceId(), asList(trace2, trace2Server));
assertGetTracesReturns(requestBuilder().build(), asList(trace1, trace1Server), asList(trace2, trace2Server));
// We only return traces where the service specified caused the data queried.
assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("web").build(), asList(trace1, trace1Server));
assertGetTracesReturnsEmpty(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("web").build());
assertGetTracesReturns(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("app").build(), asList(trace2, trace2Server));
assertGetTracesReturnsEmpty(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("app").build());
// tags are returned on annotation queries
assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("web-b").build(), asList(trace1, trace1Server));
assertGetTracesReturnsEmpty(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("web-b").build());
assertGetTracesReturns(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("app-b").build(), asList(trace2, trace2Server));
assertGetTracesReturnsEmpty(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("app-b").build());
// We only return traces where the service specified caused the tag queried.
assertGetTracesReturns(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("local=web").build(), asList(trace1, trace1Server));
assertGetTracesReturnsEmpty(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("local=web").build());
assertGetTracesReturns(requestBuilder().serviceName(backend.serviceName()).parseAnnotationQuery("local=app").build(), asList(trace2, trace2Server));
assertGetTracesReturnsEmpty(requestBuilder().serviceName(frontend.serviceName()).parseAnnotationQuery("local=app").build());
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class ITSpanStore method getTraces_differentiatesDebugFromShared.
/**
* Prevents subtle bugs which can result in mixed-length traces from linking.
*/
@Test
protected void getTraces_differentiatesDebugFromShared(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Span clientSpan = newClientSpan(testSuffix).toBuilder().debug(true).build();
Span serverSpan = clientSpan.toBuilder().kind(SERVER).debug(null).shared(true).build();
accept(clientSpan, serverSpan);
// assertGetTracesReturns does recursive comparison
assertGetTracesReturns(requestBuilder().build(), asList(clientSpan, serverSpan));
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class DependencyLinkV2SpanIteratorTest method whenSrAndCaServiceExists_caIsThePeer.
/**
* "ca" indicates the peer, which is a client in the case of a server span
*/
@Test
public void whenSrAndCaServiceExists_caIsThePeer() {
DependencyLinkV2SpanIterator iterator = iterator(newRecord().values(traceIdHigh, traceId, parentId, spanId, "ca", TYPE_BOOLEAN, "s1"), newRecord().values(traceIdHigh, traceId, parentId, spanId, "sr", -1, "s2"));
Span span = iterator.next();
assertThat(span.kind()).isEqualTo(Span.Kind.SERVER);
assertThat(span.localServiceName()).isEqualTo("s2");
assertThat(span.remoteServiceName()).isEqualTo("s1");
}
Aggregations