mirror of
https://github.com/google/nomulus
synced 2026-01-05 04:56:03 +00:00
Make StackdriverWriter#flush() return early when attempting to flush empty
timeseries ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132359115
This commit is contained in:
@@ -193,6 +193,12 @@ public class StackdriverWriter implements MetricWriter {
|
||||
public void flush() throws IOException {
|
||||
checkState(timeSeriesBuffer.size() <= 200, FLUSH_OVERFLOW_ERROR);
|
||||
|
||||
// Return early; Stackdriver throws errors if we attempt to send empty requests.
|
||||
if (timeSeriesBuffer.isEmpty()) {
|
||||
logger.fine("Attempted to flush with no pending points, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
ImmutableList<TimeSeries> timeSeriesList = ImmutableList.copyOf(timeSeriesBuffer);
|
||||
timeSeriesBuffer.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user