2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Merge branch '4668-request-to-add-a-new-statistic-recursive-client-high-water-in-rndc-status-and-stats-channel' into 'main'

Add new statistics variable for recursive client high-water

Closes #4668

See merge request isc-projects/bind9!9023
This commit is contained in:
Aydın Mercan 2024-05-10 10:52:51 +00:00
commit aa860b3ab1
9 changed files with 33 additions and 11 deletions

View File

@ -1,3 +1,8 @@
6387. [func] Added a new statistics variable "recursive high-water"
that reports the maximum number of simultaneous
recursive clients BIND has handled while running.
[GL #4668]
6386. [bug] When shutting down catzs->view could point to freed
memory. Obtain a reference to the view to prevent this.
[GL #4502]

View File

@ -12184,6 +12184,12 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
isc_quota_getmax(&server->sctx->recursionquota));
CHECK(putstr(text, line));
snprintf(line, sizeof(line), "recursive high-water: %u\n",
(unsigned int)ns_stats_get_counter(
server->sctx->nsstats,
ns_statscounter_recurshighwater));
CHECK(putstr(text, line));
snprintf(line, sizeof(line), "tcp clients: %u/%u\n",
isc_quota_getused(&server->sctx->tcpquota),
isc_quota_getmax(&server->sctx->tcpquota));

View File

@ -327,6 +327,8 @@ init_desc(void) {
SET_NSSTATDESC(updatebadprereq,
"updates rejected due to prerequisite failure",
"UpdateBadPrereq");
SET_NSSTATDESC(recurshighwater, "Recursive clients high-water",
"RecursHighwater");
SET_NSSTATDESC(recursclients, "recursing clients", "RecursClients");
SET_NSSTATDESC(dns64, "queries answered by DNS64", "DNS64");
SET_NSSTATDESC(ratedropped, "responses dropped for rate limits",

View File

@ -20,7 +20,9 @@ Security Fixes
New Features
~~~~~~~~~~~~
- None.
- Added a new statistics variable ``recursive high-water`` that reports
the maximum number of simultaneous recursive clients BIND has handled
while running. :gl:`#4668`
Removed Features
~~~~~~~~~~~~~~~~

View File

@ -137,10 +137,10 @@ isc_stats_ncounters(isc_stats_t *stats);
*
*/
void
isc_statscounter_t
isc_stats_increment(isc_stats_t *stats, isc_statscounter_t counter);
/*%<
* Increment the counter-th counter of stats.
* Increment the counter-th counter of stats and return the old value.
*
* Requires:
*\li 'stats' is a valid isc_stats_t.

View File

@ -97,12 +97,12 @@ isc_stats_create(isc_mem_t *mctx, isc_stats_t **statsp, int ncounters) {
*statsp = stats;
}
void
isc_statscounter_t
isc_stats_increment(isc_stats_t *stats, isc_statscounter_t counter) {
REQUIRE(ISC_STATS_VALID(stats));
REQUIRE(counter < stats->ncounters);
atomic_fetch_add_relaxed(&stats->counters[counter], 1);
return (atomic_fetch_add_relaxed(&stats->counters[counter], 1));
}
void

View File

@ -112,7 +112,9 @@ enum {
ns_statscounter_updatequota = 67,
ns_statscounter_max = 68,
ns_statscounter_recurshighwater = 68,
ns_statscounter_max = 69,
};
void
@ -124,7 +126,7 @@ ns_stats_detach(ns_stats_t **statsp);
void
ns_stats_create(isc_mem_t *mctx, int ncounters, ns_stats_t **statsp);
void
isc_statscounter_t
ns_stats_increment(ns_stats_t *stats, isc_statscounter_t counter);
void

View File

@ -2483,6 +2483,7 @@ free_fresp(ns_client_t *client, dns_fetchresponse_t **frespp) {
static isc_result_t
recursionquotatype_attach(ns_client_t *client, bool soft_limit) {
isc_statscounter_t recurscount;
isc_result_t result;
result = isc_quota_acquire(&client->manager->sctx->recursionquota);
@ -2505,8 +2506,12 @@ recursionquotatype_attach(ns_client_t *client, bool soft_limit) {
return (result);
}
ns_stats_increment(client->manager->sctx->nsstats,
ns_statscounter_recursclients);
recurscount = ns_stats_increment(client->manager->sctx->nsstats,
ns_statscounter_recursclients);
ns_stats_update_if_greater(client->manager->sctx->nsstats,
ns_statscounter_recurshighwater,
recurscount + 1);
return (result);
}

View File

@ -78,11 +78,11 @@ ns_stats_create(isc_mem_t *mctx, int ncounters, ns_stats_t **statsp) {
/*%
* Increment/Decrement methods
*/
void
isc_statscounter_t
ns_stats_increment(ns_stats_t *stats, isc_statscounter_t counter) {
REQUIRE(NS_STATS_VALID(stats));
isc_stats_increment(stats->counters, counter);
return (isc_stats_increment(stats->counters, counter));
}
void