mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
stats: add counter for timed out queries
Add counter `num_queries_timed_out` meaning queries that were sitting in the socket queue and waiting to being processed too long. There is no reason to process such queries, so let's drop it in the very beginning of the pipeline. Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
This commit is contained in:
parent
04540f82e5
commit
e577ab105e
5 changed files with 16 additions and 0 deletions
|
|
@ -679,6 +679,8 @@ print_stats(RES* ssl, const char* nm, struct ub_stats_info* s)
|
|||
(unsigned long)s->svr.num_queries_missed_cache)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.prefetch"SQ"%lu\n", nm,
|
||||
(unsigned long)s->svr.num_queries_prefetch)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.queries_timed_out"SQ"%lu\n", nm,
|
||||
(unsigned long)s->svr.num_queries_timed_out)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.expired"SQ"%lu\n", nm,
|
||||
(unsigned long)s->svr.ans_expired)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%lu\n", nm,
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ void server_stats_add(struct ub_stats_info* total, struct ub_stats_info* a)
|
|||
total->svr.num_queries_ip_ratelimited += a->svr.num_queries_ip_ratelimited;
|
||||
total->svr.num_queries_missed_cache += a->svr.num_queries_missed_cache;
|
||||
total->svr.num_queries_prefetch += a->svr.num_queries_prefetch;
|
||||
total->svr.num_queries_timed_out += a->svr.num_queries_timed_out;
|
||||
total->svr.sum_query_list_size += a->svr.sum_query_list_size;
|
||||
total->svr.ans_expired += a->svr.ans_expired;
|
||||
#ifdef USE_DNSCRYPT
|
||||
|
|
|
|||
|
|
@ -1296,6 +1296,16 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
verbose(VERB_ALGO, "handle request called with err=%d", error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (worker->env.cfg->sock_queue_timeout && timeval_isset(c->recv_tv)) {
|
||||
c->recv_tv.tv_sec += worker->env.cfg->sock_queue_timeout;
|
||||
if (timeval_smaller(c->recv_tv, worker->env.now_tv)) {
|
||||
/* count and drop queries that were sitting in the socket queue too long */
|
||||
worker->stats.num_queries_timed_out++;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_DNSCRYPT
|
||||
repinfo->max_udp_size = worker->daemon->cfg->max_udp_size;
|
||||
if(!dnsc_handle_curved_request(worker->daemon->dnscenv, repinfo)) {
|
||||
|
|
|
|||
|
|
@ -699,6 +699,8 @@ struct ub_server_stats {
|
|||
long long num_queries_missed_cache;
|
||||
/** number of prefetch queries - cachehits with prefetch */
|
||||
long long num_queries_prefetch;
|
||||
/** number of queries which are too late to process */
|
||||
long long num_queries_timed_out;
|
||||
|
||||
/**
|
||||
* Sum of the querylistsize of the worker for
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ static void pr_stats(const char* nm, struct ub_stats_info* s)
|
|||
s->svr.num_queries - s->svr.num_queries_missed_cache);
|
||||
PR_UL_NM("num.cachemiss", s->svr.num_queries_missed_cache);
|
||||
PR_UL_NM("num.prefetch", s->svr.num_queries_prefetch);
|
||||
PR_UL_NM("num.queries_timed_out", s->svr.num_queries_timed_out);
|
||||
PR_UL_NM("num.expired", s->svr.ans_expired);
|
||||
PR_UL_NM("num.recursivereplies", s->mesh_replies_sent);
|
||||
#ifdef USE_DNSCRYPT
|
||||
|
|
|
|||
Loading…
Reference in a new issue