Skip to content

fix: preserve counter chain entries during backfill so snapshot captures full history#39

Merged
davidbirdsong merged 1 commit into
developfrom
davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-12
Jun 25, 2026
Merged

fix: preserve counter chain entries during backfill so snapshot captures full history#39
davidbirdsong merged 1 commit into
developfrom
davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-12

Conversation

@davidbirdsong

Copy link
Copy Markdown

Pull Request Template

Description

Fix backfill
Expire ran on every tick during backfill to prevent unbounded window growth, but it also evicted counter chain entries for buckets older than WindowTTL. Since backfill data spans hours and WindowTTL is 15 minutes, most backfill entries were evicted before the post-backfill snapshot could push them. Only the most recent ~15 minutes of data appeared in downstream systems.

Expire now accepts an evictChains flag. During backfill it frees tracker/window memory but preserves chain entries. After the snapshot pushes, EvictStaleChains does a one-time cleanup.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Other (please describe):

@davidbirdsong

davidbirdsong commented Jun 24, 2026

Copy link
Copy Markdown
Author

@davidbirdsong davidbirdsong force-pushed the davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-11 branch from 991d370 to bfc34a6 Compare June 24, 2026 19:22
@davidbirdsong davidbirdsong force-pushed the davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-12 branch from 169b869 to 35db8a7 Compare June 24, 2026 19:22
@davidbirdsong

Copy link
Copy Markdown
Author

spike test unit test passes now:

 $ go test ./converge/...
ok  	github.com/lablabs/cloudflare-exporter/converge	0.120s

@davidbirdsong davidbirdsong force-pushed the davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-12 branch from 35db8a7 to 2d89c11 Compare June 24, 2026 20:08
@davidbirdsong davidbirdsong mentioned this pull request Jun 25, 2026
6 tasks
Base automatically changed from davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-11 to develop June 25, 2026 15:03
…res full history

Expire ran on every tick during backfill to prevent unbounded window growth, but it also evicted counter chain entries for buckets older than WindowTTL. Since backfill data spans hours and WindowTTL is 15 minutes, most backfill entries were evicted before the post-backfill snapshot could push them. Only the most recent ~15 minutes of data appeared in downstream systems.

Expire now accepts an evictChains flag. During backfill it frees tracker/window memory but preserves chain entries. After the snapshot pushes, EvictStaleChains does a one-time cleanup.

This also fixes spikes.
@davidbirdsong davidbirdsong force-pushed the davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-12 branch from 2d89c11 to 1b51321 Compare June 25, 2026 15:04
@davidbirdsong davidbirdsong merged commit 6ad5266 into develop Jun 25, 2026
9 checks passed
@davidbirdsong davidbirdsong deleted the davidbirdsong/net-146-switch-cloudflare-exporter-from-pull-based-scraping-to-push-12 branch June 25, 2026 15:05
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