2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-05 08:25:16 +00:00

[#2797] add lease reuse statistics

v4 reuses leases both on fake allocation and on real allocation, while
v6 only reuses leases on real allocation. This is a discrepancy that is
also exposed in the statistics, and may seem confusing. However, this
seems like the candidate for a new issue.
This commit is contained in:
Andrei Pavel
2023-04-28 15:11:16 +03:00
parent 784708e03c
commit df49587577
4 changed files with 54 additions and 2 deletions

View File

@@ -136,7 +136,8 @@ std::set<std::string> dhcp4_statistics = {
"v4-allocation-fail-subnet",
"v4-allocation-fail-no-pools",
"v4-allocation-fail-classes",
"v4-reservation-conflicts"
"v4-reservation-conflicts",
"v4-lease-reuses",
};
} // end of anonymous namespace
@@ -2852,6 +2853,12 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) {
.arg(query->getLabel())
.arg(lease->addr_.toText())
.arg(Lease::lifetimeToText(lease->valid_lft_));
// Increment the reuse statistics.
StatsMgr::instance().addValue("v4-lease-reuses", int64_t(1));
StatsMgr::instance().addValue(StatsMgr::generateName("subnet", lease->subnet_id_,
"v4-lease-reuses"),
int64_t(1));
}
// IP Address Lease time (type 51)