scrapy-spider-monitor
A small Scrapy extension that records per-field fill rates in your job stats, so Spider Monitor can flag a spider that "finishes fine" while a field has quietly gone empty after a site layout change.
It reads only field names, whether values are empty, and response body sizes, and keeps numeric counters in memory. Item values are never stored, logged or sent anywhere. The only output is the job's own stats.
Install
pip install scrapy-spider-monitor # on Scrapy Cloud, add scrapy-spider-monitor to requirements.txt
# settings.py:
EXTENSIONS = {"spidermonitor_scrapy.FillRateExtension": 500}
Requires Python 3.10+ and Scrapy 2.11+.
What it writes
When the spider closes, for each top-level field:
| Stat | Meaning |
|---|---|
fill_rate/<field>/count |
Items where the field was present and non-empty |
fill_rate/<field>/rate |
count / item_scraped_count, from 0 to 1 (omitted when there are 0 items) |
item_scraped_count |
The denominator. Scrapy normally sets it; the extension sets it if it is missing |
For responses that produced at least one item (each counted once, however many items it yielded; items not tied to a response are skipped):
| Stat | Meaning |
|---|---|
item_responses/count |
Responses that produced items |
item_responses/body_length/min |
Smallest body, in bytes (omitted when the count is 0) |
item_responses/body_length/avg |
Mean body, in bytes (omitted when the count is 0) |
Per-status response counts are already in every job's stats as
downloader/response_status_count/<code> (Scrapy's built-in DownloaderStats), so this
extension does not duplicate them.
None, whitespace-only strings ("", " ", "\n ") and empty containers ([], {},
(), b"") count as empty. Whitespace counts as empty because a broken selector often
returns it instead of None. 0 and False count as values. A missing key counts as empty.
Works with dicts, scrapy.Item, dataclass and attrs items (via itemadapter). Fields
declared on an Item, dataclass or attrs class are reported even if they were never set,
so a field that is empty in every item shows up as count 0. For plain dicts, a field is
reported once it has appeared as a key in at least one item.
Optional settings
# Track only these fields. Listed fields are always reported, even if no item has them.
SPIDERMONITOR_FIELDS = ["title", "price", "sku"]
# Turn the extension off without removing it from EXTENSIONS.
SPIDERMONITOR_FILL_RATE_ENABLED = False
Cost
One dictionary update per field per item, one set lookup per item for the response, and
no I/O during the crawl. Responses are tracked by weak reference, so they are not kept
in memory. Stats are written once, in spider_closed. Only top-level fields are counted;
nested fields are not counted in this version.
Troubleshooting on Scrapy Cloud
Every job fails at startup with ImportError: cannot import name 'request_fingerprint'.
This comes from the Scrapy Cloud stack, not from this extension: a recent Scrapy (pulled
in by, for example, scrapy-zyte-api) together with scrapinghub-entrypoint-scrapy
older than 0.18. Add this to requirements.txt and deploy again:
scrapinghub-entrypoint-scrapy>=0.18
Development
python -m venv .venv && . .venv/bin/activate
pip install -e '.[test]'
pytest
License
MIT
Metadata
Release files for scrapy-spider-monitor 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy_spider_monitor-0.1.1.tar.gz | 6.3 kB | With provenance | Details for scrapy_spider_monitor-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_spider_monitor-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for scrapy_spider_monitor-0.1.1-py3-none-any.whl |
Total release size: 13.0 kB
Release files / scrapy_spider_monitor-0.1.1.tar.gz
| Download URL | scrapy_spider_monitor-0.1.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
faf1c6dac04eb1fb22be1af81f5db1235ec921b9524a38ac3997b63fb91987ed
|
|
BLAKE2b-256 checksum How to use checksums |
1b34d11c18e0f2e6bebbedd746f5f67ead09f06d9ca11ec0b080efb936198c95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / scrapy_spider_monitor-0.1.1-py3-none-any.whl
| Download URL | scrapy_spider_monitor-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd9c81cb9324fd2aabdcf87c04eac755125d4d3e7ae49b588d6d36d856a26dd9
|
|
BLAKE2b-256 checksum How to use checksums |
42f46caf1c248c7b216c02ac595bb960df8d0f05391560af167be943791e8c8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for scrapy-spider-monitor 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for scrapy_spider_monitor-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.