NIFI-8722: Updated Quest DB to account for newly added connection status metrics (#5181)
Co-authored-by: Bence Simon <simonbence>
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbQueries.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbQueries.java
index a773a2e..1498601 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbQueries.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/questdb/QuestDbQueries.java
@@ -86,7 +86,10 @@
"outputBytes LONG," +
"outputCount LONG," +
"queuedBytes LONG," +
- "queuedCount LONG" +
+ "queuedCount LONG," +
+ "totalQueuedDuration LONG," +
+ "maxQueuedDuration LONG," +
+ "averageQueuedDuration LONG" +
") TIMESTAMP(capturedAt) PARTITION BY DAY";
public static final String CREATE_PROCESS_GROUP_STATUS =
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/storage/questdb/QuestDbConnectionStatusStorage.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/storage/questdb/QuestDbConnectionStatusStorage.java
index 8755bbc..fcc5655 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/storage/questdb/QuestDbConnectionStatusStorage.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/storage/questdb/QuestDbConnectionStatusStorage.java
@@ -35,6 +35,9 @@
METRICS.put(5, ConnectionStatusDescriptor.OUTPUT_COUNT.getDescriptor());
METRICS.put(6, ConnectionStatusDescriptor.QUEUED_BYTES.getDescriptor());
METRICS.put(7, ConnectionStatusDescriptor.QUEUED_COUNT.getDescriptor());
+ METRICS.put(8, ConnectionStatusDescriptor.TOTAL_QUEUED_DURATION.getDescriptor());
+ METRICS.put(9, ConnectionStatusDescriptor.MAX_QUEUED_DURATION.getDescriptor());
+ METRICS.put(10, ConnectionStatusDescriptor.AVERAGE_QUEUED_DURATION.getDescriptor());
}
public QuestDbConnectionStatusStorage(final QuestDbContext dbContext, final ComponentDetailsStorage componentDetails) {
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/AbstractStatusHistoryRepositoryTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/AbstractStatusHistoryRepositoryTest.java
index b80d7c0..6288080 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/AbstractStatusHistoryRepositoryTest.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/status/history/AbstractStatusHistoryRepositoryTest.java
@@ -161,6 +161,10 @@
status.setOutputBytes(106);
status.setMaxQueuedCount(107);
status.setMaxQueuedBytes(108);
+
+ status.setTotalQueuedDuration(103L * 110L);
+ status.setMaxQueuedDuration(111);
+
return status;
}
@@ -261,6 +265,10 @@
Assert.assertEquals(105L, snapshot.getStatusMetric(ConnectionStatusDescriptor.OUTPUT_COUNT.getDescriptor()).longValue());
Assert.assertEquals(104L, snapshot.getStatusMetric(ConnectionStatusDescriptor.QUEUED_BYTES.getDescriptor()).longValue());
Assert.assertEquals(103L, snapshot.getStatusMetric(ConnectionStatusDescriptor.QUEUED_COUNT.getDescriptor()).longValue());
+
+ Assert.assertEquals(103L * 110L, snapshot.getStatusMetric(ConnectionStatusDescriptor.TOTAL_QUEUED_DURATION.getDescriptor()).longValue());
+ Assert.assertEquals(111L, snapshot.getStatusMetric(ConnectionStatusDescriptor.MAX_QUEUED_DURATION.getDescriptor()).longValue());
+ Assert.assertEquals(110L, snapshot.getStatusMetric(ConnectionStatusDescriptor.AVERAGE_QUEUED_DURATION.getDescriptor()).longValue());
}
protected void assertRemoteProcessGroupSnapshot(final StatusSnapshot snapshot) {