Subnet4Ptr subnet;
handle.getArgument("subnet4", subnet);
- if (!query) {
- /// @todo this needs to be logged
- return (0);
- }
-
- LOG_DEBUG(perfmon_logger, DBGLVL_TRACE_DETAIL, PERFMON_DHCP4_PKT_EVENTS)
- .arg(query->getLabel())
- .arg(query->dumpPktEvents());
try {
mgr->processPktEventStack(query, response, subnet->getID());
} catch (const std::exception& ex) {
Subnet6Ptr subnet;
handle.getArgument("subnet6", subnet);
- if (!query) {
- /// @todo this needs to be logged
- return (0);
- }
-
- LOG_DEBUG(perfmon_logger, DBGLVL_TRACE_DETAIL, PERFMON_DHCP6_PKT_EVENTS)
- .arg(query->getLabel())
- .arg(query->dumpPktEvents());
-
try {
mgr->processPktEventStack(query, response, subnet->getID());
} catch (const std::exception& ex) {
using namespace isc::data;
using namespace isc::dhcp;
+using namespace isc::log;
using namespace isc::stats;
using namespace isc::util;
using namespace boost::posix_time;
<< events.size());
}
- // no subnet id?
+ LOG_DEBUG(perfmon_logger, DBGLVL_TRACE_DETAIL,
+ (family_ == AF_INET ? PERFMON_DHCP4_PKT_EVENTS : PERFMON_DHCP6_PKT_EVENTS))
+ .arg(query->getLabel())
+ .arg(query->dumpPktEvents());
+
+ // If monitoring is disabled, then punt.
+ if (!enable_monitoring_) {
+ return;
+ }
boost::posix_time::ptime start_time;
boost::posix_time::ptime prev_time;
void testProcessPktEventStack() {
// Minimal valid configuration.
std::string valid_config =
- R"({ "enable-monitoring": true })";
+ R"({ "enable-monitoring": false })";
ASSERT_NO_THROW_LOG(createMgr(valid_config));
query->addPktEvent("process_completed", event_time);
// Now process the packets on two different subnets.
+ // With monitoring disabled no duration data should be stored.
ASSERT_NO_THROW_LOG(mgr_->processPktEventStack(query, response, 22));
ASSERT_NO_THROW_LOG(mgr_->processPktEventStack(query, response, 33));
// Fetch all the durations in primary key order.
MonitoredDurationCollectionPtr durations = mgr_->getDurationStore()->getAll();
+ ASSERT_EQ(durations->size(), 0);
+
+ // Enabled monitoring and process the queries again.
+ mgr_->setEnableMonitoring(true);
+ ASSERT_NO_THROW_LOG(mgr_->processPktEventStack(query, response, 22));
+ ASSERT_NO_THROW_LOG(mgr_->processPktEventStack(query, response, 33));
+
+ // Fetch all the durations in primary key order.
+ durations = mgr_->getDurationStore()->getAll();
ASSERT_EQ(durations->size(), 12);
// Contains the expected values for single duration.