Statistics fail to resume after migration
Statistics persist to SDK_CRAWLER_STATISTICS_<id>, where <id> is a process-global counter. The order isn't guaranteed to be the same after a restart (migration / OOM / resurrect), so a crawler's stats can be saved under a different key on the new container and fail to resume, so you end up with two separate statistics records and the final "Total N requests: X succeeded, Y failed" only reflects the last segment.
https://console.apify.com/view/runs/QHf8KefhZMis54gfP
Proposed fix: expose persistStateKey in StatisticsOptions, defaulting to the current SDK_CRAWLER_STATISTICS_<id>. Then callers with multiple crawlers can pass a fixed key so each crawler's stats resume reliably:
new PlaywrightCrawler({ statisticsOptions: { persistStateKey: 'MAIN_CRAWLER_STATS' } })
Happy to PR.
Thank you for the report @nikitachapovskii-dev ! See that we're already doing this in v4 ⬇️
https://github.com/apify/crawlee/blob/c6f32564692e694dc7f10ffbd4c8d6d5c1d0f00f/packages/core/src/crawlers/statistics.ts#L478-L486
This was added in #3309 .
Perhaps you can reapply the Statistics-related hunks of that v4 commit on v3? Afaik it shouldn't be breaking, as it's purely additive.
Cheers!