]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2611] Added queue-mgr-queue-full stat to D2
authorThomas Markwalder <tmark@isc.org>
Wed, 5 Jun 2024 18:58:11 +0000 (14:58 -0400)
committerRazvan Becheriu <razvan@isc.org>
Fri, 7 Jun 2024 11:49:16 +0000 (14:49 +0300)
src/bin/d2/d2_queue_mgr.cc
    D2QueueMgr::operator() - increments queue-full stat

src/bin/d2/tests/d2_queue_mgr_unittests.cc
    TEST_F (QueueMgrUDPTest, liveFeed) - modified to verify
    new stat

src/lib/d2srv/d2_stats.*
    Added new stat to D2Stats::ncr

src/bin/d2/d2_queue_mgr.cc
src/bin/d2/tests/d2_queue_mgr_unittests.cc
src/lib/d2srv/d2_stats.cc
src/lib/d2srv/d2_stats.h

index d99264b93cced83bf6a7d702f94da6a8098e314d..f902b221b83ac9356f081fefc7e47efdfc048d43 100644 (file)
@@ -8,6 +8,9 @@
 #include <d2/d2_queue_mgr.h>
 #include <d2srv/d2_log.h>
 #include <dhcp_ddns/ncr_udp.h>
+#include <stats/stats_mgr.h>
+
+using namespace isc::stats;
 
 namespace isc {
 namespace d2 {
@@ -60,6 +63,7 @@ D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result,
             // is no receive in progress.
             LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_QUEUE_FULL)
                       .arg(max_queue_size_);
+            StatsMgr::instance().addValue("queue-mgr-queue-full", static_cast<int64_t>(1));
             stopListening(STOPPED_QUEUE_FULL);
             break;
 
index 97a21d88a6f17fcbbbc703f23b221a9b3c2a9a7c..7a1c5d00aa5e0dcd9dea530e7d55c7290f5241b6 100644 (file)
@@ -403,7 +403,8 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
     StatMap stats_ncr = {
         { "ncr-received", 3},
         { "ncr-invalid", 0},
-        { "ncr-error", 0}
+        { "ncr-error", 0},
+        { "queue-mgr-queue-full", 0}
     };
     checkStats(stats_ncr);
 
@@ -423,7 +424,8 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
     StatMap stats_ncr_new = {
         { "ncr-received", 6},
         { "ncr-invalid", 0},
-        { "ncr-error", 0}
+        { "ncr-error", 0},
+        { "queue-mgr-queue-full", 0}
     };
     checkStats(stats_ncr_new);
 
@@ -439,6 +441,14 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
     EXPECT_NO_THROW(io_service_->runOne());
     EXPECT_EQ(D2QueueMgr::STOPPED_QUEUE_FULL, queue_mgr_->getMgrState());
 
+    StatMap stats_ncr_full = {
+        { "ncr-received", 7},
+        { "ncr-invalid", 0},
+        { "ncr-error", 0},
+        { "queue-mgr-queue-full", 1}
+    };
+    checkStats(stats_ncr_full);
+
     // Verify queue size did not increase beyond max.
     EXPECT_EQ(VALID_MSG_CNT, queue_mgr_->getQueueSize());
 
index 5db006923ef9fe7dbe543e1281acf0e12bca71d0..ce9401bd95119687342f177fd040bf85d2d821c8 100644 (file)
@@ -21,7 +21,8 @@ const list<string>
 D2Stats::ncr = {
     "ncr-received",
     "ncr-invalid",
-    "ncr-error"
+    "ncr-error",
+    "queue-mgr-queue-full"
 };
 
 const list<string>
index b4122b4910672b4ea20ddbbb8ec067c75789aa80..10e1526f74b971cb4bc040310a48fa68c25bc9ab 100644 (file)
@@ -21,6 +21,7 @@ public:
     /// - ncr-received
     /// - ncr-invalid
     /// - ncr-error
+    /// - queue-mgr-queue-full
     static const std::list<std::string> ncr;
 
     /// @brief Global DNS update statistics names.