diff --git a/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/CountAggregateAction.java b/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/CountAggregateAction.java index 382d1cc99b..daace6275c 100644 --- a/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/CountAggregateAction.java +++ b/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/CountAggregateAction.java @@ -53,7 +53,6 @@ public CountAggregateAction(final CountAggregateActionConfig countAggregateActio this.countKey = countAggregateActionConfig.getCountKey(); this.startTimeKey = countAggregateActionConfig.getStartTimeKey(); this.outputFormat = countAggregateActionConfig.getOutputFormat(); - this.exemplarList = new ArrayList<>(); } private long getTimeNanos(Instant time) { @@ -87,6 +86,7 @@ public AggregateActionResponse handleEvent(final Event event, final AggregateAct groupState.put(startTimeKey, Instant.now()); groupState.putAll(aggregateActionInput.getIdentificationKeys()); groupState.put(countKey, 1); + exemplarList = new ArrayList<>(); exemplarList.add(createExemplar(event)); } else { Integer v = (Integer)groupState.get(countKey) + 1; diff --git a/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/HistogramAggregateAction.java b/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/HistogramAggregateAction.java index 6db82130ea..5e93f305bc 100644 --- a/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/HistogramAggregateAction.java +++ b/data-prepper-plugins/aggregate-processor/src/main/java/org/opensearch/dataprepper/plugins/processor/aggregate/actions/HistogramAggregateAction.java @@ -57,7 +57,6 @@ public class HistogramAggregateAction implements AggregateAction { private final String key; private final String units; private final boolean recordMinMax; - private List exemplarList; private Event minEvent; private Event maxEvent; private double minValue; @@ -71,7 +70,6 @@ public HistogramAggregateAction(final HistogramAggregateActionConfig histogramAg this.key = histogramAggregateActionConfig.getKey(); List bucketList = histogramAggregateActionConfig.getBuckets(); this.buckets = new double[bucketList.size()+2]; - this.exemplarList = new ArrayList<>(); int bucketIdx = 0; this.buckets[bucketIdx++] = -Float.MAX_VALUE; for (int i = 0; i < bucketList.size(); i++) { @@ -197,6 +195,7 @@ public AggregateActionOutput concludeGroup(final AggregateActionInput aggregateA long startTimeNanos = getTimeNanos(startTime); long endTimeNanos = getTimeNanos(endTime); String histogramKey = HISTOGRAM_METRIC_NAME + "_key"; + List exemplarList = new ArrayList<>(); exemplarList.add(createExemplar("min", minEvent, minValue)); exemplarList.add(createExemplar("max", maxEvent, maxValue)); if (outputFormat.equals(OutputFormat.RAW.toString())) {