Skip to content

feat(quotas): add has_usage_quota interface method for usage-based categories#106393

Merged
dashed merged 1 commit intomasterfrom
billing/BIL-1980
Jan 16, 2026
Merged

feat(quotas): add has_usage_quota interface method for usage-based categories#106393
dashed merged 1 commit intomasterfrom
billing/BIL-1980

Conversation

@dashed
Copy link
Member

@dashed dashed commented Jan 15, 2026

Closes https://linear.app/getsentry/issue/BIL-1980/quota-method-for-emerge

Add a new quota checking method for categories with TallyType.USAGE. This is distinct from has_available_reserved_budget which is for cost-based Reserved Budgets (where reserved=-2).

The method checks if an organization has available quota for usage-based categories like SIZE_ANALYSIS, INSTALLABLE_BUILD, and similar categories that are not rate-limited in Relay.

Default implementation returns True; actual logic is in getsentry.

…tegories

Add a new quota checking method for categories with TallyType.USAGE.
This is distinct from has_available_reserved_budget which is for
cost-based Reserved Budgets (where reserved=-2).

The method checks if an organization has available quota for usage-based
categories like SIZE_ANALYSIS, INSTALLABLE_BUILD, and similar categories
that are not rate-limited in Relay.

Default implementation returns True; actual logic is in getsentry.

BIL-1980
@dashed dashed requested a review from a team January 15, 2026 19:29
@dashed dashed self-assigned this Jan 15, 2026
@dashed dashed requested a review from a team as a code owner January 15, 2026 19:29
@linear
Copy link

linear bot commented Jan 15, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 15, 2026
Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

This quota interface keeps getting extended and already has a bunch of methods which are no longer true to the original intention (Relay enforced quotas).

Obviously not a new thing, it's just another method and which happens to also call out Relay. But it may be a good starting point to start thinking about separating the interfaces.

Wdyt?

@vbro
Copy link
Contributor

vbro commented Jan 15, 2026

@Dav1dde

We can move these out to a new class (e.g. NonRelayQuota) which would be a subclass of Quota. Is that what you were thinking?

Does having these new methods in Quota affect the way Relay works, or it's a no-op?

@Dav1dde
Copy link
Member

Dav1dde commented Jan 15, 2026

Does having these new methods in Quota affect the way Relay works, or it's a no-op?

No, all is good, just thinking a bit about architecture. If the growth of methods was intentional, that's fine too. Please feel free to just move ahead with this PR, this discussion is probably better held outside that PR anyways.

[...] which would be a subclass of Quota.

Why do you need that to subclass Quota?

@dashed
Copy link
Member Author

dashed commented Jan 16, 2026

Yea I agree. We've been adding billing based methods to Quota for some time.

I'll look into re-organizing this better.

@dashed dashed merged commit 34105c2 into master Jan 16, 2026
67 checks passed
@dashed dashed deleted the billing/BIL-1980 branch January 16, 2026 07:36
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants