Skip to content

Commit

Permalink
ENT-2390 | Adding logging to search/all/ endpoint in discovery api cl…
Browse files Browse the repository at this point in the history
…ient (#602)
  • Loading branch information
christopappas authored Oct 22, 2019
1 parent 0f576f3 commit a1974db
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------

Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions enterprise/api_client/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,26 @@ 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,
query_params,
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: '
Expand Down

0 comments on commit a1974db

Please sign in to comment.