/** Sends an empty json message to the configured endpoint. */ @Override public CheckResult check() { try { Request request = new Request.Builder().url(endpoint()) .post(RequestBody.create(MediaType.parse("application/json"), "[]")).build(); try (Response response = client().newCall(request).execute()) { if (!response.isSuccessful()) { throw new IllegalStateException("check response failed: " + response); } } return CheckResult.OK; } catch (Exception e) { return CheckResult.failed(e); } }
@Override public void run() { try { delegate.run(); } catch (InterruptException e) { // Interrupts are normal on shutdown, intentionally swallow } catch (RuntimeException e) { LOG.error("Kafka worker exited with exception", e); failure.set(CheckResult.failed(e)); } catch (Error e) { LOG.error("Kafka worker exited with error", e); failure.set(CheckResult.failed(new RuntimeException(e))); } } };
/** Ensures there are no problems reading metadata about the topic. */ @Override public CheckResult check() { try { get().partitionsFor(topic()); // make sure we can query the metadata return CheckResult.OK; } catch (RuntimeException e) { return CheckResult.failed(e); } }
@Override public CheckResult check() { try { CheckResult failure = kafkaWorkers.failure.get(); // check the kafka workers didn't quit if (failure != null) return failure; return CheckResult.OK; } catch (RuntimeException e) { return CheckResult.failed(e); } }
/** sends an empty message to the configured host. */ @Override public CheckResult check() { AwaitableCallback callback = new AwaitableCallback(); try { sendSpans(Collections.<byte[]>emptyList(), callback); callback.await(); return CheckResult.OK; } catch (Exception e) { return CheckResult.failed(e); } }
@Override public CheckResult check() { try { client().ensureClusterReady(indexNameFormatter.catchAll()); } catch (RuntimeException e) { return CheckResult.failed(e); } return CheckResult.OK; }
/** Sends an empty json message to the configured endpoint. */ @Override public CheckResult check() { try { send(new byte[] {'[', ']'}, "application/json"); return CheckResult.OK; } catch (Exception e) { return CheckResult.failed(e); } }
@Override public CheckResult check() { try (Connection conn = datasource.getConnection()) { context.get(conn).select(ZIPKIN_SPANS.TRACE_ID).from(ZIPKIN_SPANS).limit(1).execute(); } catch (SQLException | RuntimeException e) { return CheckResult.failed(e); } return CheckResult.OK; }
@Override public CheckResult check() { try (Connection conn = datasource.getConnection()) { if (!context.get(conn).meta().getSchemas().contains(DEFAULT_CATALOG.ZIPKIN)) { throw new IllegalStateException("Zipkin schema is missing"); } } catch (SQLException | RuntimeException e) { return CheckResult.failed(e); } return CheckResult.OK; }
@Override public CheckResult check() { try { session.get().execute(QueryBuilder.select("trace_id").from("traces").limit(1)); } catch (RuntimeException e) { return CheckResult.failed(e); } return CheckResult.OK; }
/** Sends an empty log message to the configured host. */ @Override public CheckResult check() { try { if (get().log(Collections.emptyList())) { return CheckResult.OK; } throw new IllegalStateException("try later"); } catch (Exception e) { return CheckResult.failed(e); } }
/** Ensures there are no problems reading metadata about the topic. */ @Override public CheckResult check() { try { get().partitionsFor(topic()); // make sure we can query the metadata return CheckResult.OK; } catch (RuntimeException e) { return CheckResult.failed(e); } }