Adding Handled/Unhandled payload properties#126
Conversation
…tten for notified with severity
|
|
||
| def __init__(self, application, environ, start_response): | ||
| self.environ = environ | ||
| self.severity_reason = { |
There was a problem hiding this comment.
This should be a constant rather than a member on the middleware
| "No API key configured, couldn't notify") | ||
| return | ||
|
|
||
| notification.default_severity = initial_default_severity |
There was a problem hiding this comment.
I dont think we need to reset any changes to these variables in here. If people change them then they are in expert mode and thats fine.
| context=sender.name, | ||
| extra_data=task) | ||
| extra_data=task, | ||
| unhandled=True, |
There was a problem hiding this comment.
is this not implied because auto notify?
|
I've updated the notify default-severity check, that shouldn't automatically set default_severity to false when unhandled calls to it are made. I've taken out the overriding of severity_reason and unhandled, but this is a pattern in some of the other notifiers (whether through making them protected properties or by overriding them if necessary) which may need discussion |
Separating capture from callback reasons indicates more clearly to users where the severity was changed and why. It has a lower precedence than callbacks which can still override the severity.
snmaynard
left a comment
There was a problem hiding this comment.
These review comments should be addressed even though it's been merged already
| 'type': 'userCallbackSetSeverity' | ||
| } | ||
| else: | ||
| notification.severity_reason = initial_reason |
There was a problem hiding this comment.
This enforces that users cannot overwrite the severity_reason in callbacks or middleware. I think we previously said it wouldn't matter if someone chose to do so, but we've added it as one of our testing parameters and are enforcing the same thing across notifiers.
| self.client = client | ||
| self.options = options | ||
| if 'severity' in options: | ||
| options['severity_reason'] = dict(type='contextSpecifiedSeverity') |
There was a problem hiding this comment.
Should this be userContextSetSeverity?
There was a problem hiding this comment.
This one seems to already have been fixed
| 'meta_data': {}, | ||
| 'unhandled': False, | ||
| 'severity_reason': { | ||
| 'type': 'logs', |
defaultSeverity,unhandled, andseverityReasonspayload properties to support upcoming handled/unhandled functionalityreferences PLAT_209