Reputation: 48702
If your Spring Boot application uses MonogDB, Spring Boot will automatically provide a health check endpoint that includes whether MonogDB is "healthy". But what exactly does this check? What does the check showing that MonogDB is "up" mean? What kinds of faults can cause it to be "down".
Upvotes: 1
Views: 4400
Reputation: 48702
The MongoHealthIndicator
does this:
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
Document result = this.mongoTemplate.executeCommand("{ buildInfo: 1 }");
builder.up().withDetail("version", result.getString("version"));
}
That is, it attempts to execute the MonogoDB command buildInfo: 1
. That command "returns a build summary", which is mostly version IDs.
The health check therefore indicates that your application can connection to MonogoDB and execute a simple command in a reasonable time. MonogDB probably incorporates all the information it needs to respond to that command in the executable itself; it does not need to perform a query of the data-store. So the check is unlikely to indicate that the data-accesses can be done OK and will be performant.
Upvotes: 1