Skip to content

Conversation

@ylcn91
Copy link
Contributor

@ylcn91 ylcn91 commented Nov 8, 2023

The commit introduces the Health Check pattern, providing a series of health indicators for system performance and stability monitoring, including checks for system CPU load, process CPU load, database health, memory usage, and garbage collection metrics. It also includes asynchronous execution and caching mechanisms for health checks, and retry configurations for resilience.

Implements health-checking components as per issue #2695.

This pull request introduces the Health Check pattern, an essential feature for the observability of microservices. The implementation allows services within a system to regularly check their health status and report it back for monitoring purposes. The health indicators cover various aspects such as system CPU load, process CPU load, database connectivity, memory usage, and garbage collection status. These indicators are crucial for proactive system maintenance and resilience in a microservice architecture.

Changes included in this pull request:

  • AsynchronousHealthChecker: Asynchronously performs health checks to prevent blocking the system's operations.
  • CpuHealthIndicator: Monitors the CPU health of the system and the service process.
  • CustomHealthIndicator: Periodically checks and caches the health of a database.
  • DatabaseTransactionHealthIndicator: Verifies database transaction capabilities using a retry mechanism.
  • GarbageCollectionHealthIndicator: Checks and reports on garbage collection status and memory pool usage.
  • MemoryHealthIndicator: Monitors the memory usage of the application.
  • HealthCheck: Entity class representing health check records.
  • HealthCheckRepository: Repository class to manage health check records and perform database health queries.
  • RetryConfig: Configuration for retry policies to enhance robustness during transient failures.

This implementation addresses the issue reported in #2695 and follows the guidelines provided in the How to Contribute section of the repository's wiki.

Additional notes:

  • Unit tests have been added to ensure the reliability of health indicators.
  • Documentation is updated to reflect the new pattern's inclusion and usage.
  • The class diagram and usage examples have been added to the /etc folder for a visual understanding of the pattern.

The commit introduces  Health Check pattern, providing a series of health indicators for system performance and stability monitoring, including checks for system CPU load, process CPU load, database health, memory usage, and garbage collection metrics. It also includes asynchronous execution and caching mechanisms for health checks, and retry configurations for resilience.

Implements health checking components as per issue #2695.
ADDED HIGH_PROCESS_CPU_LOAD_MESSAGE_WITHOUT_PARAM
ADDED HIGH_SYSTEM_CPU_LOAD_MESSAGE_WITHOUT_PARAM
…f using a generic one."

added HealthCheckInterruptedException
refactored CustomHealthIndicator
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

82.4% 82.4% Coverage
0.0% 0.0% Duplication

Copy link
Owner

@iluwatar iluwatar left a comment

Choose a reason for hiding this comment

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

The code looks great! The only thing worth mentioning is the explanation section of the README.md. We need to make it more verbose and structure according https://github.com/iluwatar/java-design-patterns/wiki/02.-Pattern-template, but let's do that in a follow-up issue

@iluwatar iluwatar merged commit 21f7b02 into iluwatar:master Dec 2, 2023
@iluwatar
Copy link
Owner

iluwatar commented Dec 2, 2023

@all-contributors please add @ylcn91 for code

@allcontributors
Copy link
Contributor

@iluwatar

I've put up a pull request to add @ylcn91! 🎉

@iluwatar
Copy link
Owner

iluwatar commented Dec 2, 2023

Here is the follow-up issue: #2782

@ylcn91
Copy link
Contributor Author

ylcn91 commented Dec 2, 2023

Thank you !

@ylcn91 ylcn91 deleted the feature/health-check-api-pattern branch December 3, 2023 07:36
@ylcn91
Copy link
Contributor Author

ylcn91 commented Dec 4, 2023

Added for readme file -> #2783

@iluwatar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants