Skip to content

Commit 7e5e609

Browse files
tmarkwalderRazvan Becheriu
authored and
Razvan Becheriu
committed
[#2611] Added queue-mgr-queue-full stat to D2
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
1 parent 1bcbee6 commit 7e5e609

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/bin/d2/d2_queue_mgr.cc

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <d2/d2_queue_mgr.h>
99
#include <d2srv/d2_log.h>
1010
#include <dhcp_ddns/ncr_udp.h>
11+
#include <stats/stats_mgr.h>
12+
13+
using namespace isc::stats;
1114

1215
namespace isc {
1316
namespace d2 {
@@ -60,6 +63,7 @@ D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result,
6063
// is no receive in progress.
6164
LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_QUEUE_FULL)
6265
.arg(max_queue_size_);
66+
StatsMgr::instance().addValue("queue-mgr-queue-full", static_cast<int64_t>(1));
6367
stopListening(STOPPED_QUEUE_FULL);
6468
break;
6569

src/bin/d2/tests/d2_queue_mgr_unittests.cc

+12-2
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
403403
StatMap stats_ncr = {
404404
{ "ncr-received", 3},
405405
{ "ncr-invalid", 0},
406-
{ "ncr-error", 0}
406+
{ "ncr-error", 0},
407+
{ "queue-mgr-queue-full", 0}
407408
};
408409
checkStats(stats_ncr);
409410

@@ -423,7 +424,8 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
423424
StatMap stats_ncr_new = {
424425
{ "ncr-received", 6},
425426
{ "ncr-invalid", 0},
426-
{ "ncr-error", 0}
427+
{ "ncr-error", 0},
428+
{ "queue-mgr-queue-full", 0}
427429
};
428430
checkStats(stats_ncr_new);
429431

@@ -439,6 +441,14 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
439441
EXPECT_NO_THROW(io_service_->runOne());
440442
EXPECT_EQ(D2QueueMgr::STOPPED_QUEUE_FULL, queue_mgr_->getMgrState());
441443

444+
StatMap stats_ncr_full = {
445+
{ "ncr-received", 7},
446+
{ "ncr-invalid", 0},
447+
{ "ncr-error", 0},
448+
{ "queue-mgr-queue-full", 1}
449+
};
450+
checkStats(stats_ncr_full);
451+
442452
// Verify queue size did not increase beyond max.
443453
EXPECT_EQ(VALID_MSG_CNT, queue_mgr_->getQueueSize());
444454

src/lib/d2srv/d2_stats.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const list<string>
2121
D2Stats::ncr = {
2222
"ncr-received",
2323
"ncr-invalid",
24-
"ncr-error"
24+
"ncr-error",
25+
"queue-mgr-queue-full"
2526
};
2627

2728
const list<string>

src/lib/d2srv/d2_stats.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class D2Stats {
2121
/// - ncr-received
2222
/// - ncr-invalid
2323
/// - ncr-error
24+
/// - queue-mgr-queue-full
2425
static const std::list<std::string> ncr;
2526

2627
/// @brief Global DNS update statistics names.

0 commit comments

Comments
 (0)