Skip to content

Commit

Permalink
fix response
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed May 10, 2024
1 parent 26391d7 commit 3e77fd7
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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

from fabric_cf.orchestrator.swagger_server import received_counter, success_counter, failure_counter

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

Expand Down Expand Up @@ -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)

0 comments on commit 3e77fd7

Please sign in to comment.