summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2022-09-16 00:07:36 +0100
committerSimon Kelley <simon@thekelleys.org.uk>2022-09-16 00:07:36 +0100
commit6722ec6c78b96b82956e67b60a8cfc5b155c6659 (patch)
treedd8a498e1932d9d3a0f302db4a69b4eb2f3b4417
parentd882dfdae9b05e5c44389c2bbb9f9b10d9bb0c0f (diff)
downloaddnsmasq-6722ec6c78b96b82956e67b60a8cfc5b155c6659.tar.gz
Split failed queries in retries in stat counting.
-rw-r--r--src/cache.c7
-rw-r--r--src/dbus.c4
-rw-r--r--src/dnsmasq.h2
-rw-r--r--src/forward.c4
4 files changed, 11 insertions, 6 deletions
diff --git a/src/cache.c b/src/cache.c
index 437e777..6e039d5 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1745,7 +1745,7 @@ void dump_cache(time_t now)
if (!(serv->flags & SERV_MARK))
{
int port;
- unsigned int queries = 0, failed_queries = 0, nxdomain_replies = 0;
+ unsigned int queries = 0, failed_queries = 0, nxdomain_replies = 0, retrys = 0;
unsigned int sigma_latency = 0, count_latency = 0;
for (serv1 = serv; serv1; serv1 = serv1->next)
@@ -1755,12 +1755,13 @@ void dump_cache(time_t now)
queries += serv1->queries;
failed_queries += serv1->failed_queries;
nxdomain_replies += serv1->nxdomain_replies;
+ retrys += serv1->retrys;
sigma_latency += serv1->query_latency;
count_latency++;
}
port = prettyprint_addr(&serv->addr, daemon->addrbuff);
- my_syslog(LOG_INFO, _("server %s#%d: queries sent %u, retried or failed %u, nxdomain replies %u, avg. latency %ums"),
- daemon->addrbuff, port, queries, failed_queries, nxdomain_replies, sigma_latency/count_latency);
+ my_syslog(LOG_INFO, _("server %s#%d: queries sent %u, retried %u, failed %u, nxdomain replies %u, avg. latency %ums"),
+ daemon->addrbuff, port, queries, retrys, failed_queries, nxdomain_replies, sigma_latency/count_latency);
}
if (option_bool(OPT_DEBUG) || option_bool(OPT_LOG))
diff --git a/src/dbus.c b/src/dbus.c
index ebd8d7f..65b7221 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -681,7 +681,7 @@ static DBusMessage *dbus_get_server_metrics(DBusMessage* message)
if (!(serv->flags & SERV_MARK))
{
unsigned int port;
- unsigned int queries = 0, failed_queries = 0, nxdomain_replies = 0;
+ unsigned int queries = 0, failed_queries = 0, nxdomain_replies = 0, retrys = 0;
unsigned int sigma_latency = 0, count_latency = 0;
struct server *serv1;
@@ -693,6 +693,7 @@ static DBusMessage *dbus_get_server_metrics(DBusMessage* message)
queries += serv1->queries;
failed_queries += serv1->failed_queries;
nxdomain_replies += serv1->nxdomain_replies;
+ retrys += serv1->retrys;
sigma_latency += serv1->query_latency;
count_latency++;
}
@@ -706,6 +707,7 @@ static DBusMessage *dbus_get_server_metrics(DBusMessage* message)
add_dict_int(&dict_array, "queries", serv->queries);
add_dict_int(&dict_array, "failed_queries", serv->failed_queries);
add_dict_int(&dict_array, "nxdomain", serv->nxdomain_replies);
+ add_dict_int(&dict_array, "retries", serv->retrys);
add_dict_int(&dict_array, "latency", sigma_latency/count_latency;
dbus_message_iter_close_container(&server_array, &dict_array);
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
index f8d7c55..1835a11 100644
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -586,7 +586,7 @@ struct server {
struct serverfd *sfd;
int tcpfd, edns_pktsz;
time_t pktsz_reduced;
- unsigned int queries, failed_queries, nxdomain_replies;
+ unsigned int queries, failed_queries, nxdomain_replies, retrys;
unsigned int query_latency, mma_latency;
time_t forwardtime;
int forwardcount;
diff --git a/src/forward.c b/src/forward.c
index 02f8f81..52d5b8e 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -389,8 +389,10 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
#endif
{
/* retry on existing query, from original source. Send to all available servers */
- if (!fast_retry)
+ if (udpfd == -1 && !fast_retry)
forward->sentto->failed_queries++;
+ else
+ forward->sentto->retrys++;
if (!filter_servers(forward->sentto->arrayposn, F_SERVER, &first, &last))
goto reply;