From 7110da8f8510e689b969e7d2d0f4d51061c88def Mon Sep 17 00:00:00 2001 From: Victor Ng Date: Thu, 21 Feb 2019 13:16:44 -0500 Subject: [PATCH] lowered logging level for failed client lookups in dynamo --- taar/profile_fetcher.py | 7 +++++-- taar/recommenders/recommendation_manager.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/taar/profile_fetcher.py b/taar/profile_fetcher.py index 540aa7a..8c93e87 100644 --- a/taar/profile_fetcher.py +++ b/taar/profile_fetcher.py @@ -39,11 +39,14 @@ class ProfileController: json_byte_data = zlib.decompress(compressed_bytes) json_str_data = json_byte_data.decode('utf8') return json.loads(json_str_data) + except KeyError: + # No client ID found - not really an error + return None except Exception as e: # Return None on error. The caller in ProfileFetcher will # handle error logging msg = "Error loading client data for {}. Error: {}" - self.logger.error(msg.format(client_id, str(e))) + self.logger.debug(msg.format(client_id, str(e))) return None @@ -65,7 +68,7 @@ class ProfileFetcher: profile_data = self._client.get_client_profile(client_id) if profile_data is None: - self.logger.error("Client profile not found", extra={"client_id": client_id}) + self.logger.debug("Client profile not found", extra={"client_id": client_id}) return None addon_ids = [addon['addon_id'] diff --git a/taar/recommenders/recommendation_manager.py b/taar/recommenders/recommendation_manager.py index 68b75de..4e992b4 100644 --- a/taar/recommenders/recommendation_manager.py +++ b/taar/recommenders/recommendation_manager.py @@ -106,7 +106,7 @@ class RecommendationManager: client_info = self.profile_fetcher.get(client_id) if client_info is None: - self.logger.warning( + self.logger.info( "Defaulting to empty results. No client info fetched from dynamo." ) return []