feat(billing): add invoice_item_types to LineItemDetails#295
Conversation
A SKU's reserved, on-demand, and activated usage can each settle as a distinct InvoiceItemType. Collocating those identifiers on the SKU's LineItemDetails lets getsentry declare them per SKU instead of growing a shared enum. The new InvoiceItemTypes message keeps each context optional because some SKUs (e.g. Seer) fold their usage irregularly and do not populate every context.
|
The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).
|
| optional string reserved = 1; | ||
|
|
||
| // Type for on-demand (pay-as-you-go) usage of this SKU. | ||
| optional string ondemand = 2; |
There was a problem hiding this comment.
according to the changelog, ondemand has been replaced with payg, can we keep this consistent?
| // Type for activated usage of this SKU. | ||
| optional string activated = 3; |
There was a problem hiding this comment.
what is "activated usage"? what are the example values for it?
| BillableMetric billable_metric = 6; | ||
| } | ||
|
|
||
| // InvoiceItemType identifiers for a single SKU, split by billing context. |
There was a problem hiding this comment.
what is a SKU? Have we defined it somewhere?
| // distinct InvoiceItemType, so every context carries its own identifier instead | ||
| // of collapsing into one. Contexts are optional because some SKUs (e.g. Seer) | ||
| // fold their usage irregularly and do not populate every context. | ||
| message InvoiceItemTypes { |
There was a problem hiding this comment.
it's not clear to me why we would need to expose this in the proto as anything but an enum. We already have the billable_metric, the customer_facing_name, why would we also need to add reserved_errors, reserved_trace_metric_bytes etc to the list? Why not just an enum of
enum InvoiceItemType {
INVOICE_ITEM_TYPE_RESERVED = 1;
INVOICE_ITEM_TYPE_PAYG = 2;
INVOICE_ITEM_TYPE_ACTIVATED = 2;
}
I don't see why downstream services which need to generate a string like reserved_errors for their own purposes need that to be exposed in the lineitem proto
This is for https://github.com/getsentry/getsentry/pull/20573
What
Adds a nested
InvoiceItemTypesmessage toline_item_details.protoand attaches it toLineItemDetailsasinvoice_item_types(field number 2, previously unused).Why
A single SKU's reserved, on-demand, and activated usage can each settle as a distinct
InvoiceItemType. Collocating those identifiers on the SKU'sLineItemDetailslets getsentry declare them per SKU, instead of growing a shared enum every time a new SKU/context combination appears.Each context is
optionalbecause not every SKU uses every context — some SKUs (e.g. Seer) fold their usage irregularly and only populate a subset.Bindings
make build-rust) — the tracked.rsnow containsInvoiceItemTypesandLineItemDetails.invoice_item_types.make build-py); thepy/output is gitignored and not part of this diff.Cargo.lockleft at main's version (the build's version-bump drift was reverted).Compatibility
Purely additive — a new message and a new field on a previously-unused field number. No existing fields change.