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 a custom solr healthcheck #392

Draft
wants to merge 1 commit into
base: stage
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions calisphere/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.apps import AppConfig
from calisphere.registry_data import RegistryManager
from health_check.plugins import plugin_dir


class CalisphereAppConfig(AppConfig):
Expand All @@ -9,3 +10,6 @@ class CalisphereAppConfig(AppConfig):

def ready(self):
self.registry = RegistryManager()

from .solr_healthcheck import SolrHealthCheckBackend
plugin_dir.register(SolrHealthCheckBackend)
16 changes: 16 additions & 0 deletions calisphere/solr_healthcheck.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from health_check.backends import BaseHealthCheckBackend
from cache_retry import SOLR

class SolrHealthCheckBackend(BaseHealthCheckBackend):
#: The status endpoints will respond with a 200 status code
#: even if the check errors.
critical_service = False

def check_status(self):
try:
resp = SOLR(q="cats")
except:
raise HealthCheckException

def identifier(self):
return self.__class__.__name__ # Display name on the endpoint.