@Test public void verifyCheckReturnsFailureWhenServiceFailsWithKnownGrpcFailure() { onClientCall(observer -> { observer.onError(new StatusRuntimeException(Status.RESOURCE_EXHAUSTED)); }); CheckResult result = sender.check(); assertThat(result.ok()).isFalse(); assertThat(result.error()) .isInstanceOf(StatusRuntimeException.class) .hasMessageContaining("RESOURCE_EXHAUSTED"); }
@Override public CheckResult check() { try { healthcheckCall.clone().execute(); } catch (StatusRuntimeException sre) { if (sre.getStatus().getCode() == Status.Code.INVALID_ARGUMENT) { return CheckResult.OK; } return CheckResult.failed(sre); } catch (Exception e) { return CheckResult.failed(e); } return CheckResult.OK; }
StackdriverSender extends Sender { @Override public CheckResult check() { try { healthcheckCall.clone().execute(); } catch (StatusRuntimeException sre) { if (sre.getStatus().getCode() == Status.Code.INVALID_ARGUMENT) { return CheckResult.OK; } return CheckResult.failed(sre); } catch (Exception e) { return CheckResult.failed(e); } return CheckResult.OK; } }
StackdriverSender extends Sender { @Override public CheckResult check() { try { healthcheckCall.clone().execute(); } catch (StatusRuntimeException sre) { if (sre.getStatus().getCode() == Status.Code.INVALID_ARGUMENT) { return CheckResult.OK; } return CheckResult.failed(sre); } catch (Exception e) { return CheckResult.failed(e); } return CheckResult.OK; } StackdriverSender(Builder builder); }
StackdriverSender extends Sender { @Override public CheckResult check() { try { healthcheckCall.clone().execute(); } catch (StatusRuntimeException sre) { if (sre.getStatus().getCode() == Status.Code.INVALID_ARGUMENT) { return CheckResult.OK; } return CheckResult.failed(sre); } catch (Exception e) { return CheckResult.failed(e); } return CheckResult.OK; } StackdriverSender(Builder builder); static Builder newBuilder(); static Builder newBuilder(Channel channel); @Override Encoding encoding(); @Override int messageMaxBytes(); @Override int messageSizeInBytes(List<byte[]> traceIdPrefixedSpans); @Override int messageSizeInBytes(int traceIdPrefixedSpanSize); @Override Call<Void> sendSpans(List<byte[]> traceIdPrefixedSpans); @Override CheckResult check(); @Override final String toString(); @Override void close(); }
StackdriverSender extends Sender { @Override public CheckResult check() { try { healthcheckCall.clone().execute(); } catch (StatusRuntimeException sre) { if (sre.getStatus().getCode() == Status.Code.INVALID_ARGUMENT) { return CheckResult.OK; } return CheckResult.failed(sre); } catch (Exception e) { return CheckResult.failed(e); } return CheckResult.OK; } StackdriverSender(Builder builder); static Builder newBuilder(); static Builder newBuilder(Channel channel); @Override Encoding encoding(); @Override int messageMaxBytes(); @Override int messageSizeInBytes(List<byte[]> traceIdPrefixedSpans); @Override int messageSizeInBytes(int traceIdPrefixedSpanSize); @Override Call<Void> sendSpans(List<byte[]> traceIdPrefixedSpans); @Override CheckResult check(); @Override final String toString(); @Override void close();  }