refactor: replace tiered aggregation with flat storage#170
Merged
rajsinghtech merged 10 commits intomainfrom Apr 16, 2026
Merged
refactor: replace tiered aggregation with flat storage#170rajsinghtech merged 10 commits intomainfrom
rajsinghtech merged 10 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
*_minutely,*_hourly,*_daily,flow_logs_current) with 5 flat tables:node_pairs,bandwidth,bandwidth_by_node,traffic_stats,poll_stateInit()— renames existing minutely tables and drops old tiers, preserving data on upgradeGetBandwidth,GetNodeBandwidth,GetTrafficStatsviaresolveBucketSize(): ≤2h→1min, ≤48h→1hour, else→1day — no information loss from pre-aggregationflow_logs_current+InsertFlowLogs);GET /api/flow-logsreturns emptyTSFLOW_RETENTIONenv var (default720h/ 30 days) replacesTSFLOW_RETENTION_MINUTELY,TSFLOW_RETENTION_HOURLY,TSFLOW_RETENTION_DAILYTest Plan
go test ./internal/...passes (database, handlers, services)Init()creates 5 flat tables, no old tables exist*_minutelytables — verify data is preserved in renamed tables and old tiers are droppedTSFLOW_RETENTION=168henv var respected at startup