Skip to content

Add Jetpack Monitor uptime in get site endpoint response #43999

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

Closed
wants to merge 4 commits into from

Conversation

taipeicoder
Copy link
Contributor

Ref DOTDASH-55.

Proposed changes:

This PR introduces the uptime field to the GET site endpoint. This field will be used to populate Jetpack Monitor uptime data for WP.com site/sites endpoints.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

This PR does not introduce any behavioral changes.

@taipeicoder taipeicoder self-assigned this Jun 18, 2025
Copy link
Contributor

github-actions bot commented Jun 18, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/site-endpoint-uptime-field branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/site-endpoint-uptime-field

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] WPCOM API [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jun 18, 2025
Copy link
Contributor

github-actions bot commented Jun 18, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: July 1, 2025
    • Code freeze: June 30, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 18, 2025
@taipeicoder taipeicoder added [Type] Task [Status] Needs Review This PR is ready for review. labels Jun 18, 2025
Copy link

jp-launch-control bot commented Jun 18, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/sal/class.json-api-site-base.php 11/307 (3.58%) -0.01% 1 ❤️‍🩹
projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php 468/619 (75.61%) 0.12% 0 💚

Full summary · PHP report · JS report

@taipeicoder taipeicoder requested a review from a team June 18, 2025 09:43
Copy link
Contributor

@fushar fushar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested:

https://public-api.wordpress.com/rest/v1.2/me/sites -- returns the new field
https://public-api.wordpress.com/rest/v1.1/sites/:idOrSlug does not return the new field. Is this expected? Or I guess it's OK since we don't need this at single-site level as we already have another endpoint for it?

How I test:

  • sandboxed public-api
  • checked out the branch 185812-ghe-Automattic/wpcom on wpcom
  • applied jetpack-downloader of this PR on wpcom
  • and used Jetpack Beta Tester of this PR on the site.

@@ -82,6 +82,7 @@ class WPCOM_JSON_API_GET_Site_V1_2_Endpoint extends WPCOM_JSON_API_GET_Site_Endp
'is_deleted' => '(bool) If the site flagged as deleted.',
'is_a4a_client' => '(bool) If the site is an A4A client site.',
'is_a4a_dev_site' => '(bool) If the site is an A4A dev site.',
'uptime' => '(array) An array keyed by unit of time that contains the site uptime for each day.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: Is it really needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking closer, it inherits from the base class so it's not needed.

@@ -240,6 +241,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint {
'was_hosting_trial',
'was_upgraded_from_trial',
'is_a4a_dev_site',
'uptime',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed so that when the a request is made on WoA sites, the endpoint redecorates the response with these WPCOM values.

@taipeicoder
Copy link
Contributor Author

Closing as we're not pursuing this approach for now.

@github-actions github-actions bot removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] Needs Review This PR is ready for review. labels Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WPCOM API [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Type] Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants