use of zipkin2.elasticsearch.ElasticsearchStorage in project zipkin by openzipkin.
the class InternalForTests method writeDependencyLinks.
public static void writeDependencyLinks(ElasticsearchStorage es, List<DependencyLink> links, long midnightUTC) {
String index = ((ElasticsearchSpanConsumer) es.spanConsumer()).formatTypeAndTimestampForInsert("dependency", midnightUTC);
BulkCallBuilder indexer = new BulkCallBuilder(es, es.version(), "indexlinks");
for (DependencyLink link : links) indexer.index(index, "dependency", link, DEPENDENCY_LINK_WRITER);
try {
indexer.build().execute();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of zipkin2.elasticsearch.ElasticsearchStorage in project zipkin by openzipkin.
the class ITElasticsearchClientInitialization method doesntHangWhenAllDown.
/**
* blocking a little is ok, but blocking forever is not.
*/
@Test(timeout = 3000L)
public void doesntHangWhenAllDown() throws IOException {
TestPropertyValues.of("spring.config.name=zipkin-server", "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.timeout:1000", "zipkin.storage.elasticsearch.hosts:127.0.0.1:1234,127.0.0.1:5678").applyTo(context);
Access.registerElasticsearch(context);
context.refresh();
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
}
}
use of zipkin2.elasticsearch.ElasticsearchStorage in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method wrongScheme.
@Test
public void wrongScheme() {
context.close();
context = new AnnotationConfigApplicationContext();
initWithHosts("https://localhost:" + server1.httpPort());
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
// Test this is not wrapped in a rejection exception, as health check is not throttled
// Depending on JDK this is SSLHandshakeException or NotSslRecordException
assertThat(result.error()).isInstanceOf(SSLException.class);
}
}
use of zipkin2.elasticsearch.ElasticsearchStorage in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method notHealthyThenHealthyThenNotHealthy.
@Test
public void notHealthyThenHealthyThenNotHealthy() {
server1Health.setHealthy(false);
server2Health.setHealthy(false);
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
server2Health.setHealthy(true);
awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isTrue());
server2Health.setHealthy(false);
awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isFalse());
}
}
use of zipkin2.elasticsearch.ElasticsearchStorage 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());
}
}
Aggregations