Merge pull request #47417 from thaJeztah/resolver_improve_logs

libnetwork: resolve: use structured logs for DNS error
This commit is contained in:
Sebastiaan van Stijn 2024-02-21 10:41:06 +01:00 committed by GitHub
commit c42ae61e62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -576,7 +576,7 @@ func (r *Resolver) exchange(ctx context.Context, proto string, extDNS extDNSEntr
UDPSize: dns.MaxMsgSize,
}).ExchangeWithConn(query, &dns.Conn{Conn: extConn})
if err != nil {
r.log(ctx).WithError(err).Errorf("[resolver] failed to query DNS server: %s, query: %s", extConn.RemoteAddr().String(), query.Question[0].String())
logger.WithError(err).Error("[resolver] failed to query external DNS server")
span.RecordError(err)
span.SetStatus(codes.Error, "ExchangeWithConn failed")
return nil