Skip to content

DRYD-1193: Sysinfo endpoint healthcheck#529

Merged
mglyrasis merged 5 commits intodevelopfrom
feat/health-check-endpoint
Apr 30, 2026
Merged

DRYD-1193: Sysinfo endpoint healthcheck#529
mglyrasis merged 5 commits intodevelopfrom
feat/health-check-endpoint

Conversation

@mglyrasis
Copy link
Copy Markdown

What does this do?
Adds a health check endpoint at /health that 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.

{
  "checks":{
    "database:cspace":{
      "componentType":"datastore",
      "status":"pass",
      "observedValue":"PostgreSQL 17.5 (Debian 17.5-1.pgdg120+1)"
    },
    "database:csadmin":{
      "componentType":"datastore",
      "status":"pass",
      "observedValue":"PostgreSQL 17.5 (Debian 17.5-1.pgdg120+1)"
    },
    "database:nuxeo:default":{
      "componentType":"datastore",
      "status":"pass",
      "observedValue":"PostgreSQL 17.5 (Debian 17.5-1.pgdg120+1)"
    },
    "nuxeo:repository":{
      "componentType":"component",
      "status":"pass",
      "observedValue":"default"
    },
    "database:nuxeo_reader:default":{
      "componentType":"datastore",
      "status":"pass",
      "observedValue":"PostgreSQL 17.5 (Debian 17.5-1.pgdg120+1)"
    },
    "database:csadmin_nuxeo:default":{
      "componentType":"datastore",
      "status":"pass",
      "observedValue":"PostgreSQL 17.5 (Debian 17.5-1.pgdg120+1)"
    },
    "elasticsearch":{
      "status":"disabled"
    }
  },
  "description":"CollectionSpace Services",
  "version":"8.3.0-RC.2",
  "releaseId":"99cd743",
  "serviceId":"_collectionspace",
  "status":"pass"
}

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.

spirosdi and others added 2 commits April 24, 2026 13:29
Copy link
Copy Markdown
Contributor

@spirosdi spirosdi left a comment

Choose a reason for hiding this comment

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

minor notes, so I approve

private boolean isAnonymousRequest(ContainerRequestContext requestContext) {
boolean result = false;

String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()).toLowerCase();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a reason for removing the .toLowerCase() call? Requests with non-canonical case will fail differently than before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No, this was just a result of rebasing and me not paying attention to that line being modified. It's reverted.

Comment on lines +206 to +209
private String resolveFirstRepositoryName() {
List<String> all = resolveAllRepositoryNames();
return all.isEmpty() ? null : all.get(0);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is never called.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed in latest commits.

Comment on lines +64 to +69
String cspaceInstanceId = null;
try {
cspaceInstanceId = ServiceMain.getInstance().getCspaceInstanceId();
} catch (Exception e) {
logger.debug("Could not get instance id", e);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree, refactored to put getServiceId() into cspaceInstanceId so that it's stored and not called multiple times.

@mglyrasis
Copy link
Copy Markdown
Author

mglyrasis commented Apr 28, 2026

Per the developer meeting, the observedValue key is now hidden behind a flag and not included in health check responses by default.

Updated output snapshot:

{
  "checks":{
    "database:cspace":{
      "componentType":"datastore",
      "status":"pass"
    },
    "database:csadmin":{
      "componentType":"datastore",
      "status":"pass"
    },
    "database:nuxeo:default":{
      "componentType":"datastore",
      "status":"pass"
    },
    "nuxeo:repository":{
      "componentType":"component",
      "status":"pass"
    },
    "database:nuxeo_reader:default":{
      "componentType":"datastore",
      "status":"pass"
    },
    "database:csadmin_nuxeo:default":{
      "componentType":"datastore",
      "status":"pass"
    },
    "elasticsearch":{
      "status":"disabled"
    }
  },
  "description":"CollectionSpace Services",
  "version":"9.0.0-SNAPSHOT",
  "releaseId":"864d61c",
  "serviceId":"_collectionspace",
  "status":"pass"
}

@mglyrasis mglyrasis merged commit 98a9650 into develop Apr 30, 2026
3 checks passed
@mglyrasis mglyrasis deleted the feat/health-check-endpoint branch April 30, 2026 20:35
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