Skip to content

feat(core): add statisticsStateSchema option for custom metrics#3554

Open
Keyboris wants to merge 9 commits intoapify:v4from
Keyboris:custom-stats-v4
Open

feat(core): add statisticsStateSchema option for custom metrics#3554
Keyboris wants to merge 9 commits intoapify:v4from
Keyboris:custom-stats-v4

Conversation

@Keyboris
Copy link
Copy Markdown

@Keyboris Keyboris commented Apr 4, 2026

add statisticsStateSchema to BasicCrawlerOptions to allow passing a custom zod schema.
this allows developers to extend the statistics state with strict typing and disk persistence.
eliminate the need to manually subclass the internal statistics engine for custom metrics.

update AdaptivePlaywrightCrawlerStatistics constructor to deeply merge schemas.
prevent zod's strip behavior from deleting required framework metrics during serialization.

add comprehensive vitest coverage to ensure custom schemas are tracked across all crawlers.

Closes #3525

@janbuchar janbuchar self-requested a review April 7, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants