-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't overwrite self.teams
upon parsing responders in OpsGenie integration
#1539
Conversation
Update opsgenie.py
Thanks for submitting this. There are already extensive unit tests for this alerter, so adjusting one of them to send two alerts and then assert that the second one was unaffected by the first should (hopefully) be low-effort. |
Thanks. Updated, but the changes needed were a bit more extensive than I would have liked. I've added a test for this particular issue, but had to make some other changes to tidy things up a bit. Some of the tests were checking for (what I think) were incorrect values and some others were checking properties on the alert object instead of mocked post request. I've done the recipients as well. Let me know what you think. Apologies if it is a mess, I've not done any Python dev prior to this. |
if responders is None: | ||
return None | ||
if responder_args is None: | ||
responder_args = dict() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The top two lines prevent other tests from failing as missing responder_args
no longer skips the execution.
The bottom two lines fix a scenario where responders
contains a placeholder, but responders_args
isn't configured in a rule at all. Previously, a text with placeholder would end up as a responder. Now, a warning will be shown and default_responders
will be used instead.
The two new tests could probably be named to better describe what they're doing:
|
The change from |
@nsano-rururu I've updated alerts.rst as well but only now realised it makes this a breaking change. I was looking at Elastalert(1) docs and saw the correct spelling there. Not sure what the right approach here is. |
The next version, 2.21.0, will allow both the old setting name and the correct wording. However, if you use the old setting name, how about informing the user that the old setting value will be deleted when the logger reaches 2.25.0 every time an alert notification is sent? |
For warning loggers, use elastalert_logger.warning. example |
…elling and added backwards compatible handling of the old spelling
I've put something together but on alerter initialisation instead of alert send. Deprecation logic feels more in place there vs having it in the alert method. Edit: Just realised you've got a mechanism for that already. 👀 |
Update CHANGELOG.md. |
Any other comments? |
Looks good, thank you both. The schema.yaml is missing those two properties, as well as other OpsGenie properties. But that can wait for another PR since it's not directly related to this. |
#1543 schema update as a separate PR (1 - to not block this one, 2 - because I'm not 100% sure it's correct) |
Description
Checklist
make test-docker
with my changes.Questions or Comments