-
Notifications
You must be signed in to change notification settings - Fork 334
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
[output] Adding support for assign priority to incidents #498
Conversation
incident_priority = {} | ||
_priority = rule_context.get('incident_priority', False) | ||
if _priority: | ||
verified_priority = self._priority_verify(_priority) |
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.
Suggestion: pass the rule_context to the _priority_verify
function and have it do all of this, and instead of having _priority_verify
return False
have it return the default value of {}
or dict()
..
So your call would just look something like:
incident_priority = self._priority_verify(rule_context)
And everywhere above that returns false would instead return dict()
e423172
to
2a454e5
Compare
@@ -401,6 +441,11 @@ def dispatch(self, **kwargs): | |||
if rule_context: | |||
rule_context = rule_context.get(self.__service__, {}) | |||
|
|||
# Use the priority provided in the context, use it or the incident will be low priority | |||
incident_priority = {} | |||
if rule_context: |
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.
Thanks for the change! Looks great - one last suggestion: don't instantiate the incident_priority
here or do the if rule_context
check here.. do this all in the _priority_verify
and return dict()
immediately if the rule_context == None
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.
Approving but please see tiny nit comment
to: @ryandeivert @jacknagz
cc: @airbnb/streamalert-maintainers
size: small
Background
New output to use PagerDuty Incidents was added here. Incidents will be created with a low priority by default, unless specified.
Changes
Testing