Skip to content
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

fix(quotas): Use correct string spelling for TransactionProcessed #1514

Merged
merged 5 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Remove long-running futures from metrics flush. ([#1492](https://github.com/getsentry/relay/pull/1492))
- Migrate to 2021 Rust edition. ([#1510](https://github.com/getsentry/relay/pull/1510))
- Make the profiling frame object compatible with the stacktrace frame object from event. ([#1512](https://github.com/getsentry/relay/pull/1512))
- Fix quota DataCategory::TransactionProcessed serialisation to match that of the CAPI. ([#1514](https://github.com/getsentry/relay/pull/1514))

## 22.9.0

Expand Down
4 changes: 3 additions & 1 deletion relay-common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl fmt::Display for EventType {

/// Classifies the type of data that is being ingested.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
#[serde(rename_all = "snake_case")]
#[repr(i8)]
pub enum DataCategory {
/// Reserved and unused.
Expand Down Expand Up @@ -128,6 +128,7 @@ pub enum DataCategory {
impl DataCategory {
/// Returns the data category corresponding to the given name.
pub fn from_name(string: &str) -> Self {
// TODO: This should probably use serde.
match string {
"default" => Self::Default,
"error" => Self::Error,
Expand All @@ -144,6 +145,7 @@ impl DataCategory {

/// Returns the canonical name of this data category.
pub fn name(self) -> &'static str {
// TODO: This should probably use serde.
match self {
Self::Default => "default",
Self::Error => "error",
Expand Down
6 changes: 6 additions & 0 deletions relay-server/src/utils/rate_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ impl EnvelopeSummary {
summary
}

/// Infers the appropriate [`DataCategory`] for the envelope [`Item`].
///
/// The inferred category is only applied to the [`EnvelopeSummary`] if there is not yet
/// a category set.
fn infer_category(&mut self, item: &Item) {
if matches!(self.event_category, None | Some(DataCategory::Default)) {
if let Some(category) = infer_event_category(item) {
Expand All @@ -186,6 +190,8 @@ struct CategoryLimit {
/// The limited data category.
category: DataCategory,
/// The total rate limited quantity across all items.
///
/// This will be `0` if nothing was rate limited.
quantity: usize,
/// The reason code of the applied rate limit.
///
Expand Down