Skip to content

Commit 8bde0f4

Browse files
committed
comments and fix test
1 parent 561e479 commit 8bde0f4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/state/AsynchronousMetricStorage.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ private Collection<T> collectWithDeltaAggregationTemporality() {
225225
AsynchronousMetricStorage.this.startEpochNanos,
226226
AsynchronousMetricStorage.this.epochNanos,
227227
attributes,
228-
/* reset= */ true);
228+
// No need to reset, aggregatorHandles is going to be cleared anyways
229+
/* reset= */ false);
229230
currentPoints.put(attributes, value);
230231
});
231232

@@ -257,6 +258,8 @@ private Collection<T> collectWithDeltaAggregationTemporality() {
257258
Map<Attributes, T> tmp = lastPoints;
258259
lastPoints = reusablePointsMap;
259260
reusablePointsMap = tmp;
261+
} else {
262+
lastPoints = currentPoints;
260263
}
261264

262265
return deltaPoints;
@@ -271,6 +274,7 @@ private Collection<T> collectWithCumulativeAggregationTemporality() {
271274
AsynchronousMetricStorage.this.startEpochNanos,
272275
AsynchronousMetricStorage.this.epochNanos,
273276
attributes,
277+
// No need to reset, aggregatorHandles is going to be cleared anyways
274278
/* reset= */ false);
275279
currentPoints.add(value);
276280
});

0 commit comments

Comments
 (0)