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

Change HealthCheck to a plugin model #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chadjnsn
Copy link

@chadjnsn chadjnsn commented Sep 2, 2015

Within Nike, we've been using Prana for a number of internal systems, but we needed a way to run it alongside applications other than web apps, and as such we needed a way to let Prana determine the health of those applications. To do this, we basically replaced the existing HealthCheck implementation with a plugin-based system that includes a default implementation to ensure it is still backwards compatible.

To do this, we pulled out most of the logic from the HealthCheckHandler and now the handler calls into a HealthCheckService. That service uses a ServiceLoader to look through a specific directory (configured via an archaius property) for .jar files that contain an implementation of a new HealthCheck interface. It then bootstraps those implementations and attempts to use them to determine the health of whatever app Prana is paired with. If there are no external implementations found, then the service defaults to using a DefaultHealthCheck which is the same one that Prana used before. This logic is only run the first time the HealthCheck endpoint is hit, and because of the default implementation, it should be completely backwards compatible.

Within Nike we've been using this implementation, and thought it might be a good candidate for Prana. If this is something you guys are interested in, I can also provide you with some documentation that explains pretty clearly how to make a new healthcheck implementation and use it.

@chadjnsn chadjnsn changed the title Add Nike prana health check plugin impl. Change HealthCheck to a plugin model Sep 3, 2015
@chadjnsn
Copy link
Author

Something like this could probably address that 'Add support for command based Health Check handlers' entry on the roadmap (you just make a simple class that handles the logic, compile it into a jar, and drop it in a directory). It's also basically using the same approach suggested in Issue #4 (albeit for healthchecks, instead of request handlers) except it just uses the Service Loader directly instead of going through Governator (although it wouldn't take much to convert it to use governator instead).

@aspyker
Copy link
Contributor

aspyker commented Oct 24, 2015

@chadjnsn Thank you for the contribution. More will be coming, but please see http://ispyker.blogspot.com/2015/10/towards-being-better-about-open-source.html for a bit of context on the status of this project.

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