-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] add a DNS cache #3197
[core] add a DNS cache #3197
Conversation
@@ -209,6 +212,8 @@ def __sizeof__(self): | |||
|
|||
def get_url(self, endpoint, api_key): | |||
endpoint_base_url = get_url_endpoint(endpoint) | |||
if self._application.agent_dns_caching: | |||
endpoint_base_url = self._application.get_from_dns_cache(endpoint_base_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could mess up the SSL/TLS verification, which is domain name based. This sort of DNS caching would therefore require making the requests with verify=False
. Big issue because it would open the door to man-in-the-middle attacks. That said, that option already exists in the agent.
[core][tests] further test fixes.
de4fd8f
to
5ac2145
Compare
Should we document the option in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works and indeed requires skip_ssl_validation: yes
.
LGTM!
I'm not sure it's worth documenting (since it requires disabling the SSL validation), it's only useful in very specific cases that usually go through support.
What does this PR do?
This PR adds a DNS cache to the agent, if disabled the agent just skips any local DNS resolution. Otherwise we've implemented a very simple cache that should allow us to reduce the number of DNS queries made.
Motivation
A customer was complaining about too many DNS queries. We suggested some local caching like
dnsmasq
, apparently that was not an option for them. Unfortunately there was no way to do this usingrequests
, which was the preferred approach.Testing Guidelines
An overview on testing
is available in our contribution guidelines.