feat(billing): Add common retention policy types#368
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).
|
| // message presence. | ||
| message StandardRetention { | ||
| // The number of calendar days that data is retained. Must be greater than zero. | ||
| uint32 days = 1; |
There was a problem hiding this comment.
This maps to TieredPlanItem.retention.
| message InheritStandard {} | ||
|
|
||
| // The retention policy for a category's downsampled data. | ||
| message DownsampledRetention { |
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.
|
|
||
| // 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; |
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
There was a problem hiding this comment.
I don't think I understand this comment. The standard retention setting is not optional in the proto but the downsampled one is optional. Doesn't that mean some categories would have both (the optional one would be non-null)
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