Add metric for queries which never see an answer.

This commit is contained in:
Simon Kelley
2022-09-15 22:06:39 +01:00
parent 9a9f6e147c
commit 7a74037267
3 changed files with 4 additions and 0 deletions

View File

@@ -2790,6 +2790,7 @@ static struct frec *get_new_frec(time_t now, struct server *master, int force)
{ {
if (difftime(now, f->time) >= 4*TIMEOUT) if (difftime(now, f->time) >= 4*TIMEOUT)
{ {
daemon->metrics[METRIC_DNS_UNANSWERED_QUERY]++;
free_frec(f); free_frec(f);
target = f; target = f;
} }
@@ -2811,6 +2812,7 @@ static struct frec *get_new_frec(time_t now, struct server *master, int force)
if (!target && oldest && ((int)difftime(now, oldest->time)) >= TIMEOUT) if (!target && oldest && ((int)difftime(now, oldest->time)) >= TIMEOUT)
{ {
/* can't find empty one, use oldest if there is one and it's older than timeout */ /* can't find empty one, use oldest if there is one and it's older than timeout */
daemon->metrics[METRIC_DNS_UNANSWERED_QUERY]++;
free_frec(oldest); free_frec(oldest);
target = oldest; target = oldest;
} }

View File

@@ -23,6 +23,7 @@ const char * metric_names[] = {
"dns_auth_answered", "dns_auth_answered",
"dns_local_answered", "dns_local_answered",
"dns_stale_answered", "dns_stale_answered",
"dns_unanswered",
"bootp", "bootp",
"pxe", "pxe",
"dhcp_ack", "dhcp_ack",

View File

@@ -22,6 +22,7 @@ enum {
METRIC_DNS_AUTH_ANSWERED, METRIC_DNS_AUTH_ANSWERED,
METRIC_DNS_LOCAL_ANSWERED, METRIC_DNS_LOCAL_ANSWERED,
METRIC_DNS_STALE_ANSWERED, METRIC_DNS_STALE_ANSWERED,
METRIC_DNS_UNANSWERED_QUERY,
METRIC_BOOTP, METRIC_BOOTP,
METRIC_PXE, METRIC_PXE,
METRIC_DHCPACK, METRIC_DHCPACK,