[Dnsmasq-discuss] [PATCH] expose the stale and unanswered metrics through CHAOS records
Karavelov, Luben
luben at amazon.com
Wed Jun 7 22:52:59 UTC 2023
On Wed, 2023-06-07 at 23:15 +0200, Geert Stappers wrote:
>
> It misses
>
> --- a/man/dnsmasq.8
> +++ b/man/dnsmasq.8
> @@ -2248,6 +2248,7 @@ Do not respond to class CHAOS and type TXT in domain bind queries.
> Without this option being set, the cache statistics are also available in the
> DNS as answers to queries of class CHAOS and type TXT in domain bind. The domain
> names are cachesize.bind, insertions.bind, evictions.bind, misses.bind,
> +stale.bind, unanswered.bind,
> hits.bind, auth.bind and servers.bind unless disabled at compile-time. An
> example command to query this, using the
> .B dig
>
>
> Regards
> Geert Stappers
> Mostly saying "the patch has been seen"
> --
> Silence is hard to parse
Thanks for noticing the miss - I forgot about the man page.
Below is the fixed patch.
One related question. I noticed that in the DBUS servers stats
now we report also the average response latencies. If we want
to also expose them through CHAOS, should we extend the
existing "servers.bind" with another field, or should we
create a new name with the extended metrics?
Best regards,
luben
Adding two new chaos names:
- stale.bind
- unanswered.bind
that expose the dns_stale_answered and dns_unanswered metrics.
---
man/dnsmasq.8 | 4 ++--
src/cache.c | 8 ++++++++
src/dnsmasq.h | 2 ++
src/option.c | 2 ++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
index 30429df..1036635 100644
--- a/man/dnsmasq.8
+++ b/man/dnsmasq.8
@@ -2247,8 +2247,8 @@ Do not respond to class CHAOS and type TXT in domain bind queries.
Without this option being set, the cache statistics are also available in the
DNS as answers to queries of class CHAOS and type TXT in domain bind. The domain
-names are cachesize.bind, insertions.bind, evictions.bind, misses.bind,
-hits.bind, auth.bind and servers.bind unless disabled at compile-time. An
+names are cachesize.bind, insertions.bind, evictions.bind, misses.bind, stale.bind,
+unanswered.bind, hits.bind, auth.bind and servers.bind unless disabled at compile-time. An
example command to query this, using the
.B dig
utility would be
diff --git a/src/cache.c b/src/cache.c
index 1c0e250..daacbaa 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1725,6 +1725,14 @@ int cache_make_stat(struct txt_record *t)
break;
#endif
+ case TXT_STAT_STALE:
+ sprintf(buff+1, "%u", daemon->metrics[METRIC_DNS_STALE_ANSWERED]);
+ break;
+
+ case TXT_STAT_UNANSWERED:
+ sprintf(buff+1, "%u", daemon->metrics[METRIC_DNS_UNANSWERED_QUERY]);
+ break;
+
case TXT_STAT_SERVERS:
/* sum counts from different records for same server */
for (serv = daemon->servers; serv; serv = serv->next)
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
index 2f95c12..08e6888 100644
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -380,6 +380,8 @@ struct naptr {
#define TXT_STAT_HITS 5
#define TXT_STAT_AUTH 6
#define TXT_STAT_SERVERS 7
+#define TXT_STAT_STALE 8
+#define TXT_STAT_UNANSWERED 9
#endif
struct txt_record {
diff --git a/src/option.c b/src/option.c
index 8322725..2b2705e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5947,6 +5947,8 @@ void read_opts(int argc, char **argv, char *compile_opts)
add_txt("auth.bind", NULL, TXT_STAT_AUTH);
#endif
add_txt("servers.bind", NULL, TXT_STAT_SERVERS);
+ add_txt("stale.bind", NULL, TXT_STAT_STALE);
+ add_txt("unanswered.bind", NULL, TXT_STAT_UNANSWERED);
}
#endif
--
2.25.1
c
More information about the Dnsmasq-discuss
mailing list