chore: Log timeout error information (#23071)

Hopefully, this should give us information on what's the cause for the
timeout errors.

---------

Co-authored-by: Sumesh Pradhan <sumesh@appsmith.com>
This commit is contained in:
Shrikant Sharat Kandula 2023-05-17 10:19:52 +05:30 committed by GitHub
parent 99466e197d
commit 72bee7b26e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,16 +35,20 @@ public class HealthCheckServiceCEImpl implements HealthCheckServiceCE {
@Override
public Mono<Health> getRedisHealth() {
Function<TimeoutException, Throwable> healthTimeout = error -> new AppsmithException(
AppsmithError.HEALTHCHECK_TIMEOUT, "Redis");
Function<TimeoutException, Throwable> healthTimeout = error -> {
log.warn("Redis health check timed out: ", error.getMessage());
return new AppsmithException(AppsmithError.HEALTHCHECK_TIMEOUT, "Redis");
};
RedisReactiveHealthIndicator redisReactiveHealthIndicator = new RedisReactiveHealthIndicator(reactiveRedisConnectionFactory);
return redisReactiveHealthIndicator.health().timeout(Duration.ofSeconds(3)).onErrorMap(TimeoutException.class, healthTimeout);
}
@Override
public Mono<Health> getMongoHealth() {
Function<TimeoutException, Throwable> healthTimeout = error -> new AppsmithException(
AppsmithError.HEALTHCHECK_TIMEOUT, "Mongo");
Function<TimeoutException, Throwable> healthTimeout = error -> {
log.warn("MongoDB health check timed out: ", error.getMessage());
return new AppsmithException(AppsmithError.HEALTHCHECK_TIMEOUT, "Mongo");
};
MongoReactiveHealthIndicator mongoReactiveHealthIndicator = new MongoReactiveHealthIndicator(reactiveMongoTemplate);
return mongoReactiveHealthIndicator.health().timeout(Duration.ofSeconds(1)).onErrorMap(TimeoutException.class, healthTimeout);
}