Pull request 2334: AGDNS-2627-query-statistics
Merge in DNS/adguard-home from AGDNS-2627-query-statistics to master
Squashed commit of the following:
commit 9bfdadfddda04404742683d69f6455a56ae68763
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Jan 30 14:40:06 2025 +0300
chlog: fix typo
commit 73764b79bda4dd26695160ab7cee6f222ed0e3a9
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Jan 30 14:14:56 2025 +0300
chlog: fix typo
commit 5900b360feb12ced95d10fd11510d81450cd5443
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Jan 30 14:10:34 2025 +0300
all: upd chlog
commit 4a9d79a2596839d16f18e45dd13939cdc011361e
Merge: 76d037122 cc2006f61
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Jan 30 14:01:46 2025 +0300
Merge branch 'master' into AGDNS-2627-query-statistics
commit 76d0371220c3a6268e0fb0e775a01ab5a609e443
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Mon Jan 27 20:32:44 2025 +0300
all: upd chlog
commit 496cbba94ec8c1684001f8ed0245b51a73d5bffe
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Jan 23 19:44:26 2025 +0300
all: imp code
commit 4795a2c8fbf49cede106641e97892c008dccd2e9
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Tue Jan 21 17:48:00 2025 +0300
all: query statistics
This commit is contained in:
@@ -122,9 +122,14 @@ func (s *Server) logQuery(dctx *dnsContext, ip net.IP, processingTime time.Durat
|
||||
|
||||
if pctx.Upstream != nil {
|
||||
p.Upstream = pctx.Upstream.Address()
|
||||
} else if cachedUps := pctx.CachedUpstreamAddr; cachedUps != "" {
|
||||
p.Upstream = pctx.CachedUpstreamAddr
|
||||
p.Cached = true
|
||||
}
|
||||
|
||||
if qs := pctx.QueryStatistics(); qs != nil {
|
||||
ms := qs.Main()
|
||||
if len(ms) == 1 && ms[0].IsCached {
|
||||
p.Upstream = ms[0].Address
|
||||
p.Cached = true
|
||||
}
|
||||
}
|
||||
|
||||
s.queryLog.Add(p)
|
||||
@@ -134,15 +139,18 @@ func (s *Server) logQuery(dctx *dnsContext, ip net.IP, processingTime time.Durat
|
||||
func (s *Server) updateStats(dctx *dnsContext, clientIP string, processingTime time.Duration) {
|
||||
pctx := dctx.proxyCtx
|
||||
|
||||
var upstreamStats []*proxy.UpstreamStatistics
|
||||
qs := pctx.QueryStatistics()
|
||||
if qs != nil {
|
||||
upstreamStats = append(upstreamStats, qs.Main()...)
|
||||
upstreamStats = append(upstreamStats, qs.Fallback()...)
|
||||
}
|
||||
|
||||
e := &stats.Entry{
|
||||
UpstreamStats: upstreamStats,
|
||||
Domain: aghnet.NormalizeDomain(pctx.Req.Question[0].Name),
|
||||
Result: stats.RNotFiltered,
|
||||
ProcessingTime: processingTime,
|
||||
UpstreamTime: pctx.QueryDuration,
|
||||
}
|
||||
|
||||
if pctx.Upstream != nil {
|
||||
e.Upstream = pctx.Upstream.Address()
|
||||
}
|
||||
|
||||
if clientID := dctx.clientID; clientID != "" {
|
||||
|
||||
Reference in New Issue
Block a user