use of com.google.api.gax.grpc.GrpcResponseMetadata in project java-bigtable by googleapis.
the class HeaderTracerUnaryCallable method futureCall.
@Override
public ApiFuture futureCall(RequestT request, ApiCallContext context) {
// tracer should always be an instance of BigtableTracer
if (RpcViews.isGfeMetricsRegistered() && context.getTracer() instanceof BigtableTracer) {
final GrpcResponseMetadata responseMetadata = new GrpcResponseMetadata();
final ApiCallContext contextWithResponseMetadata = responseMetadata.addHandlers(context);
HeaderTracerUnaryCallback callback = new HeaderTracerUnaryCallback((BigtableTracer) context.getTracer(), responseMetadata);
ApiFuture<ResponseT> future = innerCallable.futureCall(request, contextWithResponseMetadata);
ApiFutures.addCallback(future, callback, MoreExecutors.directExecutor());
return future;
} else {
return innerCallable.futureCall(request, context);
}
}
use of com.google.api.gax.grpc.GrpcResponseMetadata in project java-bigtable by googleapis.
the class HeaderTracerStreamingCallable method call.
@Override
public void call(RequestT request, ResponseObserver<ResponseT> responseObserver, ApiCallContext context) {
final GrpcResponseMetadata responseMetadata = new GrpcResponseMetadata();
// tracer should always be an instance of bigtable tracer
if (RpcViews.isGfeMetricsRegistered() && context.getTracer() instanceof BigtableTracer) {
HeaderTracerResponseObserver<ResponseT> innerObserver = new HeaderTracerResponseObserver<>(responseObserver, (BigtableTracer) context.getTracer(), responseMetadata);
innerCallable.call(request, innerObserver, responseMetadata.addHandlers(context));
} else {
innerCallable.call(request, responseObserver, context);
}
}
Aggregations