Repository navigation
feat(quotas): Separate processing and indexing quotas - #1537
Merged
Merged
Conversation
jan-auer
marked this pull request as ready for review
October 21, 2022 10:05
jjbayer
approved these changes
Oct 21, 2022
olksdr
reviewed
Oct 21, 2022
| let mut mock = MockLimiter::default().deny(DataCategory::Transaction); | ||
| let limiter = EnvelopeLimiter::new(Some(&config), |s, q| mock.check(s, q)); | ||
|
|
||
| let (enforcement, _limits) = limiter.enforce(&mut envelope, &scoping()).unwrap(); |
Contributor
There was a problem hiding this comment.
Why don't we check the limits in this test and in the one below?
Member
Author
There was a problem hiding this comment.
This test is mostly about asserting correct calls to the inner rate limiter and there are already tests that then check the response behavior. We can keep this test to a single concern with fewer assertions.
jan-auer
force-pushed
the
feat/indexed-transactions-limiting
branch
from
October 24, 2022 09:54
3f2ef61 to
14810e9
Compare
### Background In #1515 we implemented rate limiting functionality for metrics buckets, which are applied after flushing them from the metrics aggregator by checking redis. ### This PR When a quota is already exhausted, and that information has already been cached on the project state, there is no need to go through the aggregator at all. Instead, we apply the rate limiting logic _before_ sending metrics or buckets into the aggregator. ### Implementation details The utility type `BucketLimiter` was converted to a generic `MetricsLimiter<T>`, where `T` can be either `Metric` or `Bucket`. ### Notes Will be merged into #1537 & deployed together.
jjbayer
added a commit
that referenced
this pull request
Oct 24, 2022
iker-barriocanal
approved these changes
Oct 24, 2022
* master: fix(gha): Skip Sentry integration tests on library release builds (#1550) ref: Use wildcard re-exports where applicable (#1526) ci(gha): Skip Sentry integration tests on library release builds (#1549) release: 0.8.15 fix(py): Respect the renormalize flag (#1548) (fix)e2e: Use report self hosted issues env variable (#1539) meta(vscode): Enable all features in Rust-Analyzer (#1542) release: 0.8.14 build(craft): Fix manylinux artifact name (#1547)
jan-auer
added a commit
that referenced
this pull request
Oct 27, 2022
* master: feat(quotas): Separate processing and indexing quotas (#1537) feat(replays): Adjust replay parser to be less strict and allow for larger segment-ids (#1551) fix(gha): Skip Sentry integration tests on library release builds (#1550) ref: Use wildcard re-exports where applicable (#1526) ci(gha): Skip Sentry integration tests on library release builds (#1549) release: 0.8.15 fix(py): Respect the renormalize flag (#1548) (fix)e2e: Use report self hosted issues env variable (#1539) meta(vscode): Enable all features in Rust-Analyzer (#1542)
jan-auer
added a commit
that referenced
this pull request
Oct 27, 2022
With #1537 Relay started to under-report outcomes for rate limited transactions. The root cause is that `Enforcement` was not updated to emit outcomes for metrics. This reveals that enforcements for metrics should be recorded only if metrics have not been extracted from a transaction item yet. In this case, metrics can still be considered part of the transaction item and as such an outcome is needed. In contrast, once metrics have been extracted, responsibility for recording outcomes is moved to the recipient of metrics.
jan-auer
added a commit
to getsentry/sentry
that referenced
this pull request
Nov 22, 2022
…#41607) In #40507 we started to count transaction metrics in the `transaction` data category and transaction events in the `transaction_indexed` data category. That PR missed that metrics extraction can be disabled, in which case the old behavior of counting events as `transaction` should remain. Relay already implemented this logic since getsentry/relay#1537 based on the metrics extraction flag. This PR adds a feature check to the `organizations:transaction-metrics-extraction` feature, which is the same feature flag used to control Relay's behavior. We also remove the previously used option to sample a percentage of organizations into metrics extraction. The default for this feature remains off (`false`) until metrics components have been added to all deployment targets including self-hosted. Co-authored-by: Matej Minar <[email protected]>
naterator
pushed a commit
to getsentry/sentry
that referenced
this pull request
Nov 22, 2022
…#41607) In #40507 we started to count transaction metrics in the `transaction` data category and transaction events in the `transaction_indexed` data category. That PR missed that metrics extraction can be disabled, in which case the old behavior of counting events as `transaction` should remain. Relay already implemented this logic since getsentry/relay#1537 based on the metrics extraction flag. This PR adds a feature check to the `organizations:transaction-metrics-extraction` feature, which is the same feature flag used to control Relay's behavior. We also remove the previously used option to sample a percentage of organizations into metrics extraction. The default for this feature remains off (`false`) until metrics components have been added to all deployment targets including self-hosted. Co-authored-by: Matej Minar <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Once metrics have been extracted, transaction events need to have the
new
DataCategory::TransactionIndexedquota available to ingest andstore the payload.
The new indexing quota replaces the previous
DataCategory::Transactionfor transaction payloads. Transaction quotas now cover all ingested
transactions that have metrics extracted. Transaction quota however is
only counted in the metrics part and not in event ingestion.
Background
Rate limiting and quota enforcement has to apply to legacy plans that
did not have processed transaction functionality, and to new plans
that introduce them.
Organization on Legacy Plan
There is a single quota for total transactions. We need to extract
metrics for indexed transactions so that there is backfilled history at
the time the customer switches to the new plan. This requires to extract
metrics for all accepted transactions.
Organization on New Plan
This plan has a dedicated additional quota for indexed transactions.
There are no metrics extracted for such dropped events.
this transaction. Otherwise, drop the transaction event and any
transaction metrics bucket.
Extracted metrics and the transaction quotas are not
impacted by this.
sampled transaction event payload. Otherwise, drop the transaction event.
Algorithm
Flow:
transactiondata category and exit.Transaction quota is incremented by the extracted metrics.
References