Unverified Commit 4d58ee0b by Douglas Hall Committed by GitHub

Merge pull request #16551 from edx/douglashall/add_enterprise_logging

Added logging to help debug Enterprise API throttling issue.
parents b35450de f3da3b24
...@@ -125,6 +125,7 @@ class EnterpriseApiClient(object): ...@@ -125,6 +125,7 @@ class EnterpriseApiClient(object):
Initialize an authenticated Enterprise service API client by using the Initialize an authenticated Enterprise service API client by using the
provided user. provided user.
""" """
self.user = user
jwt = JwtBuilder(user).build_token([]) jwt = JwtBuilder(user).build_token([])
self.client = EdxRestApiClient( self.client = EdxRestApiClient(
configuration_helpers.get_value('ENTERPRISE_API_URL', settings.ENTERPRISE_API_URL), configuration_helpers.get_value('ENTERPRISE_API_URL', settings.ENTERPRISE_API_URL),
...@@ -247,10 +248,11 @@ class EnterpriseApiClient(object): ...@@ -247,10 +248,11 @@ class EnterpriseApiClient(object):
querystring = {'username': user.username} querystring = {'username': user.username}
response = endpoint().get(**querystring) response = endpoint().get(**querystring)
except (HttpClientError, HttpServerError): except (HttpClientError, HttpServerError):
message = ("An error occurred while getting EnterpriseLearner data for user {username}".format( LOGGER.exception(
username=user.username 'Failed to get enterprise-learner for user [%s] with client user [%s]',
)) user.username,
LOGGER.exception(message) self.user.username
)
return None return None
return response return response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment