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

feat(cardinality): Create outcomes for cardinality limited metrics #2947

Merged
merged 8 commits into from
Jan 16, 2024

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Jan 16, 2024

Creates rate limited outcomes for cardinality limited items.

Maybe we should introduce a new outcome id for the cardinality limiter instead?

@Dav1dde Dav1dde requested a review from a team as a code owner January 16, 2024 11:36
@Dav1dde Dav1dde self-assigned this Jan 16, 2024
@Dav1dde Dav1dde requested a review from jan-auer January 16, 2024 11:36
@@ -180,6 +183,7 @@ impl Outcome {
match self {
Outcome::Filtered(_) | Outcome::FilteredSampling(_) => OutcomeId::FILTERED,
Outcome::RateLimited(_) => OutcomeId::RATE_LIMITED,
Outcome::CardinalityLimited => OutcomeId::RATE_LIMITED,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we introduce a new outcome instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not strictly necessary; we could also differentiate it purely by reason code, which is what you're doing now. While it's not ideal that two variants to the same outcome ID, we already have a similar setup for dynamic sampling.

If you were to introduce a new outcome, please split this PR in two parts, and first bump all libraries to avoid errors in the consumers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be interesting to have this data available internally to evaluate how high/low the limits are, and the impact on costs. I don't know if other parts (e.g. consumers?) need to be updated to handle new outcomes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 let's keep it like this and in the future we can split this into a separate outcome id

@@ -180,6 +183,7 @@ impl Outcome {
match self {
Outcome::Filtered(_) | Outcome::FilteredSampling(_) => OutcomeId::FILTERED,
Outcome::RateLimited(_) => OutcomeId::RATE_LIMITED,
Outcome::CardinalityLimited => OutcomeId::RATE_LIMITED,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not strictly necessary; we could also differentiate it purely by reason code, which is what you're doing now. While it's not ideal that two variants to the same outcome ID, we already have a similar setup for dynamic sampling.

If you were to introduce a new outcome, please split this PR in two parts, and first bump all libraries to avoid errors in the consumers.

let mode = match project_state.config.transaction_metrics {
Some(ErrorBoundary::Ok(ref c)) if c.usage_metric() => ExtractionMode::Usage,
_ => ExtractionMode::Duration,
};

if project_state.has_feature(Feature::CardinalityLimiter) {
buckets = self.cardinality_limit_buckets(scoping, buckets, mode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -180,6 +183,7 @@ impl Outcome {
match self {
Outcome::Filtered(_) | Outcome::FilteredSampling(_) => OutcomeId::FILTERED,
Outcome::RateLimited(_) => OutcomeId::RATE_LIMITED,
Outcome::CardinalityLimited => OutcomeId::RATE_LIMITED,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be interesting to have this data available internally to evaluate how high/low the limits are, and the impact on costs. I don't know if other parts (e.g. consumers?) need to be updated to handle new outcomes.

relay-cardinality/src/limiter.rs Show resolved Hide resolved
relay-cardinality/src/limiter.rs Outdated Show resolved Hide resolved
@Dav1dde Dav1dde enabled auto-merge (squash) January 16, 2024 16:11
@Dav1dde Dav1dde changed the title feat(cardinality): Log outcomes for cardinality limited metrics feat(cardinality): Create outcomes for cardinality limited metrics Jan 16, 2024
@Dav1dde Dav1dde merged commit 5a65714 into master Jan 16, 2024
20 checks passed
@Dav1dde Dav1dde deleted the feat/cardlimit-outcomes branch January 16, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants