From 2ee1e7eb2d14a9714638048b45f07ccff9c8b77d Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 01:05:27 +0530 Subject: [PATCH] Rebased to latest (#3364) (#3372) Signed-off-by: Krishna Kondaka Co-authored-by: Krishna Kondaka (cherry picked from commit 542b4517896f1f074a32575b9ee98fb737065ee2) Co-authored-by: kkondaka <41027584+kkondaka@users.noreply.github.com> --- .../processor/aggregate/actions/CountAggregateAction.java | 2 +- .../processor/aggregate/actions/HistogramAggregateAction.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) 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())) {