From a1974db6be53da3e4a11265de24d3a6f0b1e6824 Mon Sep 17 00:00:00 2001 From: Chris Pappas Date: Tue, 22 Oct 2019 15:10:41 -0400 Subject: [PATCH] ENT-2390 | Adding logging to search/all/ endpoint in discovery api client (#602) --- CHANGELOG.rst | 5 +++++ enterprise/__init__.py | 2 +- enterprise/api_client/discovery.py | 13 +++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 60dae8fd21..b44e4b45d8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,11 @@ Change Log Unreleased ---------- +[2.0.8] - 2019-10-22 +--------------------- + +* Adding logging to search/all/ endpoint in discovery api client + [2.0.7] - 2019-10-21 --------------------- diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 17f43dc826..2809c114bc 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -4,6 +4,6 @@ from __future__ import absolute_import, unicode_literals -__version__ = "2.0.7" +__version__ = "2.0.8" default_app_config = "enterprise.apps.EnterpriseConfig" # pylint: disable=invalid-name diff --git a/enterprise/api_client/discovery.py b/enterprise/api_client/discovery.py index 5a67f0638f..0bed94e2a8 100644 --- a/enterprise/api_client/discovery.py +++ b/enterprise/api_client/discovery.py @@ -153,6 +153,12 @@ def get_catalog_results(self, content_filter_query, query_params=None, traverse_ ) response = cache.get(cache_key) if not response: + LOGGER.info( + 'ENT-2390-1 | Calling discovery service for search/all/ ' + 'data with content_filter_query %s and query_params %s', + content_filter_query, + query_params, + ) # Response is not cached, so make a call. response = self.get_catalog_results_from_discovery( content_filter_query, @@ -160,6 +166,13 @@ def get_catalog_results(self, content_filter_query, query_params=None, traverse_ traverse_pagination ) cache.set(cache_key, response, settings.ENTERPRISE_API_CACHE_TIMEOUT) + else: + LOGGER.info( + 'ENT-2390-2 | Got search/all/ data from the cache with ' + 'content_filter_query %s and query_params %s', + content_filter_query, + query_params, + ) except Exception as ex: # pylint: disable=broad-except LOGGER.exception( 'Attempted to call course-discovery search/all/ endpoint with the following parameters: '