-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add a severity to messages #48
Conversation
Codecov Report
@@ Coverage Diff @@
## master #48 +/- ##
==========================================
- Coverage 91.85% 89.72% -2.14%
==========================================
Files 11 11
Lines 786 798 +12
Branches 107 109 +2
==========================================
- Hits 722 716 -6
- Misses 42 56 +14
- Partials 22 26 +4
Continue to review full report at Codecov.
|
Each message can now have a severity associated with it, both at a class level and on a message-by-message basis. Signed-off-by: Jeremy Cline <jcline@redhat.com>
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.
Looks good
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.
While I believe that the specific values of severities might be hard to determine, this code looks reasonable to me.
Do you mean for a particular message it's difficult to say what the severity is? I agree and I expect we'll have plenty of spirited discussions stemming from someone getting notifications they're not interested it. It's not perfect, but hopefully that will be a guiding force for the "right" severity level. @abompard, I think I'm going to go ahead and merge this for a beta release (which includes all the fixed-up auth stuff), but when you get back from PTO, please review this and we can adjust it before a stable release is tagged. |
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.
This looks good! Should the tutorial be updated to ask people to set the default severity?
_log.debug( | ||
'Validating message body "%r" with schema "%r"', self._body, schema | ||
) | ||
jsonschema.validate(self._body, schema) |
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.
You're doing this so people don't override the base schemas too much? Are you thinking of a specific use case?
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.
I was thinking that for the headers, it'd be good to validate we added the expected schema, timestamp, etc. keys and the easiest way would be to add it to the schema, but then I wanted people to have the ability to expand upon it. With the body I think it's reasonable to demand all messages be an object, so this makes it enforced.
I can't really think of a use-case for users to actually add headers at the moment so maybe that should all be an internal thing, though.
msg = message.Message() | ||
msg._headers = None | ||
expected_message = message.Message() | ||
expected_message.id = msg.id |
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.
You don't seem to be using this variable.
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.
Ah, good eye
I'll do that |
Each message can now have a severity associated with it, both at a class
level and on a message-by-message basis.
Signed-off-by: Jeremy Cline jcline@redhat.com