spidermon icon indicating copy to clipboard operation
spidermon copied to clipboard

Support different severity levels for Spidermon alerts

Open curita opened this issue 2 years ago • 2 comments

Background

All Spidermon failed checks are reported as ERRORs at the moment. Everything belongs to the same category and can't be addressed differently. It could be nice to have different severity levels to signal how critical those failed checks are and allow us to take distinct actions based on them.

This idea was initially introduced in the discussions for https://github.com/scrapinghub/spidermon/issues/375.

Proposal

We could use existing log levels as severity levels and log those messages with that severity. ERROR could remain the default severity and introduce a lower priority (WARNING) and a higher priority (CRITICAL) severity level.

Initially, this could be supported only in custom monitors via some new parameter in the assertions of the test methods. And we could support assigning different Spidermon Actions based on these severity levels.

This feature should be backward compatible ideally, considering ERRORs the default severity.

curita avatar Mar 31 '23 22:03 curita

I could see some utility for this, but wouldn't it make more sense to group the monitors in different suites per their severity and use different actions on each case?

On my experience, everything that is not an error in the logs will be ignored, and if it's ignored what's the point of having a monitor for it?

VMRuiz avatar Apr 03 '23 07:04 VMRuiz

I also have the feeling that if it is not an error, it will be ignored. We have the WarningCountMonitor, so if we reach a certain amount of warnings, we can fail a monitor, but as we need to ensure that this monitor will only run after all others is executed (so we can take some action if the other warning monitors "fail").

But being able to have different "levels" of monitors may be somewhat interesting ...

rennerocha avatar Apr 03 '23 13:04 rennerocha