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