feat(clickhouse): extend retention TTL to the events_daily table#27
Merged
loks0n merged 1 commit intoJul 17, 2026
Merged
Conversation
Generalize applyEventsRetention into applyRetention(table) and apply the same window to both the raw events and aggregated events_daily tables; gauges stay untouched. Update the schema test accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR applies the ClickHouse retention window to aggregated daily events as well as raw events. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "feat(clickhouse): extend retention TTL t..." | Re-trigger Greptile |
ChiragAgg5k
approved these changes
Jul 17, 2026
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.
What
Follow-up to #24. Generalizes
applyEventsRetention()intoapplyRetention(string $tableName)and applies the same retention window to both the raw*_eventstable and the aggregated*_events_dailytable. Gauges remain untouched.Why
The raw events TTL alone left the aggregated
events_dailytable unbounded. Callers that set a retention window now get a single consistent horizon across both tables, so long-term aggregated rows are purged on the same schedule instead of growing forever.Changes
setup()now callsapplyRetention()for the events table and the events_daily table.testRetentionAppliesTtlToEventsAndDailyTables; asserts events_daily now carries the TTL and gauges does not.Note
This is a behavior change: with a retention set, aggregated daily history is now bounded by the same window. Consumers relying on
events_dailyas unbounded long-term history should account for this.🤖 Generated with Claude Code