feat(billing): Add common retention policy types#368
Draft
dashed wants to merge 3 commits into
Draft
Conversation
Define bounded standard retention and optional downsampled retention with an explicit inherit-standard marker. Add Python presence tests and Rust generated-binding round trips.
|
The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).
|
dashed
commented
Jul 17, 2026
| // message presence. | ||
| message StandardRetention { | ||
| // The number of calendar days that data is retained. Must be greater than zero. | ||
| uint32 days = 1; |
Member
Author
There was a problem hiding this comment.
This maps to TieredPlanItem.retention.
dashed
commented
Jul 17, 2026
| message InheritStandard {} | ||
|
|
||
| // The retention policy for a category's downsampled data. | ||
| message DownsampledRetention { |
Member
Author
There was a problem hiding this comment.
Maps to TieredPlanItem.downsampled_event_retention
Explain full-fidelity and downsampled representations, absent versus inherited policy, and invalid protobuf default states for readers without prior retention context.
dashed
commented
Jul 17, 2026
|
|
||
| // Retention for a distinct downsampled representation. Absence means that no | ||
| // such representation exists; it does not mean to inherit standard retention. | ||
| optional DownsampledRetention downsampled = 2; |
Member
Author
There was a problem hiding this comment.
Note that, it is legal for a data category to have both standard and downsampled retention settings.
For example, spans have retention of 30 days, while its downsampled counter part can be stored up to 13 months on AM3 business plans: https://github.com/getsentry/getsentry/blob/ac0ba4af432a399b77b42227d4017eaa14be65e4/getsentry/billing/plans/am3/business.py#L173-L178
This was referenced 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.
Closes https://linear.app/getsentry/issue/REVENG-333/introduce-retention-protos
This introduces common and re-usable retention protos that'll be used in:
Prior art from legacy billing system that's ported into new billing platform world:
TieredPlanItem.retentionandTieredPlanItem.downsampled_event_retentionhttps://github.com/getsentry/getsentry/blob/b9f4cddb1d463c5f56083cad5b1201f165f52ccd/getsentry/billing/plans/tiered_plan_item.py#L38-L39
BillingMetricHistory.retention_daysandBillingMetricHistory.retention_days_downsampledhttps://github.com/getsentry/getsentry/blob/b9f4cddb1d463c5f56083cad5b1201f165f52ccd/getsentry/models/billingmetrichistory.py#L491-L493