-
-
Notifications
You must be signed in to change notification settings - Fork 517
feat: calculate tenant usage in core #7174
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
Merged
Merged
Conversation
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
COMPARE TO
|
Name | Diff |
---|---|
packages/core/src/libraries/quota.ts | 📈 +2.88 KB |
packages/core/src/queries/tenant-usage/index.ts | 📈 +9.75 KB |
packages/core/src/queries/tenant-usage/types.ts | 📈 +2.07 KB |
packages/core/src/routes/resource.scope.ts | 📈 +5 Bytes |
packages/core/src/routes/role.scope.ts | 📈 +5 Bytes |
packages/core/src/routes/sign-in-experience/index.ts | 📈 +47 Bytes |
packages/core/src/tenants/Libraries.ts | 📈 +64 Bytes |
packages/core/src/tenants/Queries.ts | 📈 +114 Bytes |
packages/core/src/test-utils/quota.ts | 📈 +927 Bytes |
973f5f1
to
f2a78e1
Compare
simeng-li
reviewed
Apr 7, 2025
f2a78e1
to
78d73fd
Compare
b29e6a8
to
3ba5558
Compare
simeng-li
reviewed
Apr 9, 2025
simeng-li
approved these changes
Apr 9, 2025
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.
Summary
Since Logto's services are deployed across different regions (AU, US, EU, etc.), frequent cross-region requests inherently take longer due to physical distance limitations. To reduce the waiting time for systems operating within the same region caused by these prolonged requests, we minimize or replace such requests with alternative approaches wherever possible.
Prior to this change, fetching subscription usage data required frequent cross-region requests to Logto Cloud (hosted in the EU). Now, we compute subscription usage locally within each region (except for
tenantMembers
, which still necessitates requests to the Logto Cloud service—all other usage metrics can be calculated locally). This optimization significantly improves API performance for services in non-EU regions.This resolves LOG-10879
Testing
Will be covered with Logto Cloud integration tests, see https://github.com/logto-io/cloud/pull/1180.
In previous https://github.com/logto-io/cloud/pull/1169, we add quota guard logics integration tests for Cloud.
Checklist
.changeset