Skip to content

Add endpoints to get, create and delete silences#798

Open
Abigail-Yates wants to merge 16 commits into
mainfrom
silence-alerts
Open

Add endpoints to get, create and delete silences#798
Abigail-Yates wants to merge 16 commits into
mainfrom
silence-alerts

Conversation

@Abigail-Yates
Copy link
Copy Markdown
Collaborator

Turn alerts off and on using silences

@Abigail-Yates Abigail-Yates self-assigned this May 12, 2026
Comment thread src/murfey/server/api/session_info.py Fixed
Comment thread src/murfey/server/api/session_info.py Fixed
Comment thread src/murfey/server/api/session_info.py Fixed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 16.36364% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.60%. Comparing base (14aab9f) to head (c8ba61c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #798      +/-   ##
==========================================
- Coverage   52.33%   50.60%   -1.73%     
==========================================
  Files          96       96              
  Lines       10324    10745     +421     
  Branches     1357     1463     +106     
==========================================
+ Hits         5403     5438      +35     
- Misses       4642     5006     +364     
- Partials      279      301      +22     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/murfey/server/api/session_info.py Fixed
changed 'microscope' to 'instrument_name' for consistency. Alert
silencing endpoints instrument_name type is now MurfeyInstrumentName for
validation.
Comment thread src/murfey/server/api/session_info.py Fixed
Comment thread src/murfey/server/api/session_info.py Fixed
Comment thread src/murfey/server/api/session_info.py Fixed
Comment thread src/murfey/server/api/session_info.py Outdated
Comment thread src/murfey/server/api/session_info.py
Comment thread src/murfey/util/config.py Outdated
model_config = ConfigDict(extra="allow")

# Alertmanager URL
alertmanager_url: str = "https://murfey-alertmanager.diamond.ac.uk"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better under the "Configuration and URLs" section of the config. And the default shouldn't be the diamond address

Comment thread src/murfey/server/api/session_info.py Fixed
Comment thread src/murfey/server/api/session_info.py Fixed
@Abigail-Yates Abigail-Yates changed the title Add methods to get, create and delete silences Add endpoints to get, create and delete silences May 14, 2026
Comment thread src/murfey/server/api/session_info.py Outdated
return None
machine_config = all_configs[instrument_name]
alertmanager_url = machine_config.alertmanager_url
if alertmanager_url == "":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more standard in python to do this check using if not alertmanager_url: as that would check for all "Falsey" cases like None, [] or ""

Comment thread src/murfey/server/api/session_info.py Outdated
index = valid_instrument_names.index(instrument_name)
query_params = f"filter=microscope={sanitise(valid_instrument_names[index])}"
else:
return None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine like this, but if the function return is list or None the frontend would need to be able to handle either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants