-
Notifications
You must be signed in to change notification settings - Fork 834
WooCommerce Analytics: Add proxy speed module to enhance proxy API performance #45243
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
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
1 file is newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
- Introduced a new class `WooCommerceAnalyticsProxySpeed` to handle proxy requests and optimize performance. - Added methods to manage the installation and removal of the proxy speed module. - Implemented functionality to filter active plugins based on proxy requests. - Created a new MU plugin file for the proxy speed module.
- Added a constant for the proxy speed module version. - Updated methods to manage the addition and removal of the proxy speed module, removing unnecessary user capability checks. - Changed the installation process to copy the proxy speed module file instead of a directory. - Integrated calls to add and remove the proxy speed module in Jetpack plugin initialization and deactivation processes.
66873bc
to
3e2273b
Compare
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.
Pull Request Overview
This PR introduces a proxy speed module for WooCommerce Analytics to enhance proxy API performance by selectively loading only necessary plugins during proxy requests. The module is inspired by Plausible's implementation and is placed in the mu-plugins directory to prevent unnecessary plugins from being loaded.
Key changes:
- Adds a proxy speed module that filters active plugins for WooCommerce Analytics proxy requests
- Integrates module installation/removal with Jetpack plugin activation/deactivation lifecycle
- Implements file management methods to copy the module to mu-plugins directory and clean up on deactivation
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
class.jetpack.php | Integrates proxy speed module lifecycle with Jetpack activation/deactivation |
woocommerce-analytics-proxy-speed-module.php | Core proxy speed module that filters active plugins for performance |
class-woocommerce-analytics.php | Adds methods to manage proxy speed module installation and removal |
changelog files | Documents the feature addition |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...ts/packages/woocommerce-analytics/src/mu-plugin/woocommerce-analytics-proxy-speed-module.php
Show resolved
Hide resolved
projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php
Outdated
Show resolved
Hide resolved
projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php
Outdated
Show resolved
Hide resolved
projects/packages/woocommerce-analytics/src/class-woocommerce-analytics.php
Outdated
Show resolved
Hide resolved
…analytics.php Co-authored-by: Copilot <[email protected]>
…analytics.php Co-authored-by: Copilot <[email protected]>
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.
This looks good and tested well!
Would appreciate a review from @kangzj still given it was his original suggestion, and he said in the P2 comment "We’ll need input and assistance from the ops team for this approach", meaning we should loop in ops for this review as well? or is that a follow up?
If I understand correctly, @kangzj suggested that for "CIAB sites," we could work with the ops team to set up a direct proxy at the web server level for optimal performance. This remains a viable option, though it would require some additional effort to implement. However, I think it's nice to have a choice, especially now that we've also added the proxy API with the proxy speed module. I'd also appreciate a review or feedback from @kangzj. 🙏 |
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.
LGTM! You rock 🎸
Related to pfKYZu-2Yt-p2#comment-3041
Proposed changes
This PR introduces a proxy speed module that inspired by Plausible's proxy speed module for WooCommerce Analytics to enhance the proxy API performance.
The module is placed in the mu-plugins directory to prevent unnecessary plugins from being loaded during proxy requests, thereby improving performance.
Other information
Jetpack product discussion
n/a
Does this pull request change what data or activity we track or use?
n/a
Testing instructions
Confirm proxy speed module is added/removed as Jetpack is activated/deactivated
wp-content/mu-plugins/woocommerce-analytics-proxy-speed-module.php
does not exist.wp-content/mu-plugins/woocommerce-analytics-proxy-speed-module.php
does exist.Test REST API request
test_add_rest_api function is called
is logged in thewp-content/debug.log
file.