From 85a6676ffa04416b3bd9d02581d29ec2a3d43803 Mon Sep 17 00:00:00 2001 From: Alejandro Roiz Walss <26120069+alejandroroiz@users.noreply.github.com> Date: Wed, 5 Jul 2023 13:22:22 -0600 Subject: [PATCH] Add logging to confidant ingress (#390) Ingress sometimes is being affected by 4xx's, this will add more observability for when this issue happens. --------- Co-authored-by: Dean Liu --- confidant/routes/services.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/confidant/routes/services.py b/confidant/routes/services.py index aaf5e4cb..3d585505 100644 --- a/confidant/routes/services.py +++ b/confidant/routes/services.py @@ -259,6 +259,7 @@ def get_service(id): id ) error_msg = {'error': msg, 'reference': id} + logger.warning(msg) return jsonify(error_msg), 403 logger.info( @@ -277,9 +278,14 @@ def get_service(id): msg = 'Authenticated user is not authorized.' return jsonify({'error': msg}), 401 except DoesNotExist: + logger.warning('Item with id {0} does not exist.'.format(id)) return jsonify({}), 404 + except Exception as e: + logger.warning('Exception occurred: {0}'.format(e)) + raise e if (service.data_type != 'service' and service.data_type != 'archive-service'): + logger.warning('Item with id {0} is not a service.'.format(id)) return jsonify({}), 404 logger.debug('Authz succeeded for service {0}.'.format(id)) try: