Skip to content

Commit

Permalink
run health checks on setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ekneg54 committed Sep 11, 2024
1 parent 4866f16 commit d8ca096
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
### Breaking
### Features

* adds readiness check to metrics
* adds health check endpoint to metrics on path `/health`
* changes helm chart to use new readiness check
* adds `healthcheck_timeout` option to all components to tweak the timeout of healthchecks
* adds `desired_cluster_status` option to opensearch output to signal healthy cluster status
* initially run health checks on setup for every configured component


### Improvements
Expand Down
6 changes: 3 additions & 3 deletions logprep/abc/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def describe(self) -> str:
def setup(self):
"""Set the component up."""
self._populate_cached_properties()
# while not self.health():
# logger.info("Waiting for %s to be healthy", self.name)
# time.sleep(1)
while not self.health():
logger.info("Waiting for %s to be healthy", self.name)
time.sleep(5)

def _populate_cached_properties(self):
_ = [
Expand Down
2 changes: 1 addition & 1 deletion logprep/connector/http/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ def setup(self):
only runs a single time for multiple processes.
"""

super().setup()
if not hasattr(self, "pipeline_index"):
raise FatalInputError(
self, "Necessary instance attribute `pipeline_index` could not be found."
Expand Down Expand Up @@ -469,6 +468,7 @@ def setup(self):
self._config.uvicorn_config, app, daemon=False, logger_name="HTTPServer"
)
self.http_server.start()
super().setup()

@staticmethod
def _get_asgi_app(endpoints_config: dict) -> falcon.asgi.App:
Expand Down

0 comments on commit d8ca096

Please sign in to comment.