You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dnsforward: collect optimistic refreshes through the proxy
Replace the upstream wrapper with the callback added in
AdguardTeam/dnsproxy#520.
The wrapper could not work. An exchange has to be attributed to the
request it belongs to, both so that the statistics ignore lists apply and
so that a background refresh can be told from a foreground query, and an
upstream.Upstream is given no way to do it: Exchange takes only a *dns.Msg
and no context, and ExchangeParallel and ExchangeAll copy the request once
per upstream before calling it, so no identity of the original survives.
The request-pointer key therefore missed in parallel and fastest-address
mode with more than one upstream, and queries from clients with ignored
statistics were counted after all. Only the single-upstream path skips
the copy, which is why the first regression passed.
Foreground exchanges go back to being collected from
proxy.DNSContext.QueryStatistics, which is client-attributed and already
gated by ShouldCount, so the ignore lists behave exactly as they did
before this branch. Background refreshes arrive through
proxy.Config.OnOptimisticRefresh, which fires once the optimistic cache
has refreshed an expired entry; they belong to no client by construction,
so there is nothing to attribute and nothing to double count.
A retried exchange is still left out, but the check moved to where the
statistics entry is built, and compares against the timeout the upstreams
of that request were constructed with: defaultLocalTimeout for private
rDNS, the configured one otherwise.
Both are covered end to end, and both regressions fail against the
unfixed implementation: the retry filter in load-balance, parallel, and
fastest-address mode, and the refresh collection against an entry that
expires while the test runs.
0 commit comments