Report usages old child breakers when breaking on real memory (#44221)
This will help in investigations where the real memory circuit breaker is tripped to better understand on what the actual memory is used, i.e. whether it's a temporary thing (e.g. requests) in contrast to more permanently allocated memory (e.g. accounting).
This commit is contained in:
parent
40cc081ad3
commit
ae8f625d73
|
@ -325,7 +325,7 @@ public class HierarchyCircuitBreakerService extends CircuitBreakerService {
|
||||||
message.append("/");
|
message.append("/");
|
||||||
message.append(new ByteSizeValue(newBytesReserved));
|
message.append(new ByteSizeValue(newBytesReserved));
|
||||||
message.append("]");
|
message.append("]");
|
||||||
} else {
|
}
|
||||||
message.append(", usages [");
|
message.append(", usages [");
|
||||||
message.append(String.join(", ",
|
message.append(String.join(", ",
|
||||||
this.breakers.entrySet().stream().map(e -> {
|
this.breakers.entrySet().stream().map(e -> {
|
||||||
|
@ -335,7 +335,6 @@ public class HierarchyCircuitBreakerService extends CircuitBreakerService {
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList())));
|
.collect(Collectors.toList())));
|
||||||
message.append("]");
|
message.append("]");
|
||||||
}
|
|
||||||
// derive durability of a tripped parent breaker depending on whether the majority of memory tracked by
|
// derive durability of a tripped parent breaker depending on whether the majority of memory tracked by
|
||||||
// child circuit breakers is categorized as transient or permanent.
|
// child circuit breakers is categorized as transient or permanent.
|
||||||
CircuitBreaker.Durability durability = memoryUsed.transientChildUsage >= memoryUsed.permanentChildUsage ?
|
CircuitBreaker.Durability durability = memoryUsed.transientChildUsage >= memoryUsed.permanentChildUsage ?
|
||||||
|
|
|
@ -246,6 +246,10 @@ public class HierarchyCircuitBreakerServiceTests extends ESTestCase {
|
||||||
assertThat(exception.getMessage(),
|
assertThat(exception.getMessage(),
|
||||||
containsString("real usage: [181/181b], new bytes reserved: [" + (reservationInBytes * 2) +
|
containsString("real usage: [181/181b], new bytes reserved: [" + (reservationInBytes * 2) +
|
||||||
"/" + new ByteSizeValue(reservationInBytes * 2) + "]"));
|
"/" + new ByteSizeValue(reservationInBytes * 2) + "]"));
|
||||||
|
final long requestCircuitBreakerUsed = (requestBreaker.getUsed() + reservationInBytes) * 2;
|
||||||
|
assertThat(exception.getMessage(),
|
||||||
|
containsString("usages [request=" + requestCircuitBreakerUsed + "/" + new ByteSizeValue(requestCircuitBreakerUsed) +
|
||||||
|
", fielddata=0/0b, in_flight_requests=0/0b, accounting=0/0b]"));
|
||||||
assertThat(exception.getDurability(), equalTo(CircuitBreaker.Durability.TRANSIENT));
|
assertThat(exception.getDurability(), equalTo(CircuitBreaker.Durability.TRANSIENT));
|
||||||
assertEquals(0, requestBreaker.getTrippedCount());
|
assertEquals(0, requestBreaker.getTrippedCount());
|
||||||
assertEquals(1, service.stats().getStats(CircuitBreaker.PARENT).getTrippedCount());
|
assertEquals(1, service.stats().getStats(CircuitBreaker.PARENT).getTrippedCount());
|
||||||
|
|
Loading…
Reference in New Issue