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

Rate limiting is skipped for metrics when there was a cached rate limit. #3677

Open
Dav1dde opened this issue Jun 3, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@Dav1dde
Copy link
Member

Dav1dde commented Jun 3, 2024

The following code:

let quotas = state.config.quotas.clone();
let extraction_mode = state.get_extraction_mode();
let buckets = match MetricsLimiter::create(buckets, quotas, scoping, extraction_mode) {
Ok(mut bucket_limiter) => {
let cached_rate_limits = self.rate_limits().clone();
#[allow(unused_variables)]
let was_rate_limited = bucket_limiter.enforce_limits(
&cached_rate_limits,
metric_outcomes,
outcome_aggregator,
);
#[cfg(feature = "processing")]
if !was_rate_limited && self.config.processing_enabled() {
// If there were no cached rate limits active, let the processor check redis:
envelope_processor.send(RateLimitBuckets { bucket_limiter });
return;
}
bucket_limiter.into_buckets()
}
Err(buckets) => buckets,
};

If there is a single cached rate limit we skip checking non-cached rate limits. For example if there is a cached rate limit for spans we won't check the rate limits for transactions.

@Dav1dde Dav1dde added the bug Something isn't working label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant