Skip to content

Commit 27fa754

Browse files
Improve Otlp Delta Aggregation with support for max and Histogram.
1 parent ecc66dd commit 27fa754

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

micrometer-core/src/main/java/io/micrometer/core/instrument/step/StepMax.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ public void record(double value) {
5252
public void _closingRollover() {
5353
super.closingRollover();
5454
}
55+
5556
}

micrometer-core/src/test/java/io/micrometer/core/instrument/step/StepMaxTest.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1+
/*
2+
* Copyright 2023 VMware, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package io.micrometer.core.instrument.step;
217

318
import io.micrometer.core.instrument.MockClock;
19+
import org.junit.jupiter.api.BeforeEach;
420
import org.junit.jupiter.api.Test;
521

622
import java.time.Duration;
723

824
import static org.assertj.core.api.Assertions.assertThat;
925

1026
class StepMaxTest {
27+
1128
private final Duration step = Duration.ofMillis(10);
29+
1230
MockClock clock;
31+
32+
@BeforeEach
33+
void init() {
34+
clock = new MockClock();
35+
}
36+
1337
@Test
1438
void testMax() {
15-
clock = new MockClock();
1639
StepMax max = new StepMax(clock, step.toMillis());
1740

1841
assertThat(max.poll()).isZero();
@@ -32,7 +55,6 @@ void testMax() {
3255

3356
@Test
3457
void shouldPreserveCurrentAfterManualRollover() {
35-
clock = new MockClock();
3658
StepMax max = new StepMax(clock, step.toMillis());
3759

3860
max.record(11);
@@ -45,4 +67,5 @@ void shouldPreserveCurrentAfterManualRollover() {
4567
clock.add(step);
4668
assertThat(max.poll()).isEqualTo(11);
4769
}
70+
4871
}

0 commit comments

Comments
 (0)