-
Notifications
You must be signed in to change notification settings - Fork 293
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
Implement Periodic Server Requirements Health Checks Using WP-Cron Job #9768
Comments
AC ✅ |
Nice work on the IB, thank you @benbowler!
I believe you meant IB ✅ |
Hi @benbowler, @nfmohit, regarding this point:
We should keep the
An implementation detail, but it's worth noting that these checks can be extracted into a reusable method. cc: @techanvil |
Thank you @hussain-t ! In that case, I'll remove the part about changing CC: @ankitrox since you're working on this in Execution. |
QA Update ⚠Hi @ankitrox , few observations/queries: ITEM 1:
That said, I got it as null, true, true as per the screenshot attached below. ITEM 2: For the part of the QAB where we are to update the |
@kelvinballoo Thanks for checking this.
Actually, this behaviour is expected because when we setup the fresh site, there is no cron job scheduled. Thus a job is scheduled and run instantly which changes these flags in settings.
This is a simple change in Please let me know if you have any further queries. Thank you. |
QA update ⚠Thanks @ankitrox , noted on this. I was able to verify the fpm measurement file in instawp after you gave the address. One item to verify: Other than that, the following were verified good, executed as per QAB:
|
QA update ✅Confirmed with @ankitrox that the highlighted error is only because of Advanced cron manager, nothing related to Site Kit. As such, I will proceed with to Approval. The following were verified good, executed as per QAB:
|
Feature Description
Introduce periodic server requirement health checks for First-party mode to ensure it remains functional and responsive to any changes in server configurations. This will proactively detect and handle any issues that might impact the feature’s functionality.
The health checks will validate server configurations and update the First-party mode settings accordingly. If the checks fail, the feature will automatically revert to the default setup.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
/healthy
endpoint (e.g., https://G-1234.fps.goog/mpath/healthy).fpm/measurement.php
) via an HTTP request with thehealthCheck
query parameter.googlesitekit_first_party_mode
settings based on the health check results:isFPMHealthy
orisScriptAccessEnabled
tofalse
in the settings.isFPMHealthy
andisScriptAccessEnabled
are set totrue
.Implementation Brief
Create a new file
includes/Core/Tags/First_Party_Mode/First_Party_Mode_Cron.php
modelled onincludes/Core/Remote_Features/Remote_Features_Cron.php
:CRON_ACTION
const should begooglesitekit_cron_first_party_mode_healthchecks
.time() + HOUR_IN_SECONDS
.Update
includes/Core/Tags/First_Party_Mode/First_Party_Mode.php
:healthcheck
which:fpm-server-requirement-status
REST endpoint:site-kit-wp/includes/Core/Tags/First_Party_Mode/REST_First_Party_Mode_Controller.php
Lines 137 to 139 in 0f39b60
$this->first_party_mode_settings->merge
.First_Party_Mode_Cron
called$cron
.__construct
, set$this->cron
to a new instance ofFirst_Party_Mode_Cron
passingarray( $this, 'healthcheck' )
.on_admin_init
modelled onRemote_Features_Provider
.register
, adding an action to call$this->on_admin_init()
onadmin_init
.Update
includes/Core/Util/Uninstallation.php
to clear theFirst_Party_Mode_Cron::CRON_ACTION
.Test Coverage
First_Party_Mode_Cron
class.QA Brief
Install Advanced Cron Manager plugin and activate.
Activate Site Kit and make sure that either Analytics or the Ads module is active and connected. Run the following command.
the output would be (considering that the test site is a fresh install) like:
Visit the Site Kit dashboard. Now, go to
Tools > Cron Manager
. In the list of cron jobs,googlesitekit_cron_first_party_mode_healthchecks
should be available.Click
Execute now
for the job and let it complete, there would be a messageEvent "googlesitekit_cron_first_party_mode_healthchecks" has been executed
once the job is completed.Refresh the Site Kit dashboard and run following command.
the output should be like
Run,
the output should now be
fpm/measurement.php
file. The following code should be update fromto
save the file on server.
Refresh the Site Kit dashboard, run the cron again manually from Advanced cron manager screen as stated previously.
Refresh the Site Kit dashboard and run following command.
the output should be like
Changelog entry
The text was updated successfully, but these errors were encountered: