[client] Try next DNS upstream on SERVFAIL/REFUSED responses#5163
[client] Try next DNS upstream on SERVFAIL/REFUSED responses#5163
Conversation
📝 WalkthroughWalkthroughThe changes add enhanced DNS logging with Changes
Sequence DiagramsequenceDiagram
participant Client
participant Local as Local DNS<br/>(upstream.go)
participant U1 as Upstream 1
participant U2 as Upstream 2
participant Logger
Client->>Local: DNS Query (request_id, dns_id)
rect rgba(100, 150, 200, 0.5)
Note over Local: tryUpstreamServers:<br/>Aggregate failures
Local->>U1: Query
alt U1 Success
U1-->>Local: Response
Local-->>Client: Return Response
else U1 Failure
U1-->>Local: Error/Timeout
Local->>Local: Record upstreamFailure
Local->>U2: Query
alt U2 Success
U2-->>Local: Response
Local-->>Client: Return Response
else U2 Failure
U2-->>Local: Error/Timeout
Local->>Local: Record upstreamFailure
Local->>Logger: logUpstreamFailures<br/>(summarize all failures)
Logger-->>Local: Ack
Local->>Local: writeErrorResponse
Local-->>Client: Error Response
end
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Describe your changes
Previously, we would only try the next upstream server if there was no response/timeout or any other query error.
Instead, we should also try the next upstream if the queried server reported issues.
This PR also improves logging for upstream failures.
Example when one fails (end result = success):
Example when all fail:
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.