Skip to content
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

Add Health Checks #36

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Add Health Checks #36

wants to merge 11 commits into from

Conversation

bradp
Copy link
Contributor

@bradp bradp commented Dec 11, 2024

Proposed changes

Implements a variety of Health Checks to the Site Health page.

Screenshot 2024-12-10 at 1 24 01 PM

Jira tickets: PRESS7-108, PRESS7-109, PRESS7-110, PRESS7-111, PRESS7-118, PRESS7-112, PRESS7-113, PRESS7-121, PRESS7-107, PRESS7-119, PRESS7-120, PRESS7-114, PRESS7-115, PRESS7-116, PRESS7-117.

Type of Change

  • New feature (non-breaking change which adds functionality)

Screenshot

Screenshot 2024-12-10 at 1 23 43 PM

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

This PR adds HealthCheckManager.php which is a helper class to set up and add health checks to the Site Health page. This is used in HealthChecks.php to add the health checks to the Site Health page.

This makes it so adding a new health check is as simple as:

$manager->addHealthCheck( [
  'id'    => 'example-health-check',
  'title' => __( 'Example Health Check', 'newfold-performance-module' ),
  'pass'  => __( 'Example health check passed', 'newfold-performance-module' ),
  'fail'  => __( 'Example health check failed', 'newfold-performance-module' ),
  'text'  => __( 'This is some text to explain the health check to the user.', 'newfold-performance-module' ),
  'test'  => function () {
    // Example test for a constant being defined and having a specific value.
    return ( defined( 'EXAMPLE_CONSTANT' ) && EXAMPLE_CONSTANT === 'example-value' );
  },
] );

This PR also adds Health Checks that are commented out for the following PRs

@bradp bradp added the enhancement New feature or request label Dec 11, 2024
@bradp bradp changed the title Feature/health checks Add Health Checks Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant