Add endpoints to get, create and delete silences#798
Open
Abigail-Yates wants to merge 16 commits into
Open
Conversation
Codecov Report❌ Patch coverage is 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:
|
changed 'microscope' to 'instrument_name' for consistency. Alert silencing endpoints instrument_name type is now MurfeyInstrumentName for validation.
| model_config = ConfigDict(extra="allow") | ||
|
|
||
| # Alertmanager URL | ||
| alertmanager_url: str = "https://murfey-alertmanager.diamond.ac.uk" |
Contributor
There was a problem hiding this comment.
This might be better under the "Configuration and URLs" section of the config. And the default shouldn't be the diamond address
| return None | ||
| machine_config = all_configs[instrument_name] | ||
| alertmanager_url = machine_config.alertmanager_url | ||
| if alertmanager_url == "": |
Contributor
There was a problem hiding this comment.
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 ""
| index = valid_instrument_names.index(instrument_name) | ||
| query_params = f"filter=microscope={sanitise(valid_instrument_names[index])}" | ||
| else: | ||
| return None |
Contributor
There was a problem hiding this comment.
Fine like this, but if the function return is list or None the frontend would need to be able to handle either
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turn alerts off and on using silences