DmesgPlugin: custom priority rules#188
Conversation
…s which can change the priority of regex events which the given rules.
…llow a rule to match everything. Can be used as a default rule.
alexandraBara
left a comment
There was a problem hiding this comment.
The README needs an update to show an example of how to overwrite, please add it in the same plugin_config displayed in this section of the README: Custom Error Regex Example.
Also update the PR Description with command to run the plugin and a sample plugin_config.json to use, which shows how to use the overwrite
| """ | ||
| Walk the priority_override_rules in order (first-match-wins). | ||
| All keys in each rule except 'new_priority' and 'match_all' are treated | ||
| as filter fields compared against ErrorRegex attributes. Filter values | ||
| may be a single value or a list of values (match if any value matches). | ||
| Enum fields are compared by their name. Returns the overriding | ||
| EventPriority, or None to keep the original. | ||
|
|
||
| Example rule format: | ||
| { | ||
| "message": ["mode 1 reset failed", "mode 2 reset failed"], | ||
| "new_priority": "NO_CHANGE" | ||
| } | ||
| { | ||
| "event_category": "RAS", | ||
| "new_priority": "WARNING" | ||
| } | ||
| """ |
There was a problem hiding this comment.
update the docstrings to contain:
- description
- Args
- Returns
See other files for example.
… and changed return from None to the original priority if it doesn't change
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
notice that this ErrorRegex for unknown_dmesg_errors is applied after your priority changes. This will then not take in account your changes and there is no way with the current code to update priority or other fields on this regex. I think whatever changes you add should also apply to this regex.
…s into a function which can be used whenever making new ErrorRegex object. This function is now being used after creating the 'Unknown dmesg errors'
alexandraBara
left a comment
There was a problem hiding this comment.
works as expected
Summary
Added the ability to provide custom rules to the dmesg plugin analyzer to control the priority of specific regex events. An argument called "priority_override_rules" can be provided to the dmesg plugin's analysis_args which should contain a list of rules. The rules are then compared in order to each error regex and when a rule fully matches, the new_priority field of the rule gets applied to that error regex. The rules accept as keys any attribute of the ErrorRegex class for filtering, "new_priority" as the priority to update to, and "match_all" as a boolean if the rule should always match (can be used for default rules).
Example Usage (this is the full plugin_config.json):
To run this json use this command:
In this example 3 rules are provided. The first sets prevents priority changes to any errors where the message is either "Page Fault" or "My Custom Error Detected". The second sets the priority of all errors with event_category "OS" to "WARNING". The third sets all other events (due to match_all: true) to priority "INFO".
Test plan
pytest test/unitpytest test/functional(if applicable)pre-commit run --all-filesChecklist