From 3e77fd7930e991d1f7a761dffad26e26c331c6a4 Mon Sep 17 00:00:00 2001 From: Komal Thareja Date: Fri, 10 May 2024 05:34:39 -0400 Subject: [PATCH] fix response --- .../swagger_server/response/metrics_controller.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fabric_cf/orchestrator/swagger_server/response/metrics_controller.py b/fabric_cf/orchestrator/swagger_server/response/metrics_controller.py index 5161a5b8..7f9f74a1 100644 --- a/fabric_cf/orchestrator/swagger_server/response/metrics_controller.py +++ b/fabric_cf/orchestrator/swagger_server/response/metrics_controller.py @@ -1,6 +1,6 @@ from typing import List -from fabric_cf.orchestrator.swagger_server.response.utils import get_token +from fabric_cf.orchestrator.swagger_server.response.utils import get_token, cors_error_response, cors_success_response from fabric_cf.orchestrator.swagger_server.response.constants import GET_METHOD, METRICS_GET_PATH @@ -8,7 +8,7 @@ from fabric_cf.orchestrator.core.orchestrator_handler import OrchestratorHandler -from fabric_cf.orchestrator.swagger_server.response.cors_response import cors_200, cors_500 +from fabric_cf.orchestrator.swagger_server.response.cors_response import cors_200 from fabric_cf.orchestrator.swagger_server.models import Metrics @@ -51,9 +51,8 @@ def metrics_overview_get(excluded_projects: List[str] = None) -> Metrics: # noq response.status = 200 response.type = 'metrics.overview' success_counter.labels(GET_METHOD, METRICS_GET_PATH).inc() - return cors_200(response_body=response) - except Exception as exc: - details = 'Oops! something went wrong with metrics_overview_get(): {0}'.format(exc) - logger.error(details) + return cors_success_response(response_body=response) + except Exception as e: + logger.exception(e) failure_counter.labels(GET_METHOD, METRICS_GET_PATH).inc() - return cors_500(details=details) + return cors_error_response(error=e)