Skip to content

Commit faadf77

Browse files
committed
address comment
1 parent 1fef2a1 commit faadf77

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableCloudMonitoringExporter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.io.IOException;
3838
import java.util.Collection;
3939
import java.util.List;
40+
import java.util.concurrent.TimeUnit;
4041
import java.util.concurrent.atomic.AtomicBoolean;
4142
import java.util.logging.Level;
4243
import java.util.logging.Logger;
@@ -154,6 +155,11 @@ public CompletableResultCode shutdown() {
154155
return CompletableResultCode.ofSuccess();
155156
}
156157
CompletableResultCode resultCode = flush();
158+
// wait 1 minute for flush
159+
resultCode.join(1, TimeUnit.MINUTES);
160+
if (!resultCode.isSuccess()) {
161+
logger.log(Level.WARNING, "Timed out waiting for exporter flush.");
162+
}
157163
try {
158164
client.shutdown();
159165
} catch (Throwable e) {
@@ -164,8 +170,8 @@ public CompletableResultCode shutdown() {
164170
}
165171

166172
/**
167-
* For cloud monarch always return CUMULATIVE to keep track of the cumulative value of a metric
168-
* over time.
173+
* For Google Cloud Monitoring always return CUMULATIVE to keep track of the cumulative value of a
174+
* metric over time.
169175
*/
170176
@Override
171177
public AggregationTemporality getAggregationTemporality(InstrumentType instrumentType) {

0 commit comments

Comments
 (0)