Skip to content

Commit 4e3aeac

Browse files
authored
Merge pull request #662 from vrdel/publicmetric-api-fix
Handle possible public_metric API encountering WEB-API metric profile errors
2 parents 8adf5e9 + 7d412f2 commit 4e3aeac

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

poem/Poem/api/internal_views/metrics.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ def get(self, request, name=None):
5050
else:
5151
metrics = poem_models.Metric.objects.all()
5252

53-
profiles4metrics = get_metrics_in_profiles(request.tenant)
53+
try:
54+
profiles4metrics = get_metrics_in_profiles(request.tenant)
55+
56+
except requests.RequestException as exc:
57+
return error_response(
58+
status_code=status.HTTP_400_BAD_REQUEST,
59+
detail='Error fetching metric profile data from WEB-API'
60+
)
5461

5562
results = []
5663
for metric in metrics:

0 commit comments

Comments
 (0)