Website: log number of android enterprise requests in the past minute - #50780
Conversation
There was a problem hiding this comment.
Pull request overview
Adds lightweight request-rate telemetry for the website’s Android Management API proxy by tracking the number of Android Management API calls made and emitting a per-minute log line.
Changes:
- Initialize a global
sails.androidProxyApiRequestCountand set up a per-minute timer to log and reset the count. - Increment the counter in each
website/api/controllers/android-proxy/*controller right before making an Android Management API request.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/api/hooks/custom/index.js | Initializes a global Android Management API request counter and logs/resets it every minute (aligned to wall-clock minutes). |
| website/api/controllers/android-proxy/modify-enterprise-app-policy.js | Increments the global counter before the Android Management API policy-applications request. |
| website/api/controllers/android-proxy/modify-android-policies.js | Increments the global counter before the Android Management API policies.patch request. |
| website/api/controllers/android-proxy/modify-android-device.js | Increments the global counter before the Android Management API devices.patch request. |
| website/api/controllers/android-proxy/issue-command-on-android-device.js | Increments the global counter before the Android Management API devices.issueCommand request. |
| website/api/controllers/android-proxy/get-enterprise-applications.js | Increments the global counter before the Android Management API enterprises.applications.get request. |
| website/api/controllers/android-proxy/get-android-enterprises.js | Increments the global counter for each page of Android Management API enterprises.list requests. |
| website/api/controllers/android-proxy/get-android-devices.js | Increments the global counter before the Android Management API devices.list request. |
| website/api/controllers/android-proxy/get-android-device.js | Increments the global counter before the Android Management API devices.get request. |
| website/api/controllers/android-proxy/delete-one-android-enterprise.js | Increments the global counter before the Android Management API enterprises.delete request. |
| website/api/controllers/android-proxy/delete-android-device.js | Increments the global counter before the Android Management API devices.delete request. |
| website/api/controllers/android-proxy/create-enterprise-webapp.js | Increments the global counter before the Android Management API webApps.create request. |
| website/api/controllers/android-proxy/create-android-signup-url.js | Increments the global counter before the Android Management API signupUrls.create request. |
| website/api/controllers/android-proxy/create-android-enterprise.js | Increments the global counter before the Android Management API enterprises.create request. |
| website/api/controllers/android-proxy/create-android-enrollment-token.js | Increments the global counter before the Android Management API enrollmentTokens.create request. |
Suppressed comments (1)
website/api/hooks/custom/index.js:153
- Linked issue #49212 asks for per-Android-Enterprise-project and per-resource (policy vs device) counts. This implementation logs only a single global total for all Android Management API calls, and the log line doesn’t include project/resource identifiers, so it can’t satisfy the per-project/per-resource breakdown.
sails.log.info(`Android proxy: ${requestCountInLastMinute} Android Management API request(s) in the last minute.`);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe custom hook initializes and monitors Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@website/api/controllers/android-proxy/create-android-signup-url.js`:
- Line 66: Update the enterprise existence-check flow around
getIsEnterpriseManagedByFleet() so every
androidManagementConnection.enterprises.list() request increments
sails.androidProxyApiRequestCount before or when it is issued. Preserve the
existing signupUrls.create() increment and avoid double-counting requests if
reusing an already-counted helper.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ffcdc824-b3a0-4455-97f7-acfb87c62eba
📒 Files selected for processing (15)
website/api/controllers/android-proxy/create-android-enrollment-token.jswebsite/api/controllers/android-proxy/create-android-enterprise.jswebsite/api/controllers/android-proxy/create-android-signup-url.jswebsite/api/controllers/android-proxy/create-enterprise-webapp.jswebsite/api/controllers/android-proxy/delete-android-device.jswebsite/api/controllers/android-proxy/delete-one-android-enterprise.jswebsite/api/controllers/android-proxy/get-android-device.jswebsite/api/controllers/android-proxy/get-android-devices.jswebsite/api/controllers/android-proxy/get-android-enterprises.jswebsite/api/controllers/android-proxy/get-enterprise-applications.jswebsite/api/controllers/android-proxy/issue-command-on-android-device.jswebsite/api/controllers/android-proxy/modify-android-device.jswebsite/api/controllers/android-proxy/modify-android-policies.jswebsite/api/controllers/android-proxy/modify-enterprise-app-policy.jswebsite/api/hooks/custom/index.js
Related to: #49212
Changes:
sails.androidProxyApiRequestCount, and to log and reset the value every minutesails.androidProxyApiRequestCountevery time a request to the Android management API is sentSummary by CodeRabbit