Skip to content

Commit 14f2d6d

Browse files
kkondakasimonelbaz
authored andcommitted
Rename out_of_order_window to out_of_order_time_window (opensearch-project#6398)
* Rename out_of_order_window to out_of_order_time_window Signed-off-by: Krishna Kondaka <krishkdk@amazon.com> * Fix PrometheusSinkServiceTest Signed-off-by: Krishna Kondaka <krishkdk@amazon.com> --------- Signed-off-by: Krishna Kondaka <krishkdk@amazon.com> Signed-off-by: Simon ELBAZ <elbazsimon9@gmail.com>
1 parent 56d13bc commit 14f2d6d

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

data-prepper-plugins/prometheus-sink/src/integrationTest/java/org/opensearch/dataprepper/plugins/sink/prometheus/PrometheusSinkAMPIT.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void setUp() {
218218
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(60L);
219219
prometheusSinkConfig = mock(PrometheusSinkConfiguration.class);
220220
when(prometheusSinkConfig.getMaxRetries()).thenReturn(5);
221-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(0));
221+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(0));
222222
when(prometheusSinkConfig.getSanitizeNames()).thenReturn(false);
223223
when(prometheusSinkConfig.getUrl()).thenReturn(remoteWriteUrl);
224224
when(prometheusSinkConfig.getContentType()).thenReturn("application/x-protobuf");
@@ -299,7 +299,7 @@ private void getMetricsFromAMP(final String metricName, final String qs) throws
299299
@ValueSource(ints = {0, 2, 5})
300300
void TestSumMetrics(final int window) throws Exception {
301301
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
302-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
302+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
303303
PrometheusSink sink = createObjectUnderTest();
304304
long startTimeSeconds = testStartTime.getEpochSecond();
305305
Instant time = Instant.now();
@@ -407,7 +407,7 @@ void TestSumMetricsFailuresWithDLQ() throws Exception {
407407
@ValueSource(ints = {0, 2, 5})
408408
void TestSumMetricsFailuresWithoutDLQ(final int window) throws Exception {
409409
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
410-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
410+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
411411
when(thresholdConfig.getMaxEvents()).thenReturn(1);
412412
PrometheusSink sink = createObjectUnderTest();
413413

@@ -488,7 +488,7 @@ private Collection<Record<Event>> getSumRecordList(int numberOfRecords, final St
488488
@ValueSource(ints = {0, 2, 5})
489489
void TestGaugeMetrics(final int window) throws Exception {
490490
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
491-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
491+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
492492

493493
PrometheusSink sink = createObjectUnderTest();
494494
Collection<Record<Event>> records = getGaugeRecordList(NUM_RECORDS);
@@ -532,7 +532,7 @@ void TestGaugeMetrics(final int window) throws Exception {
532532
@ValueSource(ints = {0, 2, 5})
533533
void TestGaugeMetricsWithMaxRequestSizeLimitAndFlushTimeout(final int window) throws Exception {
534534
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
535-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
535+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
536536

537537
when(thresholdConfig.getMaxRequestSizeBytes()).thenReturn(220L);
538538
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(20L);
@@ -604,7 +604,7 @@ private Collection<Record<Event>> getGaugeRecordList(int numberOfRecords) {
604604
@ValueSource(ints = {0, 2, 5})
605605
void TestSummaryMetrics(final int window) throws Exception {
606606
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
607-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
607+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
608608

609609
PrometheusSink sink = createObjectUnderTest();
610610
Collection<Record<Event>> records = getSummaryRecordList(NUM_RECORDS);
@@ -716,7 +716,7 @@ private Collection<Record<Event>> getSummaryRecordList(int numberOfRecords) {
716716
@ValueSource(ints = {0, 2, 5})
717717
void TestHistogramMetrics(final int window) throws Exception {
718718
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
719-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
719+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
720720

721721
PrometheusSink sink = createObjectUnderTest();
722722
Collection<Record<Event>> records = getHistogramRecordList(NUM_RECORDS);
@@ -783,7 +783,7 @@ void TestHistogramMetrics(final int window) throws Exception {
783783
@ValueSource(ints = {0, 2, 5})
784784
void TestExponentialHistogramMetrics(final int window) throws Exception {
785785
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
786-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
786+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
787787

788788
PrometheusSink sink = createObjectUnderTest();
789789
Collection<Record<Event>> records = getExponentialHistogramRecordList(NUM_RECORDS);
@@ -853,7 +853,7 @@ void TestExponentialHistogramMetrics(final int window) throws Exception {
853853
@ValueSource(ints = {0, 2, 5})
854854
public void TestMultipleMetrics(final int window) throws Exception {
855855
lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L);
856-
when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window));
856+
when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window));
857857
when(thresholdConfig.getMaxEvents()).thenReturn(1);
858858
long startTimeSeconds = testStartTime.getEpochSecond();
859859
PrometheusSink sink = createObjectUnderTest();

data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/configuration/PrometheusSinkConfiguration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class PrometheusSinkConfiguration {
3434
private static final Duration DEFAULT_REQUEST_TIMEOUT = Duration.ofSeconds(60);
3535
private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60);
3636
private static final Duration DEFAULT_IDLE_TIMEOUT = Duration.ofSeconds(60);
37-
private static final Duration DEFAULT_OUT_OF_ORDER_WINDOW = Duration.ofSeconds(5);
37+
private static final Duration DEFAULT_OUT_OF_ORDER_TIME_WINDOW = Duration.ofSeconds(10);
3838

3939
@JsonProperty("aws")
4040
@NotNull
@@ -45,8 +45,8 @@ public class PrometheusSinkConfiguration {
4545
@JsonProperty("url")
4646
private String url;
4747

48-
@JsonProperty("out_of_order_window")
49-
private Duration outOfOrderWindow = DEFAULT_OUT_OF_ORDER_WINDOW;
48+
@JsonProperty("out_of_order_time_window")
49+
private Duration outOfOrderTimeWindow = DEFAULT_OUT_OF_ORDER_TIME_WINDOW;
5050

5151
@JsonProperty("max_retries")
5252
private int maxRetries = DEFAULT_MAX_RETRIES;
@@ -112,8 +112,8 @@ public String getContentType() {
112112
return contentType;
113113
}
114114

115-
public Duration getOutOfOrderWindow() {
116-
return outOfOrderWindow;
115+
public Duration getOutOfOrderTimeWindow() {
116+
return outOfOrderTimeWindow;
117117
}
118118

119119
public String getRemoteWriteVersion() {

data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class PrometheusSinkBufferWriter implements SinkBufferWriter {
4040
public PrometheusSinkBufferWriter(final PrometheusSinkConfiguration sinkConfig, final SinkMetrics sinkMetrics) {
4141
this.buffer = new HashMap<>();
4242
this.sinkMetrics = sinkMetrics;
43-
this.outOfOrderWindowMillis = sinkConfig.getOutOfOrderWindow().toMillis();
43+
this.outOfOrderWindowMillis = sinkConfig.getOutOfOrderTimeWindow().toMillis();
4444
this.maxEvents = sinkConfig.getThresholdConfig().getMaxEvents();
4545
this.maxRequestSize = sinkConfig.getThresholdConfig().getMaxRequestSizeBytes();
4646
}

data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void setUp() throws Exception {
5757
when(sinkThresholdConfig.getMaxEvents()).thenReturn(3);
5858
when(sinkThresholdConfig.getMaxRequestSizeBytes()).thenReturn(1000L);
5959
when(sinkConfig.getThresholdConfig()).thenReturn(sinkThresholdConfig);
60-
when(sinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(0));
60+
when(sinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(0));
6161
sinkFlushContext = mock(PrometheusSinkFlushContext.class);
6262
gauge1 = createGaugeMetric("gauge1", Instant.now(), 1.0d);
6363
prometheusSinkBufferEntry = new PrometheusSinkBufferEntry(gauge1, true);
@@ -126,7 +126,7 @@ public void testPrometheusSinkBufferWriterWithOutOfOrderEntries() throws Excepti
126126
public void testGetBufferWithMultipleMetrics() throws Exception {
127127
when(sinkThresholdConfig.getMaxEvents()).thenReturn(5);
128128
when(sinkThresholdConfig.getMaxRequestSizeBytes()).thenReturn(100000L);
129-
when(sinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(3));
129+
when(sinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(3));
130130
prometheusSinkBufferWriter = createObjectUnderTest();
131131
Instant t1 = Instant.now();
132132
Instant t2 = t1.minusSeconds(3);

data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class PrometheusSinkServiceTest {
5858
" max_events: 2\n" +
5959
" flush_interval: 10\n"+
6060
" connection_timeout: 10\n"+
61-
" out_of_order_window: 0\n" +
61+
" out_of_order_time_window: 0\n" +
6262
" idle_timeout: 10\n"+
6363
" aws:\n" +
6464
" region: \"us-east-2\"\n" +

0 commit comments

Comments
 (0)