Skip to content

Commit 62effd8

Browse files
authored
Fix logging too old data. (#155)
1 parent bd39655 commit 62effd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/arpnetworking/clusteraggregator/aggregation/StreamingAggregator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,11 @@ private void processAggregationMessage(final Messages.StatisticSetRecord data) {
237237
final ZonedDateTime periodStart = ZonedDateTime.parse(data.getPeriodStart());
238238
if (periodStart.plus(_period).plus(_aggregatorTimeout).isBefore(ZonedDateTime.now())) {
239239
// We got a bit of data that is too old for us to aggregate.
240+
@Nullable final StreamingAggregationBucket firstBucket = _aggBuckets.getFirst();
240241
WORK_TOO_OLD_LOGGER.warn()
241242
.setMessage("Received a work item that is too old to aggregate")
242243
.addData("start", periodStart)
243-
.addData("firstStart", _aggBuckets.getFirst().getPeriodStart())
244+
.addData("firstStart", firstBucket == null ? null : firstBucket.getPeriodStart())
244245
.addData("metric", data.getMetric())
245246
.addData("dimensions", data.getDimensionsMap())
246247
.addContext("actor", self())

0 commit comments

Comments
 (0)