From b727b6a2435925c407ad44daf2266bdd53864c58 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Wed, 28 Jun 2023 10:31:56 -0700 Subject: [PATCH 1/2] Reduce logging of common redirects and expected items This should massively reduce the amount of logs we're showing: --- readthedocs/proxito/redirects.py | 4 ++-- readthedocs/proxito/views/mixins.py | 4 ++-- readthedocs/proxito/views/serve.py | 4 +--- readthedocs/search/documents.py | 4 ++-- readthedocs/search/faceted_search.py | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/readthedocs/proxito/redirects.py b/readthedocs/proxito/redirects.py index 221b18a35b7..a406657c248 100644 --- a/readthedocs/proxito/redirects.py +++ b/readthedocs/proxito/redirects.py @@ -76,13 +76,13 @@ def canonical_redirect(request, project, redirect_type, external_version_slug=No if from_url == to: # check that we do have a response and avoid infinite redirect - log.warning( + log.debug( "Infinite Redirect: FROM URL is the same than TO URL.", url=to, ) raise InfiniteRedirectException() - log.info( + log.debug( "Canonical Redirect.", host=request.get_host(), from_url=from_url, to_url=to ) resp = HttpResponseRedirect(to) diff --git a/readthedocs/proxito/views/mixins.py b/readthedocs/proxito/views/mixins.py index 20d41e79797..ede9e635824 100644 --- a/readthedocs/proxito/views/mixins.py +++ b/readthedocs/proxito/views/mixins.py @@ -378,7 +378,7 @@ def get_redirect_response(self, request, redirect_path, proxito_path, http_statu # Redirects shouldn't change the domain, version or language. # However, if the new_path is already an absolute URI, just use it new_path = request.build_absolute_uri(new_path) - log.info( + log.debug( 'Redirecting...', from_url=request.build_absolute_uri(proxito_path), to_url=new_path, @@ -394,7 +394,7 @@ def get_redirect_response(self, request, redirect_path, proxito_path, http_statu and new_path_parsed.path == old_path_parsed.path ): # check that we do have a response and avoid infinite redirect - log.warning( + log.debug( 'Infinite Redirect: FROM URL is the same than TO URL.', url=new_path, ) diff --git a/readthedocs/proxito/views/serve.py b/readthedocs/proxito/views/serve.py index da89cbe4be2..088e96ee9db 100644 --- a/readthedocs/proxito/views/serve.py +++ b/readthedocs/proxito/views/serve.py @@ -308,7 +308,6 @@ def _get_canonical_redirect_type(self, request): .exists() ) # For .com we need to check if the project supports custom domains. - # pylint: disable=protected-access if canonical_domain and resolver._use_cname(project): log.debug( "Proxito Public Domain -> Canonical Domain Redirect.", @@ -525,7 +524,6 @@ def get(self, request, proxito_path, template_name="404.html"): with the default version and finally, if none of them are found, the Read the Docs default page (Maze Found) is rendered by Django and served. """ - # pylint: disable=too-many-locals log.bind(proxito_path=proxito_path) log.debug('Executing 404 handler.') @@ -691,7 +689,7 @@ def _get_custom_404_page(self, request, project, version=None): storage_root_path, tryfile ) if build_media_storage.exists(storage_filename_path): - log.info( + log.debug( "Serving custom 404.html page.", version_slug_404=version_404.slug, storage_filename_path=storage_filename_path, diff --git a/readthedocs/search/documents.py b/readthedocs/search/documents.py index 5968fb87826..926d34cab0c 100644 --- a/readthedocs/search/documents.py +++ b/readthedocs/search/documents.py @@ -22,8 +22,8 @@ def update(self, *args, **kwargs): # Hack a fix to our broken connection pooling # This creates a new connection on every request, # but actually works :) - log.info('Hacking Elastic indexing to fix connection pooling') - self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL['default']) + log.debug("Hacking Elastic indexing to fix connection pooling") + self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL["default"]) super().update(*args, **kwargs) diff --git a/readthedocs/search/faceted_search.py b/readthedocs/search/faceted_search.py index 43ebd2a6dbb..8673bb14092 100644 --- a/readthedocs/search/faceted_search.py +++ b/readthedocs/search/faceted_search.py @@ -69,8 +69,8 @@ def __init__( # Hack a fix to our broken connection pooling # This creates a new connection on every request, # but actually works :) - log.info('Hacking Elastic to fix search connection pooling') - self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL['default']) + log.debug("Hacking Elastic to fix search connection pooling") + self.using = Elasticsearch(**settings.ELASTICSEARCH_DSL["default"]) filters = filters or {} From 327e3655133a6a940c437d3f0ee4f638f396c075 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 29 Jun 2023 09:36:07 -0700 Subject: [PATCH 2/2] Update common to fix lint --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 5e74b3858e9..47f9295d24c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5e74b3858e978db0050b79b1172899199360f9d7 +Subproject commit 47f9295d24ca951aa01e6266f7278125b91b6506