DRYD-1193: Sysinfo endpoint healthcheck#529
Conversation
DRYD-1979: added a security vulnerabilities check step in the PR template;
spirosdi
left a comment
There was a problem hiding this comment.
minor notes, so I approve
| private boolean isAnonymousRequest(ContainerRequestContext requestContext) { | ||
| boolean result = false; | ||
|
|
||
| String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()).toLowerCase(); |
There was a problem hiding this comment.
is there a reason for removing the .toLowerCase() call? Requests with non-canonical case will fail differently than before.
There was a problem hiding this comment.
No, this was just a result of rebasing and me not paying attention to that line being modified. It's reverted.
| private String resolveFirstRepositoryName() { | ||
| List<String> all = resolveAllRepositoryNames(); | ||
| return all.isEmpty() ? null : all.get(0); | ||
| } |
| String cspaceInstanceId = null; | ||
| try { | ||
| cspaceInstanceId = ServiceMain.getInstance().getCspaceInstanceId(); | ||
| } catch (Exception e) { | ||
| logger.debug("Could not get instance id", e); | ||
| } |
There was a problem hiding this comment.
This looks redundant. The above getServiceId() call does exactly the same (with different error handling) so it would be better to compute once and reuse.
There was a problem hiding this comment.
I agree, refactored to put getServiceId() into cspaceInstanceId so that it's stored and not called multiple times.
|
Per the developer meeting, the Updated output snapshot: |
What does this do?
Adds a health check endpoint at
/healththat returns JSON describing the health status. Makes a very basic attempt at determining which data sources matter and degrades to a warning state if non-required components fail.Why are we doing this? (with JIRA link)
https://collectionspace.atlassian.net/browse/DRYD-1193
Because hosting needs a way to determine if there's a failure communicating with the database or ElasticSearch.
How should this be tested? Do these changes have associated tests?
Bundled integration tests.
Dependencies for merging? Releasing to production?
No additional dependencies.
Has the application documentation been updated for these changes?
No.
Did someone actually run this code to verify it works?
Yes.