use of zipkin2.CheckResult.OK in project zipkin by openzipkin.
the class ScribeCollectorTest method check_failsWhenNotStarted.
@Test
void check_failsWhenNotStarted() {
try (ScribeCollector scribe = ScribeCollector.newBuilder().storage(storage).port(0).build()) {
CheckResult result = scribe.check();
assertThat(result.ok()).isFalse();
assertThat(result.error()).isInstanceOf(IllegalStateException.class);
scribe.start();
assertThat(scribe.check().ok()).isTrue();
}
}
use of zipkin2.CheckResult.OK in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method healthyThenNotHealthyThenHealthy.
// If this flakes, uncomment in initWithHosts and log4j2.properties
@Test
public void healthyThenNotHealthyThenHealthy() {
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
assertOk(storage.check());
logger.info("setting server 1 and 2 unhealthy");
server1Health.setHealthy(false);
server2Health.setHealthy(false);
awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isFalse());
logger.info("setting server 1 healthy");
server1Health.setHealthy(true);
awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isTrue());
}
}
use of zipkin2.CheckResult.OK in project zipkin by openzipkin.
the class SelectSpansAndAnnotations method endpoint.
static Endpoint endpoint(Record a) {
Endpoint.Builder result = Endpoint.newBuilder().serviceName(a.getValue(ZIPKIN_ANNOTATIONS.ENDPOINT_SERVICE_NAME)).port(Schema.maybeGet(a, ZIPKIN_ANNOTATIONS.ENDPOINT_PORT, (short) 0));
int ipv4 = maybeGet(a, ZIPKIN_ANNOTATIONS.ENDPOINT_IPV4, 0);
if (ipv4 != 0) {
// allocation is ok here as Endpoint.ipv4Bytes would anyway
result.parseIp(new byte[] { (byte) (ipv4 >> 24 & 0xff), (byte) (ipv4 >> 16 & 0xff), (byte) (ipv4 >> 8 & 0xff), (byte) (ipv4 & 0xff) });
}
result.parseIp(Schema.maybeGet(a, ZIPKIN_ANNOTATIONS.ENDPOINT_IPV6, null));
return result.build();
}
Aggregations