fix handling of missing prometheus endpoint

This commit is contained in:
Julius Unverfehrt 2022-03-21 15:19:15 +01:00
parent ea49b001be
commit 82bd48a754

View File

@ -50,11 +50,15 @@ def set_up_probing_webserver():
try:
resp = requests.get(f"{CONFIG.rabbitmq.callback.analysis_endpoint}/prometheus")
resp.raise_for_status()
return resp.text
except Exception as err:
if not informed_about_missing_prometheus_endpoint:
logger.warning(f"Got no metrics from analysis prometheus endpoint: {err}")
informed_about_missing_prometheus_endpoint = True
return resp
except ConnectionError:
return ""
except requests.exceptions.HTTPError as err:
if resp.status_code == 404:
if not informed_about_missing_prometheus_endpoint:
logger.warning(f"Got no metrics from analysis prometheus endpoint: {err}")
informed_about_missing_prometheus_endpoint = True
else:
raise err
return resp.text
return app