mirror of
https://github.com/NLnetLabs/unbound.git
synced 2024-09-21 06:37:08 +00:00
- Fix #704: [FR] Statistics counter for number of outgoing UDP queries
sent; introduces 'num.query.udpout' to the 'unbound-control stats' command.
This commit is contained in:
parent
1ceb031b58
commit
b816318106
@ -28,6 +28,7 @@ END {
|
||||
print "unbound_hits_queries{type=\"total.num.prefetch\"} " val["total.num.prefetch"];
|
||||
print "unbound_hits_queries{type=\"num.query.tcp\"} " val["num.query.tcp"];
|
||||
print "unbound_hits_queries{type=\"num.query.tcpout\"} " val["num.query.tcpout"];
|
||||
print "unbound_hits_queries{type=\"num.query.udpout\"} " val["num.query.udpout"];
|
||||
print "unbound_hits_queries{type=\"num.query.tls\"} " val["num.query.tls"];
|
||||
print "unbound_hits_queries{type=\"num.query.tls.resume\"} " val["num.query.tls.resume"];
|
||||
print "unbound_hits_queries{type=\"num.query.ipv6\"} " val["num.query.ipv6"];
|
||||
|
@ -253,6 +253,7 @@ if test "$1" = "config" ; then
|
||||
p_config "total.num.prefetch" "cache prefetch" "ABSOLUTE"
|
||||
p_config "num.query.tcp" "TCP queries" "ABSOLUTE"
|
||||
p_config "num.query.tcpout" "TCP out queries" "ABSOLUTE"
|
||||
p_config "num.query.udpout" "UDP out queries" "ABSOLUTE"
|
||||
p_config "num.query.tls" "TLS queries" "ABSOLUTE"
|
||||
p_config "num.query.tls.resume" "TLS resumes" "ABSOLUTE"
|
||||
p_config "num.query.ipv6" "IPv6 queries" "ABSOLUTE"
|
||||
@ -452,7 +453,7 @@ hits)
|
||||
for x in `grep "^thread[0-9][0-9]*\.num\.queries=" $state |
|
||||
sed -e 's/=.*//'` total.num.queries \
|
||||
total.num.cachehits total.num.prefetch num.query.tcp \
|
||||
num.query.tcpout num.query.tls num.query.tls.resume \
|
||||
num.query.tcpout num.query.udpout num.query.tls num.query.tls.resume \
|
||||
num.query.ipv6 unwanted.queries \
|
||||
unwanted.replies; do
|
||||
if grep "^"$x"=" $state >/dev/null 2>&1; then
|
||||
|
@ -988,6 +988,8 @@ print_ext(RES* ssl, struct ub_stats_info* s)
|
||||
(unsigned long)s->svr.qtcp)) return 0;
|
||||
if(!ssl_printf(ssl, "num.query.tcpout"SQ"%lu\n",
|
||||
(unsigned long)s->svr.qtcp_outgoing)) return 0;
|
||||
if(!ssl_printf(ssl, "num.query.udpout"SQ"%lu\n",
|
||||
(unsigned long)s->svr.qudp_outgoing)) return 0;
|
||||
if(!ssl_printf(ssl, "num.query.tls"SQ"%lu\n",
|
||||
(unsigned long)s->svr.qtls)) return 0;
|
||||
if(!ssl_printf(ssl, "num.query.tls.resume"SQ"%lu\n",
|
||||
|
@ -281,6 +281,7 @@ server_stats_compile(struct worker* worker, struct ub_stats_info* s, int reset)
|
||||
/* values from outside network */
|
||||
s->svr.unwanted_replies = (long long)worker->back->unwanted_replies;
|
||||
s->svr.qtcp_outgoing = (long long)worker->back->num_tcp_outgoing;
|
||||
s->svr.qudp_outgoing = (long long)worker->back->num_udp_outgoing;
|
||||
|
||||
/* get and reset validator rrset bogus number */
|
||||
s->svr.rrset_bogus = (long long)get_rrset_bogus(worker, reset);
|
||||
@ -424,6 +425,7 @@ void server_stats_add(struct ub_stats_info* total, struct ub_stats_info* a)
|
||||
total->svr.qclass_big += a->svr.qclass_big;
|
||||
total->svr.qtcp += a->svr.qtcp;
|
||||
total->svr.qtcp_outgoing += a->svr.qtcp_outgoing;
|
||||
total->svr.qudp_outgoing += a->svr.qudp_outgoing;
|
||||
total->svr.qtls += a->svr.qtls;
|
||||
total->svr.qtls_resume += a->svr.qtls_resume;
|
||||
total->svr.qhttps += a->svr.qhttps;
|
||||
|
@ -2217,6 +2217,7 @@ void worker_stats_clear(struct worker* worker)
|
||||
mesh_stats_clear(worker->env.mesh);
|
||||
worker->back->unwanted_replies = 0;
|
||||
worker->back->num_tcp_outgoing = 0;
|
||||
worker->back->num_udp_outgoing = 0;
|
||||
}
|
||||
|
||||
void worker_start_accept(void* arg)
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
29 June 2022: George
|
||||
- Add debug option to the mini_tdir.sh test code.
|
||||
- Fix #704: [FR] Statistics counter for number of outgoing UDP queries
|
||||
sent; introduces 'num.query.udpout' to the 'unbound-control stats'
|
||||
command.
|
||||
|
||||
28 June 2022: George
|
||||
- Show the output of the exact .rpl run that failed with 'make test'.
|
||||
|
@ -552,6 +552,10 @@ Number of queries that were made using TCP towards the Unbound server.
|
||||
Number of queries that the Unbound server made using TCP outgoing towards
|
||||
other servers.
|
||||
.TP
|
||||
.I num.query.udpout
|
||||
Number of queries that the Unbound server made using UDP outgoing towards
|
||||
other servers.
|
||||
.TP
|
||||
.I num.query.tls
|
||||
Number of queries that were made using TLS towards the Unbound server.
|
||||
These are also counted in num.query.tcp, because TLS uses TCP.
|
||||
|
@ -725,6 +725,8 @@ struct ub_server_stats {
|
||||
long long qtcp;
|
||||
/** number of outgoing queries over TCP */
|
||||
long long qtcp_outgoing;
|
||||
/** number of outgoing queries over UDP */
|
||||
long long qudp_outgoing;
|
||||
/** number of queries over (DNS over) TLS */
|
||||
long long qtls;
|
||||
/** number of queries over (DNS over) HTTPS */
|
||||
|
@ -1608,6 +1608,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
|
||||
outnet->tcp_reuse_timeout= tcp_reuse_timeout;
|
||||
outnet->tcp_auth_query_timeout = tcp_auth_query_timeout;
|
||||
outnet->num_tcp_outgoing = 0;
|
||||
outnet->num_udp_outgoing = 0;
|
||||
outnet->infra = infra;
|
||||
outnet->rnd = rnd;
|
||||
outnet->sslctx = sslctx;
|
||||
@ -2142,6 +2143,7 @@ randomize_and_send_udp(struct pending* pend, sldns_buffer* packet, int timeout)
|
||||
portcomm_loweruse(outnet, pend->pc);
|
||||
return 0;
|
||||
}
|
||||
outnet->num_udp_outgoing++;
|
||||
|
||||
/* system calls to set timeout after sending UDP to make roundtrip
|
||||
smaller. */
|
||||
|
@ -113,6 +113,8 @@ struct outside_network {
|
||||
/** if we perform udp-connect, connect() for UDP socket to mitigate
|
||||
* ICMP side channel leakage */
|
||||
int udp_connect;
|
||||
/** number of udp packets sent. */
|
||||
size_t num_udp_outgoing;
|
||||
|
||||
/** array of outgoing IP4 interfaces */
|
||||
struct port_if* ip4_ifs;
|
||||
|
@ -354,6 +354,7 @@ static void print_extended(struct ub_stats_info* s)
|
||||
/* transport */
|
||||
PR_UL("num.query.tcp", s->svr.qtcp);
|
||||
PR_UL("num.query.tcpout", s->svr.qtcp_outgoing);
|
||||
PR_UL("num.query.udpout", s->svr.qudp_outgoing);
|
||||
PR_UL("num.query.tls", s->svr.qtls);
|
||||
PR_UL("num.query.tls_resume", s->svr.qtls_resume);
|
||||
PR_UL("num.query.ipv6", s->svr.qipv6);
|
||||
|
5
testdata/stat_values.tdir/stat_values.conf
vendored
5
testdata/stat_values.tdir/stat_values.conf
vendored
@ -1,5 +1,5 @@
|
||||
server:
|
||||
verbosity: 2
|
||||
verbosity: 5
|
||||
num-threads: 1
|
||||
interface: 127.0.0.1
|
||||
port: @PORT@
|
||||
@ -11,6 +11,9 @@ server:
|
||||
do-not-query-localhost: no
|
||||
extended-statistics: yes
|
||||
identity: "stat_values"
|
||||
outbound-msg-retry: 0
|
||||
root-key-sentinel: no
|
||||
trust-anchor-signaling: no
|
||||
|
||||
local-zone: local.zone static
|
||||
local-data: "www.local.zone A 192.0.2.1"
|
||||
|
6
testdata/stat_values.tdir/stat_values.test
vendored
6
testdata/stat_values.tdir/stat_values.test
vendored
@ -186,6 +186,7 @@ num.query.opcode.QUERY=1
|
||||
num.query.flags.RD=1
|
||||
num.query.flags.AD=1
|
||||
num.query.edns.present=1
|
||||
num.query.udpout=1
|
||||
msg.cache.count=1
|
||||
rrset.cache.count=1
|
||||
infra.cache.count=1
|
||||
@ -223,6 +224,7 @@ num.query.flags.AD=1
|
||||
num.query.flags.RD=1
|
||||
num.query.opcode.QUERY=1
|
||||
num.query.type.A=1
|
||||
num.query.udpout=1
|
||||
msg.cache.count=1
|
||||
rrset.cache.count=1
|
||||
infra.cache.count=1"
|
||||
@ -249,6 +251,7 @@ num.query.opcode.QUERY=1
|
||||
num.query.flags.RD=1
|
||||
num.query.flags.AD=1
|
||||
num.query.edns.present=1
|
||||
num.query.udpout=1
|
||||
msg.cache.count=2
|
||||
rrset.cache.count=2
|
||||
infra.cache.count=2
|
||||
@ -263,6 +266,7 @@ if grep "192.0.2.1" outfile; then
|
||||
else
|
||||
end 1
|
||||
fi
|
||||
sleep 1 # make sure the outgoing UDP (and the edns1xx0 retry) are accounted for.
|
||||
check_stats "\
|
||||
total.num.queries=1
|
||||
total.num.expired=1
|
||||
@ -274,6 +278,7 @@ num.query.flags.AD=1
|
||||
num.query.flags.RD=1
|
||||
num.query.opcode.QUERY=1
|
||||
num.query.type.A=1
|
||||
num.query.udpout=2
|
||||
total.num.cachemiss=1
|
||||
msg.cache.count=2
|
||||
rrset.cache.count=2
|
||||
@ -327,6 +332,7 @@ num.query.edns.present=1
|
||||
num.query.flags.RD=1
|
||||
num.query.opcode.QUERY=1
|
||||
num.query.type.A=1
|
||||
num.query.udpout=1
|
||||
total.num.queries=1
|
||||
total.num.recursivereplies=1
|
||||
msg.cache.count=3
|
||||
|
Loading…
Reference in New Issue
Block a user