mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02: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:
parent
0e8d9e3859
commit
e5a0392994
1 changed files with 6 additions and 0 deletions
|
@ -193,6 +193,12 @@ public class StackdriverWriter implements MetricWriter {
|
||||||
public void flush() throws IOException {
|
public void flush() throws IOException {
|
||||||
checkState(timeSeriesBuffer.size() <= 200, FLUSH_OVERFLOW_ERROR);
|
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);
|
ImmutableList<TimeSeries> timeSeriesList = ImmutableList.copyOf(timeSeriesBuffer);
|
||||||
timeSeriesBuffer.clear();
|
timeSeriesBuffer.clear();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue