-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cardinality): Add cardinality limits config to project config (#…
- Loading branch information
Showing
8 changed files
with
76 additions
and
26 deletions.
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 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 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,35 @@ | ||
use relay_base_schema::metrics::MetricNamespace; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::SlidingWindow; | ||
|
||
/// A cardinality limit. | ||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] | ||
pub struct CardinalityLimit { | ||
/// Unique identifier of the cardinality limit. | ||
pub id: String, | ||
/// The sliding window to enforce the cardinality limits in. | ||
pub window: SlidingWindow, | ||
/// The cardinality limit. | ||
pub limit: u64, | ||
|
||
/// Scope which the limit applies to. | ||
pub scope: CardinalityScope, | ||
/// Metric namespace the limit applies to. | ||
/// | ||
/// No namespace means this specific limit is enforced across all namespaces. | ||
pub namespace: Option<MetricNamespace>, | ||
} | ||
|
||
/// A scope to restrict the [`CardinalityLimit`] to. | ||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)] | ||
pub enum CardinalityScope { | ||
/// The organization that this project belongs to. | ||
/// | ||
/// This is the top-level scope. | ||
Organization, | ||
|
||
/// Any other scope that is not known by this Relay. | ||
#[serde(other)] | ||
Unknown, | ||
} |
This file contains 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 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 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 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 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