-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Enterprise API Usage Report #35532
Enterprise API Usage Report #35532
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: corehq/apps/enterprise/enterprise.py
Did you find this useful? React with a 👍 or 👎 |
corehq/apps/enterprise/enterprise.py
Outdated
usernames = self.account.get_web_user_usernames() | ||
unique_users = [User.objects.get(username=username) for username in usernames] | ||
return HQApiKey.objects.filter(user__in=unique_users, is_active=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three things we might want to look into here:
- Can we simplify what is pulled back from the database -- i.e. instead of fetching the entire user object, can we fetch just the user ID or username
- Can/should this be turned into a subquery so that we only send a single query to the database?
- At what # of users are we concerned with
__in
performance? Maybe run this by the infrastructure team.
corehq/apps/enterprise/enterprise.py
Outdated
return [ | ||
api_key.user.username, | ||
api_key.name, | ||
api_key.domain if api_key.domain else 'All project spaces', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate "All project spaces"
Although some api key's scope is all project spaces, but we should only show project space that is a member of the billing account and the user is a member of, which reflects the actual scope
Product Description
This PR is to add Enterprise API Usage report in enterprise console. This tile will live in Security Center.
UI:
The downloaded report:
API
Technical Summary
Ticket: https://dimagi.atlassian.net/browse/SAAS-16378
The implementation is straight forward. All the information required in this report lives in
HQApiKey
.Feature Flag
Safety Assurance
Safety story
Tested locally.
Automated test coverage
QA Plan
Rollback instructions
Labels & Review