From ff52c13f6c4cc59f63c63c53e3b24cfb3b37c317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Bo=C4=8Dek?= Date: Mon, 20 Mar 2023 14:22:07 +0100 Subject: [PATCH] fix: try harder to decrement CurrentByHostname metric --- .../grpc/GrpcServerMonitoringInterceptor.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/grpc/src/main/java/com/avast/metrics/grpc/GrpcServerMonitoringInterceptor.java b/grpc/src/main/java/com/avast/metrics/grpc/GrpcServerMonitoringInterceptor.java index b8cc922..ca48d8d 100644 --- a/grpc/src/main/java/com/avast/metrics/grpc/GrpcServerMonitoringInterceptor.java +++ b/grpc/src/main/java/com/avast/metrics/grpc/GrpcServerMonitoringInterceptor.java @@ -31,8 +31,14 @@ public ServerCall.Listener interceptCall(final ServerCall newCall = new ForwardingServerCall.SimpleForwardingServerCall(call) { @Override @@ -113,5 +119,10 @@ void release() { currentCalls.decrementAndGet(); } } + + @Override + protected void finalize() { + release(); + } } }