[CORE] Log if CircuitBreaker is tripping

Today we only throw an exception which might not be logged at all. This
commit adds debug logging if we are tripping a CB.

Closes #8050
This commit is contained in:
Simon Willnauer 2014-10-10 11:54:55 +02:00
parent 491a48e55b
commit 1792822bae
2 changed files with 8 additions and 4 deletions

View File

@ -90,9 +90,11 @@ public class ChildMemoryCircuitBreaker implements CircuitBreaker {
@Override
public void circuitBreak(String fieldName, long bytesNeeded) {
this.trippedCount.incrementAndGet();
throw new CircuitBreakingException("[" + this.name + "] Data too large, data for [" +
final String message = "[" + this.name + "] Data too large, data for [" +
fieldName + "] would be larger than limit of [" +
memoryBytesLimit + "/" + new ByteSizeValue(memoryBytesLimit) + "]",
memoryBytesLimit + "/" + new ByteSizeValue(memoryBytesLimit) + "]";
logger.debug(message);
throw new CircuitBreakingException(message,
bytesNeeded, this.memoryBytesLimit);
}

View File

@ -79,8 +79,10 @@ public class MemoryCircuitBreaker implements CircuitBreaker {
*/
public void circuitBreak(String fieldName, long bytesNeeded) throws CircuitBreakingException {
this.trippedCount.incrementAndGet();
throw new CircuitBreakingException("Data too large, data for field [" + fieldName + "] would be larger than limit of [" +
memoryBytesLimit + "/" + new ByteSizeValue(memoryBytesLimit) + "]");
final String message = "Data too large, data for field [" + fieldName + "] would be larger than limit of [" +
memoryBytesLimit + "/" + new ByteSizeValue(memoryBytesLimit) + "]";
logger.debug(message);
throw new CircuitBreakingException(message);
}
/**