pnowojski commented on a change in pull request #18991:
URL: https://github.com/apache/flink/pull/18991#discussion_r825998098
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
##########
@@ -1763,6 +1765,66 @@ public long calculateThroughput() {
}
}
+ /**
+ * Tests mailbox metrics latency and queue size and verifies that (1)
latency measurement is
+ * executed initially once and at least once triggered by timer, (2)
latency mean value is
+ * greater than zero and (3) mailbox size is greater than zero for some
time and eventually
+ * equals to zero.
+ *
+ * @throws Exception on {@link MockEnvironmentBuilder#build()} failure.
+ */
+ @Test
+ public void testMailboxMetrics() throws Exception {
Review comment:
With this simple modification:
```
private void scheduleMailboxMetrics() {
systemTimerService.registerTimer(
systemTimerService.getCurrentProcessingTime() +
mailboxMetricsInterval,
timestamp -> {
long startTime =
SystemClock.getInstance().relativeTimeMillis();
Thread.sleep(2000); // <<<<< added sleep
mainMailboxExecutor.execute(...);
}
```
the test is failing so you can see it won't be stable in case of JVM hiccups.
> it does not call the StreamTask#invoke method
Yes, that's the downside. If needed we can have detailed correctness test
(a) implemented with the mailbox test harness, where we can do proper
assertions easily complemented with a basic test (b) that performs some trivial
assertion that `scheduleMailboxMetrics()` has been called in the
`StreamTask#invoke`. (a) would be as I described above. (b) could be a
simplified version of this test, that just do a while true loop as long as
reported latency is > 0ms.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]