1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// This file is @generated by prost-build.
/// Compiles per-day, per-line-item usage breakdowns spanning one or more
/// contracts. UsagePricer evaluates each contract's package
/// `BillableMetric.expression` once per outcome field of the raw
/// usage, so callers receive the package-projected `UsageData` view
/// rather than the raw outcomes returned by `BillingUsageService`.
///
/// This is the "non-pricing" derived view UsagePricer exposes -- the
/// projection step pricing already performs internally, lifted out so
/// other presentation services (e.g. ChargeService for CSV / UI) can
/// consume it without re-implementing evaluation.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetDailyBreakdownRequest {
/// The contracts whose daily breakdowns should be returned.
#[prost(string, repeated, tag = "1")]
pub contract_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// One line item's projected per-outcome quantities on a given date.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LineItemDailyOutcomes {
/// Package line item uid (UsagePricer's native vocabulary).
#[prost(string, tag = "1")]
pub line_item_uid: ::prost::alloc::string::String,
/// The seven outcome fields, each populated by evaluating the line
/// item's `BillableMetric.expression` against that outcome's raw
/// counts in the day's usage.
#[prost(message, optional, tag = "2")]
pub outcomes: ::core::option::Option<super::super::super::UsageData>,
}
/// One row per calendar date spanning the union of the requested
/// contracts' on-demand periods.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DailyLineItemOutcomes {
#[prost(message, optional, tag = "1")]
pub date: ::core::option::Option<super::super::super::Date>,
/// Per-line-item outcomes on this date. Every metered line item from
/// the union of the requested contracts' packages is emitted,
/// including line items with zero usage, so consumers can render
/// zero-rows without a separate zero-fill pass.
#[prost(message, repeated, tag = "2")]
pub line_items: ::prost::alloc::vec::Vec<LineItemDailyOutcomes>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDailyBreakdownResponse {
/// Days in ascending date order. A given calendar date appears at
/// most once regardless of how many of the requested contracts
/// overlap it (BillingUsageService reports usage at calendar-day
/// granularity, so a day straddling a mid-day rollover is still one
/// row carrying the day's full outcomes). Contract ids from the
/// request that do not resolve contribute no rows.
#[prost(message, repeated, tag = "1")]
pub days: ::prost::alloc::vec::Vec<DailyLineItemOutcomes>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UsagePricerRequest {
#[prost(uint64, tag = "1")]
pub organization_id: u64,
#[prost(message, optional, tag = "2")]
pub start: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub end: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPriceForContractRequest {
#[prost(uint64, tag = "1")]
pub contract_id: u64,
#[prost(message, optional, tag = "2")]
pub usage_start_watermark_ts: ::core::option::Option<::prost_types::Timestamp>,
/// Instead of getting the usage for the contract at query time, pass in
/// pre-constructed usage data to simulate what the priced usage would be
#[prost(message, optional, tag = "3")]
pub simulated_usage: ::core::option::Option<
super::super::usage::v1::GetUsageResponse,
>,
/// When set, price the contract's usage against this package's rate card instead
/// of the contract's own -- "what would this usage cost under package X". Used by
/// checkout to freeze a PAYG cap against usage re-priced under an upgrade's target
/// package. The contract's overrides (e.g. reserved volumes) still apply.
#[prost(string, optional, tag = "4")]
pub override_package_uid: ::core::option::Option<::prost::alloc::string::String>,
/// Paired with override_package_uid: price at this billing interval instead of the
/// contract's own, for an upgrade that also changes the interval.
#[prost(uint32, optional, tag = "5")]
pub override_month_interval: ::core::option::Option<u32>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SkuUsageSummary {
#[prost(enumeration = "super::super::super::Sku", tag = "1")]
pub sku: i32,
/// Net cents consumed by this SKU in the billing period (after credits/trials applied).
#[prost(uint64, tag = "2")]
pub payg_spend_cents: u64,
/// Total units consumed by this SKU in the billing period.
#[prost(uint64, tag = "3")]
pub usage_volume: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SharedBudgetUsageSummary {
#[prost(enumeration = "super::super::super::Sku", repeated, tag = "1")]
pub skus: ::prost::alloc::vec::Vec<i32>,
/// Net cents consumed across all SKUs in this shared budget (after credits/trials applied).
#[prost(uint64, tag = "2")]
pub payg_spend_cents: u64,
/// Per-SKU breakdown within the shared budget.
#[prost(message, repeated, tag = "3")]
pub sku_summaries: ::prost::alloc::vec::Vec<SkuUsageSummary>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LineItemUsageSummary {
/// Refers to uid in sentry_protos.billing.v1.common.v1.LineItemDetails
#[prost(string, tag = "1")]
pub line_item_uid: ::prost::alloc::string::String,
/// Net cents consumed by this line item in the billing period (after credits/trials applied).
#[prost(uint64, tag = "2")]
pub payg_spend_cents: u64,
/// How much of the line item was consumed by PAYG (in the line item's units)
#[prost(uint64, tag = "3")]
pub quantity: u64,
/// Whether the usage pricer had to cap the spend based on the budget set by the contract
#[prost(bool, tag = "4")]
pub payg_budget_exhausted: bool,
/// false when this line item still has reserved quantity left.
/// It's possible that PAYG is exhausted whereas reserved is not.
/// Example: there's an overall PAYG budget of $10, a customer sends $10 worth of errors
/// the payg_budget_exhausted field is true for all line items
/// however, the plan still includes 5GB of free logs, so reserved_budget_exhausted is false for logs.
#[prost(bool, tag = "5")]
pub reserved_budget_exhausted: bool,
/// Total units consumed by this line item in the billing period, including
/// both reserved and PAYG usage (in the line item's units). Unlike `quantity`,
/// this is not reduced by the reserved amount.
#[prost(uint64, tag = "6")]
pub total_quantity: u64,
/// Cents this line item drew from its shared reserved budget in the billing
/// period. Only set for members of a shared reserved-budget pool (e.g. Seer);
/// 0 for line items without a reserved budget.
#[prost(uint64, tag = "7")]
pub reserved_spend_cents: u64,
/// True when this line item can continue accepting usage from any capacity
/// source, including reserved, PAYG, or granted capacity.
#[prost(bool, tag = "8")]
pub has_remaining_capacity: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SharedLineItemUsageSummary {
/// Net cents consumed across all SKUs in this shared budget (after credits/trials applied).
#[prost(uint64, tag = "1")]
pub payg_spend_cents: u64,
/// Line item breakdown within shared budget
#[prost(message, repeated, tag = "2")]
pub line_item_summaries: ::prost::alloc::vec::Vec<LineItemUsageSummary>,
/// Whether the usage pricer had to cap the spend based on the budget set by the contract
#[prost(bool, tag = "3")]
pub payg_budget_exhausted: bool,
/// false when this pool still has reserved quantity left.
#[prost(bool, tag = "4")]
pub reserved_budget_exhausted: bool,
/// True when any member of this pool can continue accepting usage.
#[prost(bool, tag = "5")]
pub has_remaining_capacity: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UsagePricerResponse {
/// use line_item_summaries
#[deprecated]
#[prost(message, repeated, tag = "1")]
pub sku_summaries: ::prost::alloc::vec::Vec<SkuUsageSummary>,
/// use shared_line_item_summaries
#[deprecated]
#[prost(message, repeated, tag = "2")]
pub shared_budget_summaries: ::prost::alloc::vec::Vec<SharedBudgetUsageSummary>,
#[prost(message, repeated, tag = "3")]
pub line_item_summaries: ::prost::alloc::vec::Vec<LineItemUsageSummary>,
#[prost(message, repeated, tag = "4")]
pub shared_line_item_summaries: ::prost::alloc::vec::Vec<SharedLineItemUsageSummary>,
#[prost(message, optional, tag = "5")]
pub last_usage_ts: ::core::option::Option<::prost_types::Timestamp>,
}