Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add timeout verifying client interceptor #60

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.hypertrace.core.grpcutils.client;

import static java.util.Objects.isNull;

import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
import io.grpc.MethodDescriptor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TimeoutVerifyingClientInterceptor implements ClientInterceptor {

Check warning on line 13 in grpc-client-utils/src/main/java/org/hypertrace/core/grpcutils/client/TimeoutVerifyingClientInterceptor.java

View check run for this annotation

Codecov / codecov/patch

grpc-client-utils/src/main/java/org/hypertrace/core/grpcutils/client/TimeoutVerifyingClientInterceptor.java#L12-L13

Added lines #L12 - L13 were not covered by tests

@Override
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
MethodDescriptor<ReqT, RespT> methodDescriptor, CallOptions callOptions, Channel channel) {
if (isNull(callOptions.getDeadline())) {
log.warn("Missing deadline for call to method {}", methodDescriptor.getFullMethodName());

Check warning on line 19 in grpc-client-utils/src/main/java/org/hypertrace/core/grpcutils/client/TimeoutVerifyingClientInterceptor.java

View check run for this annotation

Codecov / codecov/patch

grpc-client-utils/src/main/java/org/hypertrace/core/grpcutils/client/TimeoutVerifyingClientInterceptor.java#L19

Added line #L19 was not covered by tests
}

return channel.newCall(methodDescriptor, callOptions);

Check warning on line 22 in grpc-client-utils/src/main/java/org/hypertrace/core/grpcutils/client/TimeoutVerifyingClientInterceptor.java

View check run for this annotation

Codecov / codecov/patch

grpc-client-utils/src/main/java/org/hypertrace/core/grpcutils/client/TimeoutVerifyingClientInterceptor.java#L22

Added line #L22 was not covered by tests
}
}
Loading