File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,17 +283,18 @@ def update_current_gain_ref(
283283@router .get ("/silences/{instrument_name}" )
284284def get_silences (instrument_name : MurfeyInstrumentName ):
285285 all_configs = get_machine_config ()
286- microscopes = list (all_configs .keys ())
287- if instrument_name not in microscopes :
286+ valid_instrument_names = list (all_configs .keys ())
287+ if instrument_name in valid_instrument_names :
288+ index = valid_instrument_names .index (instrument_name )
289+ query_params = f"filter=microscope={ sanitise (valid_instrument_names [index ])} "
290+ else :
288291 return None
289292 machine_config = all_configs [instrument_name ]
290293 alertmanager_url = machine_config .alertmanager_url
291294 if alertmanager_url == "" :
292295 logger .warning (f"alertmanager_url not set for { sanitise (instrument_name )} " )
293296 return None
294- response = requests .get (
295- f"{ alertmanager_url } /api/v2/silences?filter=microscope={ sanitise (instrument_name )} "
296- )
297+ response = requests .get (f"{ alertmanager_url } /api/v2/silences?{ query_params } " )
297298 if response .status_code != 200 :
298299 logger .warning (
299300 f"Tried to get silences for { sanitise (instrument_name )} , but received status { response .status_code } from alertmanager API"
You can’t perform that action at this time.
0 commit comments