diff --git a/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java b/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java index 63a80fe1913f..4219863e5c93 100644 --- a/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java +++ b/java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/it/ITE2ETracingTest.java @@ -227,14 +227,12 @@ private boolean dfsContainsCallStack(long spanId, List expectedCallStack private static final int NUM_SPAN_ID_BYTES = 16; - private static final int GET_TRACE_RETRY_COUNT = 60; + private static final int GET_TRACE_RETRY_COUNT = 120; private static final int GET_TRACE_RETRY_BACKOFF_MILLIS = 1000; private static final int TRACE_FORCE_FLUSH_MILLIS = 5000; - private static final int TRACE_PROVIDER_SHUTDOWN_MILLIS = 1000; - private static Key KEY1; private static Key KEY2; @@ -393,6 +391,9 @@ public void after() throws Exception { tracer = null; retrievedTrace = null; customSpanContext = null; + if (openTelemetrySdk != null) { + openTelemetrySdk.close(); + } openTelemetrySdk = null; } @@ -441,6 +442,9 @@ protected void waitForTracesToComplete() throws Exception { CompletableResultCode completableResultCode = openTelemetrySdk.getSdkTracerProvider().forceFlush(); completableResultCode.join(TRACE_FORCE_FLUSH_MILLIS, TimeUnit.MILLISECONDS); + if (!completableResultCode.isSuccess()) { + logger.warning("Force flush did not complete successfully"); + } } // Validates `retrievedTrace`. Cloud Trace indexes traces w/ eventual consistency, even when