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

Commit

Permalink
A workaround to pass null analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
songy23 committed Jan 19, 2018
1 parent f06a1b7 commit c082a3f
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.api.gax.rpc.ApiException;
import com.google.cloud.monitoring.v3.MetricServiceClient;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.monitoring.v3.CreateMetricDescriptorRequest;
import com.google.monitoring.v3.CreateTimeSeriesRequest;
Expand All @@ -41,6 +42,7 @@
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import javax.annotation.concurrent.NotThreadSafe;

/*>>>
Expand Down Expand Up @@ -182,11 +184,16 @@ void export() {
metricServiceClient.createTimeSeries(request);
span.addAnnotation("Finish exporting TimeSeries.");
} catch (com.google.api.gax.rpc.UnavailableException e) {
if (e.getLocalizedMessage() != null
&& e.getLocalizedMessage()
.startsWith(
"io.grpc.StatusRuntimeException: UNAVAILABLE: HTTP/2 error code: NO_ERROR")) {
continue; // Silently skip NO_ERROR Goaway
if (e.getLocalizedMessage() != null) {
String message = e.getLocalizedMessage();
if (message == null) {
throw new AssertionError(); // To pass null check
}
if (message
.startsWith(
"io.grpc.StatusRuntimeException: UNAVAILABLE: HTTP/2 error code: NO_ERROR")) {
continue; // Silently skip NO_ERROR Goaway
}
} else {
logAndSetSpanStatusForApiException(e, span);
}
Expand Down

0 comments on commit c082a3f

Please sign in to comment.