Skip to content

Commit 1c57c76

Browse files
chore: add timeout verifying client interceptor (#60)
1 parent f12cdf4 commit 1c57c76

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.hypertrace.core.grpcutils.client;
2+
3+
import static java.util.Objects.isNull;
4+
5+
import io.grpc.CallOptions;
6+
import io.grpc.Channel;
7+
import io.grpc.ClientCall;
8+
import io.grpc.ClientInterceptor;
9+
import io.grpc.MethodDescriptor;
10+
import lombok.extern.slf4j.Slf4j;
11+
12+
@Slf4j
13+
public class TimeoutVerifyingClientInterceptor implements ClientInterceptor {
14+
15+
@Override
16+
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
17+
MethodDescriptor<ReqT, RespT> methodDescriptor, CallOptions callOptions, Channel channel) {
18+
if (isNull(callOptions.getDeadline())) {
19+
log.warn("Missing deadline for call to method {}", methodDescriptor.getFullMethodName());
20+
}
21+
22+
return channel.newCall(methodDescriptor, callOptions);
23+
}
24+
}

0 commit comments

Comments
 (0)