Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
Log and set status for other UnavailableException
Browse files Browse the repository at this point in the history
  • Loading branch information
songy23 committed Jan 18, 2018
1 parent c7e24e1 commit 4daf1d0
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,11 @@ void export() {
.startsWith(
"io.grpc.StatusRuntimeException: UNAVAILABLE: HTTP/2 error code: NO_ERROR")) {
continue; // Silently skip NO_ERROR Goaway
} else {
logAndSetSpanStatusForApiException(e, span);
}
} catch (ApiException e) {
logger.log(Level.WARNING, "ApiException thrown when exporting TimeSeries.", e);
span.setStatus(
Status.CanonicalCode.valueOf(e.getStatusCode().getCode().name())
.toStatus()
.withDescription(
"ApiException thrown when exporting TimeSeries: " + exceptionMessage(e)));
logAndSetSpanStatusForApiException(e, span);
} catch (Throwable e) {
logger.log(Level.WARNING, "Exception thrown when exporting TimeSeries.", e);
span.setStatus(
Expand All @@ -203,6 +200,15 @@ void export() {
}
}

private static void logAndSetSpanStatusForApiException(ApiException e, Span span) {
logger.log(Level.WARNING, "ApiException thrown when exporting TimeSeries.", e);
span.setStatus(
Status.CanonicalCode.valueOf(e.getStatusCode().getCode().name())
.toStatus()
.withDescription(
"ApiException thrown when exporting TimeSeries: " + exceptionMessage(e)));
}

@Override
public void run() {
while (true) {
Expand Down

0 comments on commit 4daf1d0

Please sign in to comment.