scrapinghub / spidermon

Scrapy Extension for monitoring spiders execution.
https://spidermon.readthedocs.io
BSD 3-Clause "New" or "Revised" License
526 stars 94 forks source link

Allow to skip execution of FieldCoverageMonitor if no item is returned #366

Closed rennerocha closed 1 year ago

rennerocha commented 1 year ago

This is a fork of issue #339 .

FieldCoverageMonitor requires that we have at least one item returned, or else it will fail. However there are situations when we accept that a spider return no items, but if items are returned, we want to ensure our field coverage.

In a project that are in production, we have dozens of real estate websites searching for locations in different neighborhoods daily. Some neighborhoods sometimes doesn't return any item in a specific day, but when data is returned we want to ensure that all the fields has the right coverage.

One possible solution (that looks simpler to implement) would be add a new setting called SPIDERMON_FIELD_COVERAGE_SKIP_IF_NO_ITEM (or something similar). If set to True and no item is returned, field coverage will not be checked, otherwise, it will work as it is now.