2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 09:05:40 +00:00

Expose the TCP client count in statistics channel

The statistics channel does not expose the current number of TCP clients
connected, only the highwater. Therefore, users did not have an easy
means to collect statistics about TCP clients served over time. This
information could only be measured as a seperate mechanism via rndc by
looking at the TCP quota filled.

In order to expose the exact current count of connected TCP clients
(tracked by the "tcp-clients" quota) as a statistics counter, an
extra, dedicated Network Manager callback would need to be
implemented for that purpose (a counterpart of ns__client_tcpconn()
that would be run when a TCP connection is torn down), which is
inefficient. Instead, track the number of currently-connected TCP
clients separately for IPv4 and IPv6, as Network Manager statistics.
This commit is contained in:
Aydın Mercan
2024-01-02 16:28:46 +03:00
parent 8ce0956117
commit 2690dc48d3
5 changed files with 20 additions and 5 deletions

View File

@@ -855,6 +855,10 @@ accept_connection(isc_nmsocket_t *csock) {
UV_RUNTIME_CHECK(uv_timer_init, r);
uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock);
if (csock->server->pquota != NULL) {
isc__nm_incstats(csock, STATID_CLIENTS);
}
/*
* We need to initialize the tcp and timer before failing because
* isc__nm_tcp_close() can't handle uninitalized TCP nmsocket.
@@ -1105,6 +1109,7 @@ tcp_close_sock(isc_nmsocket_t *sock) {
if (sock->server != NULL) {
if (sock->server->pquota != NULL) {
isc__nm_decstats(sock, STATID_CLIENTS);
isc_quota_release(sock->server->pquota);
}
isc__nmsocket_detach(&sock->server);