use of zipkin2.CheckResult in project zipkin by openzipkin.
the class RabbitMQCollectorTest method checkFalseWhenRabbitMQIsDown.
@Test
public void checkFalseWhenRabbitMQIsDown() {
CheckResult check = collector.check();
assertThat(check.ok()).isFalse();
assertThat(check.error()).isInstanceOf(UncheckedIOException.class);
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ComponentHealth method ofComponent.
static ComponentHealth ofComponent(Component component) {
Throwable t = null;
try {
CheckResult check = component.check();
if (!check.ok())
t = check.error();
} catch (Throwable unexpected) {
Call.propagateIfFatal(unexpected);
t = unexpected;
}
if (t == null)
return new ComponentHealth(component.toString(), STATUS_UP, null);
String message = t.getMessage();
String error = t.getClass().getName() + (message != null ? ": " + message : "");
return new ComponentHealth(component.toString(), STATUS_DOWN, error);
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ITEnsureSchema method worksWithOldSchema.
/**
* This tests we don't accidentally rely on new indexes such as autocomplete tags
*/
@Test
void worksWithOldSchema(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema.cql");
Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema-indexes-original.cql");
// Ensure the storage component is functional before proceeding
CheckResult check = storage.check();
if (!check.ok()) {
throw new AssertionError("Could not connect to storage: " + check.error().getMessage(), check.error());
}
List<Span> trace = newTrace(testSuffix);
accept(trace);
assertGetTraceReturns(trace.get(0).traceId(), trace);
assertThat(storage.autocompleteTags().getValues("environment").execute()).isEmpty();
String serviceName = trace.get(0).localServiceName();
assertThat(storage.serviceAndSpanNames().getRemoteServiceNames(serviceName).execute()).isEmpty();
QueryRequest request = requestBuilder().serviceName(serviceName).remoteServiceName(appendSuffix(BACKEND.serviceName(), testSuffix)).build();
// Make sure there's an error if a query will return incorrectly vs returning invalid results
assertThatThrownBy(() -> storage.spanStore().getTraces(request)).isInstanceOf(IllegalArgumentException.class).hasMessage("remoteService=" + trace.get(1).remoteServiceName() + " unsupported due to missing table remote_service_by_service");
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ElasticsearchStorageTest method check_ensuresIndexTemplates_fail_onNoContent.
// makes sure we don't NPE
@Test
void check_ensuresIndexTemplates_fail_onNoContent() {
// empty instead of version json
server.enqueue(SUCCESS_RESPONSE);
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
assertThat(result.error().getMessage()).isEqualTo("No content reading Elasticsearch version");
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ForwardingStorageComponentTest method delegatesCheck.
@Test
public void delegatesCheck() {
CheckResult down = CheckResult.failed(new RuntimeException("failed"));
when(delegate.check()).thenReturn(down);
assertThat(forwarder.check()).isEqualTo(down);
verify(delegate).check();
}
Aggregations