-
Notifications
You must be signed in to change notification settings - Fork 846
Use new heartbeat package #16285
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
Use new heartbeat package #16285
Conversation
|
Caution: This PR has changes that must be merged to WordPress.com |
1678866 to
2451002
Compare
9474367 to
9fb747b
Compare
2d3f84b to
de4253b
Compare
c5a89bc to
40c098c
Compare
f7fab8d to
0d4ba32
Compare
e0b6f19 to
bf97efb
Compare
0d4ba32 to
82dc320
Compare
sergeymitr
left a comment
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.
Everything looks good and works fine as far as I can tell.
This is an automated check which relies on E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16285 |
sergeymitr
left a comment
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 🙂
|
It looks like more reviews are needed, so I'm keeping the "Needs Review" label. |
jeherve
left a comment
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.
I have some questions as I am not sure I understand the inner workings here.
Co-authored-by: Jeremy Herve <[email protected]>
|
@jeherve As I feared tests have broken after adding the deprecated notices... I took a path of letting the class fully backward compatible and not follow the rabbit hole of replacing all calls it... What do you think? Should we remove the notices or is it better to clean all the usage of these methods? |
Maybe now is a good time to clean things up then? |
|
@jeherve quick ping to move this forward |
jeherve
left a comment
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.
Looking good now 🚢
* master: (23 commits) Premium Blocks: set blocks availability (#16898) Compat Package: Fix method declaration compatibility (#16900) Jetpack Dashboard: More meaningful error notices. (#16883) Connection REST API: Unit test for the `remote_authorize` request. (#16879) use blog token to request jetpack.updateBlog (#16698) Improve Story block media loading (#16663) Simplify error notices for broken connections (#16655) Use new heartbeat package (#16285) wrap-paid-block: remove component. deprecated. (#16895) Social Previews: improve preview description handling (#16889) Stats module use blog token (#16727) Form Block: add a new Consent Field, a new Newsletter setting, and a new newsletter variation (#16808) AAG: Backup card, fall back to VP content in case of /rewind API error. (#16867) Donations: Fix dependencies (#16892) Creative Mail: update option to lowercase (#16861) Premium Blocks: Implement the new design (#16611) Requests to Stats CSV use the blog token (#16716) Update spacing around sharing buttons to avoid no bottom margin below the customize link. (#16811) Jetpack SSO: Cleaning up the `requestNonce` API request. (#16830) Donations: Update plans when currency changes (#16844) ...
* add heartbeat as a dependecy for jetpack * Replace internal calls to use Heartbeat package * do not deactivate the heartbeat upon disconnect We are only adding jetpack stats to the heartbeat when jetpack is connected We dont need, and dont want, to disable all heartbeat when disconnecting since that may affect other plugins/packages using Heartbeat * adds heartbeat wp cli command * bump version in docblocks * Update class.jetpack-heartbeat.php Co-authored-by: Jeremy Herve <[email protected]> * add deprecation notices * Fix test Jetpack_Heartbeat class * add deprecated notice to cron_exec Co-authored-by: Jeremy Herve <[email protected]>
This PR makes jetpack uses the newly created Heartbeat package to handle the Heartbeat. It also creates a new CLI command to inspect the heartbeat
The approach here was to touch as little as possible the current heartbeat class, so everything still works as usual.
Jetpack_Heartbeatclass is now acting as a proxy class to the package, so you still can initialize and call its methods.Important - There are some uses of the
generate_stats_arraymethod that are not related to the heartbeat itself. That's why we kept it as is and static. It's used, for example, bywp jetpack statusCLI command.That's why these stats are always returned by the static method. On the other hand, they are only added to the heartbeat stats batch if the connection is active. (Originally, the whole heartbeat was only initialized if the connection was active)
This PR depends on the new Heartbeat package -> #16276
Changes proposed in this Pull Request:
Is this a new feature or does it add/remove features to an existing part of Jetpack?
Does this pull request change what data or activity we track or use?
no
Testing instructions:
cron_execmethod.Here's how to manually trigger the heart beat:
wp jetpack options update last_heartbeat 0- to trick Jetpack into running the heartbeat on command.wp cron event run jetpack_v2_heartbeat- to run the heartbeat on command.Test the WP CLI command:
wp jetpack-heartbeatand confirm it outputs all the blog details that are sent via heartbeat