Skip to content

Commit 59ce9a5

Browse files
authored
Core: Add logs for circuit breaker opening reason (#179)
1 parent e1cd98e commit 59ce9a5

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/main/java/org/prebid/cache/repository/CircuitBreakerSecuredReactiveRepository.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
44
import io.github.resilience4j.reactor.circuitbreaker.operator.CircuitBreakerOperator;
55
import lombok.RequiredArgsConstructor;
6+
import lombok.extern.slf4j.Slf4j;
67
import reactor.core.publisher.Mono;
78

9+
@Slf4j
810
@RequiredArgsConstructor
911
public class CircuitBreakerSecuredReactiveRepository<T, R> implements ReactiveRepository<T, R> {
1012

@@ -14,12 +16,14 @@ public class CircuitBreakerSecuredReactiveRepository<T, R> implements ReactiveRe
1416
@Override
1517
public Mono<T> save(T wrapper) {
1618
return delegate.save(wrapper)
17-
.transform(CircuitBreakerOperator.of(circuitBreaker));
19+
.doOnError(error -> log.error("Error while accessing data source: {}", error.getMessage(), error))
20+
.transform(CircuitBreakerOperator.of(circuitBreaker));
1821
}
1922

2023
@Override
2124
public Mono<T> findById(R id) {
2225
return delegate.findById(id)
23-
.transform(CircuitBreakerOperator.of(circuitBreaker));
26+
.doOnError(error -> log.error("Error while accessing data source: {}", error.getMessage(), error))
27+
.transform(CircuitBreakerOperator.of(circuitBreaker));
2428
}
2529
}

0 commit comments

Comments
 (0)