-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(billing): Add SGM service protos for enforcement and pricing #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
volokluev
wants to merge
5
commits into
main
Choose a base branch
from
volo/billing/sgm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d4399e2
feat(billing): Add SGM service protos for enforcement and pricing
volokluev 89aeafd
chore: Regenerate Rust bindings
getsantry[bot] 62afaa9
clarify comments
volokluev 72bd780
more clarification
volokluev 0511206
chore: Regenerate Rust bindings
getsantry[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,4 @@ message Date { | |
| uint32 year = 1; | ||
| uint32 month = 2; | ||
| uint32 day = 3; | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
proto/sentry_protos/billing/v1/services/sgm/v1/enforcement_decision.proto
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package sentry_protos.billing.v1.services.sgm.v1; | ||
|
|
||
| import "google/protobuf/timestamp.proto"; | ||
| import "sentry_protos/billing/v1/data_category.proto"; | ||
|
|
||
| enum EnforcementType { | ||
| ENFORCEMENT_TYPE_UNSPECIFIED = 0; | ||
| ENFORCEMENT_TYPE_RATE_LIMIT = 1; | ||
| ENFORCEMENT_TYPE_SAMPLE = 2; | ||
| } | ||
|
|
||
| message EnforcementDecision { | ||
| uint64 contract_id = 1; | ||
| uint64 organization_id = 2; | ||
| EnforcementType enforcement_type = 3; | ||
| string explanation = 4; | ||
| // Even though we bill for SKUs, relay ingests data categories, so enforcement | ||
| // decisions are on a per-datacategory basis | ||
| DataCategory data_category = 5; | ||
| google.protobuf.Timestamp decision_time = 6; | ||
| google.protobuf.Timestamp expiration_time = 7; | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
proto/sentry_protos/billing/v1/services/sgm/v1/priced_usage.proto
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package sentry_protos.billing.v1.services.sgm.v1; | ||
|
|
||
| import "sentry_protos/billing/v1/services/contract/v1/sku.proto"; | ||
|
|
||
| message PricedSKUUsage { | ||
| sentry_protos.billing.v1.services.contract.v1.SKU sku = 1; | ||
| uint64 current_used_cents = 2; | ||
| } | ||
|
|
||
| message PricedUsage { | ||
| // the contract contains all the information about the | ||
| // organization's budget(s) | ||
| uint64 contract_id = 1; | ||
| // The amount of money used up for a specific SKU in the current | ||
| // billing period. Credits have already been applied to this calculation | ||
| repeated PricedSKUUsage priced_sku_usage = 2; | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // This file is @generated by prost-build. | ||
| #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] | ||
| pub struct EnforcementDecision { | ||
| #[prost(uint64, tag = "1")] | ||
| pub contract_id: u64, | ||
| #[prost(uint64, tag = "2")] | ||
| pub organization_id: u64, | ||
| #[prost(enumeration = "EnforcementType", tag = "3")] | ||
| pub enforcement_type: i32, | ||
| #[prost(string, tag = "4")] | ||
| pub explanation: ::prost::alloc::string::String, | ||
| /// Even though we bill for SKUs, relay ingests data categories, so enforcement | ||
| /// decisions are on a per-datacategory basis | ||
| #[prost(enumeration = "super::super::super::DataCategory", tag = "5")] | ||
| pub data_category: i32, | ||
| #[prost(message, optional, tag = "6")] | ||
| pub decision_time: ::core::option::Option<::prost_types::Timestamp>, | ||
| #[prost(message, optional, tag = "7")] | ||
| pub expiration_time: ::core::option::Option<::prost_types::Timestamp>, | ||
| } | ||
| #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] | ||
| #[repr(i32)] | ||
| pub enum EnforcementType { | ||
| Unspecified = 0, | ||
| RateLimit = 1, | ||
| Sample = 2, | ||
| } | ||
| impl EnforcementType { | ||
| /// String value of the enum field names used in the ProtoBuf definition. | ||
| /// | ||
| /// The values are not transformed in any way and thus are considered stable | ||
| /// (if the ProtoBuf definition does not change) and safe for programmatic use. | ||
| pub fn as_str_name(&self) -> &'static str { | ||
| match self { | ||
| Self::Unspecified => "ENFORCEMENT_TYPE_UNSPECIFIED", | ||
| Self::RateLimit => "ENFORCEMENT_TYPE_RATE_LIMIT", | ||
| Self::Sample => "ENFORCEMENT_TYPE_SAMPLE", | ||
| } | ||
| } | ||
| /// Creates an enum from field names used in the ProtoBuf definition. | ||
| pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { | ||
| match value { | ||
| "ENFORCEMENT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), | ||
| "ENFORCEMENT_TYPE_RATE_LIMIT" => Some(Self::RateLimit), | ||
| "ENFORCEMENT_TYPE_SAMPLE" => Some(Self::Sample), | ||
| _ => None, | ||
| } | ||
| } | ||
| } | ||
| #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] | ||
| pub struct PricedSkuUsage { | ||
| #[prost(enumeration = "super::super::contract::v1::Sku", tag = "1")] | ||
| pub sku: i32, | ||
| #[prost(uint64, tag = "2")] | ||
| pub current_used_cents: u64, | ||
| } | ||
| #[derive(Clone, PartialEq, ::prost::Message)] | ||
| pub struct PricedUsage { | ||
| /// the contract contains all the information about the | ||
| /// organization's budget(s) | ||
| #[prost(uint64, tag = "1")] | ||
| pub contract_id: u64, | ||
| /// The amount of money used up for a specific SKU in the current | ||
| /// billing period. Credits have already been applied to this calculation | ||
| #[prost(message, repeated, tag = "2")] | ||
| pub priced_sku_usage: ::prost::alloc::vec::Vec<PricedSkuUsage>, | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add project id