diff --git a/data-prepper-plugins/prometheus-sink/src/integrationTest/java/org/opensearch/dataprepper/plugins/sink/prometheus/PrometheusSinkAMPIT.java b/data-prepper-plugins/prometheus-sink/src/integrationTest/java/org/opensearch/dataprepper/plugins/sink/prometheus/PrometheusSinkAMPIT.java index a3e8a71a88..52c64ca40e 100644 --- a/data-prepper-plugins/prometheus-sink/src/integrationTest/java/org/opensearch/dataprepper/plugins/sink/prometheus/PrometheusSinkAMPIT.java +++ b/data-prepper-plugins/prometheus-sink/src/integrationTest/java/org/opensearch/dataprepper/plugins/sink/prometheus/PrometheusSinkAMPIT.java @@ -218,7 +218,7 @@ void setUp() { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(60L); prometheusSinkConfig = mock(PrometheusSinkConfiguration.class); when(prometheusSinkConfig.getMaxRetries()).thenReturn(5); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(0)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(0)); when(prometheusSinkConfig.getSanitizeNames()).thenReturn(false); when(prometheusSinkConfig.getUrl()).thenReturn(remoteWriteUrl); when(prometheusSinkConfig.getContentType()).thenReturn("application/x-protobuf"); @@ -299,7 +299,7 @@ private void getMetricsFromAMP(final String metricName, final String qs) throws @ValueSource(ints = {0, 2, 5}) void TestSumMetrics(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); PrometheusSink sink = createObjectUnderTest(); long startTimeSeconds = testStartTime.getEpochSecond(); Instant time = Instant.now(); @@ -407,7 +407,7 @@ void TestSumMetricsFailuresWithDLQ() throws Exception { @ValueSource(ints = {0, 2, 5}) void TestSumMetricsFailuresWithoutDLQ(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); when(thresholdConfig.getMaxEvents()).thenReturn(1); PrometheusSink sink = createObjectUnderTest(); @@ -488,7 +488,7 @@ private Collection> getSumRecordList(int numberOfRecords, final St @ValueSource(ints = {0, 2, 5}) void TestGaugeMetrics(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); PrometheusSink sink = createObjectUnderTest(); Collection> records = getGaugeRecordList(NUM_RECORDS); @@ -532,7 +532,7 @@ void TestGaugeMetrics(final int window) throws Exception { @ValueSource(ints = {0, 2, 5}) void TestGaugeMetricsWithMaxRequestSizeLimitAndFlushTimeout(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); when(thresholdConfig.getMaxRequestSizeBytes()).thenReturn(220L); lenient().when(thresholdConfig.getFlushInterval()).thenReturn(20L); @@ -604,7 +604,7 @@ private Collection> getGaugeRecordList(int numberOfRecords) { @ValueSource(ints = {0, 2, 5}) void TestSummaryMetrics(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); PrometheusSink sink = createObjectUnderTest(); Collection> records = getSummaryRecordList(NUM_RECORDS); @@ -716,7 +716,7 @@ private Collection> getSummaryRecordList(int numberOfRecords) { @ValueSource(ints = {0, 2, 5}) void TestHistogramMetrics(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); PrometheusSink sink = createObjectUnderTest(); Collection> records = getHistogramRecordList(NUM_RECORDS); @@ -783,7 +783,7 @@ void TestHistogramMetrics(final int window) throws Exception { @ValueSource(ints = {0, 2, 5}) void TestExponentialHistogramMetrics(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); PrometheusSink sink = createObjectUnderTest(); Collection> records = getExponentialHistogramRecordList(NUM_RECORDS); @@ -853,7 +853,7 @@ void TestExponentialHistogramMetrics(final int window) throws Exception { @ValueSource(ints = {0, 2, 5}) public void TestMultipleMetrics(final int window) throws Exception { lenient().when(thresholdConfig.getFlushInterval()).thenReturn(6L); - when(prometheusSinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(window)); + when(prometheusSinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(window)); when(thresholdConfig.getMaxEvents()).thenReturn(1); long startTimeSeconds = testStartTime.getEpochSecond(); PrometheusSink sink = createObjectUnderTest(); diff --git a/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/configuration/PrometheusSinkConfiguration.java b/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/configuration/PrometheusSinkConfiguration.java index 7be4ec9fea..1c33f43591 100644 --- a/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/configuration/PrometheusSinkConfiguration.java +++ b/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/configuration/PrometheusSinkConfiguration.java @@ -34,7 +34,7 @@ public class PrometheusSinkConfiguration { private static final Duration DEFAULT_REQUEST_TIMEOUT = Duration.ofSeconds(60); private static final Duration DEFAULT_CONNECTION_TIMEOUT = Duration.ofSeconds(60); private static final Duration DEFAULT_IDLE_TIMEOUT = Duration.ofSeconds(60); - private static final Duration DEFAULT_OUT_OF_ORDER_WINDOW = Duration.ofSeconds(5); + private static final Duration DEFAULT_OUT_OF_ORDER_TIME_WINDOW = Duration.ofSeconds(10); @JsonProperty("aws") @NotNull @@ -45,8 +45,8 @@ public class PrometheusSinkConfiguration { @JsonProperty("url") private String url; - @JsonProperty("out_of_order_window") - private Duration outOfOrderWindow = DEFAULT_OUT_OF_ORDER_WINDOW; + @JsonProperty("out_of_order_time_window") + private Duration outOfOrderTimeWindow = DEFAULT_OUT_OF_ORDER_TIME_WINDOW; @JsonProperty("max_retries") private int maxRetries = DEFAULT_MAX_RETRIES; @@ -112,8 +112,8 @@ public String getContentType() { return contentType; } - public Duration getOutOfOrderWindow() { - return outOfOrderWindow; + public Duration getOutOfOrderTimeWindow() { + return outOfOrderTimeWindow; } public String getRemoteWriteVersion() { diff --git a/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriter.java b/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriter.java index b415646f64..0317eb9767 100644 --- a/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriter.java +++ b/data-prepper-plugins/prometheus-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriter.java @@ -40,7 +40,7 @@ public class PrometheusSinkBufferWriter implements SinkBufferWriter { public PrometheusSinkBufferWriter(final PrometheusSinkConfiguration sinkConfig, final SinkMetrics sinkMetrics) { this.buffer = new HashMap<>(); this.sinkMetrics = sinkMetrics; - this.outOfOrderWindowMillis = sinkConfig.getOutOfOrderWindow().toMillis(); + this.outOfOrderWindowMillis = sinkConfig.getOutOfOrderTimeWindow().toMillis(); this.maxEvents = sinkConfig.getThresholdConfig().getMaxEvents(); this.maxRequestSize = sinkConfig.getThresholdConfig().getMaxRequestSizeBytes(); } diff --git a/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriterTest.java b/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriterTest.java index 8f87ddf7e2..641b8122b7 100644 --- a/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriterTest.java +++ b/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkBufferWriterTest.java @@ -57,7 +57,7 @@ void setUp() throws Exception { when(sinkThresholdConfig.getMaxEvents()).thenReturn(3); when(sinkThresholdConfig.getMaxRequestSizeBytes()).thenReturn(1000L); when(sinkConfig.getThresholdConfig()).thenReturn(sinkThresholdConfig); - when(sinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(0)); + when(sinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(0)); sinkFlushContext = mock(PrometheusSinkFlushContext.class); gauge1 = createGaugeMetric("gauge1", Instant.now(), 1.0d); prometheusSinkBufferEntry = new PrometheusSinkBufferEntry(gauge1, true); @@ -126,7 +126,7 @@ public void testPrometheusSinkBufferWriterWithOutOfOrderEntries() throws Excepti public void testGetBufferWithMultipleMetrics() throws Exception { when(sinkThresholdConfig.getMaxEvents()).thenReturn(5); when(sinkThresholdConfig.getMaxRequestSizeBytes()).thenReturn(100000L); - when(sinkConfig.getOutOfOrderWindow()).thenReturn(Duration.ofSeconds(3)); + when(sinkConfig.getOutOfOrderTimeWindow()).thenReturn(Duration.ofSeconds(3)); prometheusSinkBufferWriter = createObjectUnderTest(); Instant t1 = Instant.now(); Instant t2 = t1.minusSeconds(3); diff --git a/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkServiceTest.java b/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkServiceTest.java index 11af2af074..18a18c4134 100644 --- a/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkServiceTest.java +++ b/data-prepper-plugins/prometheus-sink/src/test/java/org/opensearch/dataprepper/plugins/sink/prometheus/service/PrometheusSinkServiceTest.java @@ -58,7 +58,7 @@ public class PrometheusSinkServiceTest { " max_events: 2\n" + " flush_interval: 10\n"+ " connection_timeout: 10\n"+ - " out_of_order_window: 0\n" + + " out_of_order_time_window: 0\n" + " idle_timeout: 10\n"+ " aws:\n" + " region: \"us-east-2\"\n" +