From ad955e76ae78e45f8dc225c7597b1b84d2c0a619 Mon Sep 17 00:00:00 2001 From: Brendan Hy Date: Thu, 13 Aug 2026 12:02:06 -0700 Subject: [PATCH 1/4] chore(billing-platform): Add spend allocation to the rate card and usage pricer --- .../v1/services/rate_card/v1/rate_card.proto | 9 ++++++++ .../v1/endpoint_usage_pricer.proto | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/proto/sentry_protos/billing/v1/services/rate_card/v1/rate_card.proto b/proto/sentry_protos/billing/v1/services/rate_card/v1/rate_card.proto index 8be03c83..4071a4e6 100644 --- a/proto/sentry_protos/billing/v1/services/rate_card/v1/rate_card.proto +++ b/proto/sentry_protos/billing/v1/services/rate_card/v1/rate_card.proto @@ -5,6 +5,13 @@ package sentry_protos.billing.v1.services.rate_card.v1; import "sentry_protos/billing/v1/common/v1/line_item_details.proto"; import "sentry_protos/billing/v1/common/v1/pricing_tier.proto"; +message ProjectSpendAllocation { + uint64 project_id = 1; + + // Reserved line-item units assigned exclusively to this project + uint64 quantity = 2; +} + message RateCardLineItem { sentry_protos.billing.v1.common.v1.LineItemDetails line_item_detail = 1; @@ -20,6 +27,8 @@ message RateCardLineItem { // Whether this line item is currently enabled bool is_enabled = 7; + + repeated ProjectSpendAllocation project_spend_allocations = 8; } message SharedRateCardLineItem { diff --git a/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto b/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto index bd61ff02..461bf9a2 100644 --- a/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto +++ b/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto @@ -85,6 +85,27 @@ message LineItemUsageSummary { bool has_remaining_capacity = 8; } +message ProjectSpendAllocationSummary { + // The project receiving reserved capacity. + uint64 project_id = 1; + + // Refers to the uid in + // sentry_protos.billing.v1.common.v1.LineItemDetails. + string line_item_uid = 2; + + // Reserved units assigned exclusively to this project for the billing period. + uint64 allocated_quantity = 3; + + // Project usage protected by the allocation. This is capped at + // allocated_quantity; project usage above the allocation remains shared-root + // usage and is not included here. + uint64 consumed_quantity = 4; + + // Unused allocated capacity. This equals + // allocated_quantity - consumed_quantity. + uint64 remaining_quantity = 5; +} + message SharedLineItemUsageSummary { // Net cents consumed across all SKUs in this shared budget (after credits/trials applied). uint64 payg_spend_cents = 1; @@ -114,4 +135,6 @@ message UsagePricerResponse { repeated SharedLineItemUsageSummary shared_line_item_summaries = 4; google.protobuf.Timestamp last_usage_ts = 5; + + repeated ProjectSpendAllocationSummary project_spend_allocation_summaries = 6; } From 5ec080f5e239d03fae106026be2b09b430e7a95a Mon Sep 17 00:00:00 2001 From: "getsantry[bot]" <66042841+getsantry[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 19:03:55 +0000 Subject: [PATCH 2/4] chore: Regenerate Rust bindings --- Cargo.lock | 2 +- ...protos.billing.v1.services.rate_card.v1.rs | 10 +++++++ ...tos.billing.v1.services.usage_pricer.v1.rs | 26 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index bf36ce53..6e27bf0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -717,7 +717,7 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "sentry_protos" -version = "0.62.0" +version = "0.62.1" dependencies = [ "prost", "prost-types", diff --git a/rust/src/sentry_protos.billing.v1.services.rate_card.v1.rs b/rust/src/sentry_protos.billing.v1.services.rate_card.v1.rs index a14f0f23..dd53053b 100644 --- a/rust/src/sentry_protos.billing.v1.services.rate_card.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.rate_card.v1.rs @@ -1,4 +1,12 @@ // This file is @generated by prost-build. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProjectSpendAllocation { + #[prost(uint64, tag = "1")] + pub project_id: u64, + /// Reserved line-item units assigned exclusively to this project + #[prost(uint64, tag = "2")] + pub quantity: u64, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct RateCardLineItem { #[prost(message, optional, tag = "1")] @@ -20,6 +28,8 @@ pub struct RateCardLineItem { /// Whether this line item is currently enabled #[prost(bool, tag = "7")] pub is_enabled: bool, + #[prost(message, repeated, tag = "8")] + pub project_spend_allocations: ::prost::alloc::vec::Vec, /// The following values are the effective values *after* contract overrides have been resolved. If there are no /// contract overrides, the default package values are used. #[prost(oneof = "rate_card_line_item::ReservedUnits", tags = "2, 3")] diff --git a/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs b/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs index 77ff2029..364fac17 100644 --- a/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs @@ -141,6 +141,28 @@ pub struct LineItemUsageSummary { #[prost(bool, tag = "8")] pub has_remaining_capacity: bool, } +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProjectSpendAllocationSummary { + /// The project receiving reserved capacity. + #[prost(uint64, tag = "1")] + pub project_id: u64, + /// Refers to the uid in + /// sentry_protos.billing.v1.common.v1.LineItemDetails. + #[prost(string, tag = "2")] + pub line_item_uid: ::prost::alloc::string::String, + /// Reserved units assigned exclusively to this project for the billing period. + #[prost(uint64, tag = "3")] + pub allocated_quantity: u64, + /// Project usage protected by the allocation. This is capped at + /// allocated_quantity; project usage above the allocation remains shared-root + /// usage and is not included here. + #[prost(uint64, tag = "4")] + pub consumed_quantity: u64, + /// Unused allocated capacity. This equals + /// allocated_quantity - consumed_quantity. + #[prost(uint64, tag = "5")] + pub remaining_quantity: u64, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct SharedLineItemUsageSummary { /// Net cents consumed across all SKUs in this shared budget (after credits/trials applied). @@ -175,4 +197,8 @@ pub struct UsagePricerResponse { pub shared_line_item_summaries: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "5")] pub last_usage_ts: ::core::option::Option<::prost_types::Timestamp>, + #[prost(message, repeated, tag = "6")] + pub project_spend_allocation_summaries: ::prost::alloc::vec::Vec< + ProjectSpendAllocationSummary, + >, } From 467475119ec37921f8bc3ec3b4966f8f0c75df87 Mon Sep 17 00:00:00 2001 From: Brendan Hy Date: Thu, 13 Aug 2026 12:04:08 -0700 Subject: [PATCH 3/4] ref --- .../usage_pricer/v1/endpoint_usage_pricer.proto | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto b/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto index 461bf9a2..df91b269 100644 --- a/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto +++ b/proto/sentry_protos/billing/v1/services/usage_pricer/v1/endpoint_usage_pricer.proto @@ -86,24 +86,14 @@ message LineItemUsageSummary { } message ProjectSpendAllocationSummary { - // The project receiving reserved capacity. uint64 project_id = 1; - - // Refers to the uid in - // sentry_protos.billing.v1.common.v1.LineItemDetails. string line_item_uid = 2; - // Reserved units assigned exclusively to this project for the billing period. + // Reserved units assigned exclusively to this project uint64 allocated_quantity = 3; - // Project usage protected by the allocation. This is capped at - // allocated_quantity; project usage above the allocation remains shared-root - // usage and is not included here. + // Amount of allocated quantity consumed by this project uint64 consumed_quantity = 4; - - // Unused allocated capacity. This equals - // allocated_quantity - consumed_quantity. - uint64 remaining_quantity = 5; } message SharedLineItemUsageSummary { From 9a76389166c3823ca30dd8beb3e4f4cc8c9efc26 Mon Sep 17 00:00:00 2001 From: "getsantry[bot]" <66042841+getsantry[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 19:05:22 +0000 Subject: [PATCH 4/4] chore: Regenerate Rust bindings --- ...ry_protos.billing.v1.services.usage_pricer.v1.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs b/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs index 364fac17..23de7ffb 100644 --- a/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs +++ b/rust/src/sentry_protos.billing.v1.services.usage_pricer.v1.rs @@ -143,25 +143,16 @@ pub struct LineItemUsageSummary { } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ProjectSpendAllocationSummary { - /// The project receiving reserved capacity. #[prost(uint64, tag = "1")] pub project_id: u64, - /// Refers to the uid in - /// sentry_protos.billing.v1.common.v1.LineItemDetails. #[prost(string, tag = "2")] pub line_item_uid: ::prost::alloc::string::String, - /// Reserved units assigned exclusively to this project for the billing period. + /// Reserved units assigned exclusively to this project #[prost(uint64, tag = "3")] pub allocated_quantity: u64, - /// Project usage protected by the allocation. This is capped at - /// allocated_quantity; project usage above the allocation remains shared-root - /// usage and is not included here. + /// Amount of allocated quantity consumed by this project #[prost(uint64, tag = "4")] pub consumed_quantity: u64, - /// Unused allocated capacity. This equals - /// allocated_quantity - consumed_quantity. - #[prost(uint64, tag = "5")] - pub remaining_quantity: u64, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SharedLineItemUsageSummary {