use of com.google.cloud.bigtable.data.v2.stub.metrics.StatsHeadersServerStreamingCallable in project java-bigtable by googleapis.
the class EnhancedBigtableStub method createMutateRowsBaseCallable.
/**
* Internal helper to create the base MutateRows callable chain. The chain is responsible for
* retrying individual entry in case of error.
*
* <p>NOTE: the caller is responsible for adding tracing & metrics.
*
* @see MutateRowsRetryingCallable for more details
*/
private UnaryCallable<MutateRowsRequest, Void> createMutateRowsBaseCallable() {
ServerStreamingCallable<MutateRowsRequest, MutateRowsResponse> base = GrpcRawCallableFactory.createServerStreamingCallable(GrpcCallSettings.<MutateRowsRequest, MutateRowsResponse>newBuilder().setMethodDescriptor(BigtableGrpc.getMutateRowsMethod()).setParamsExtractor(new RequestParamsExtractor<MutateRowsRequest>() {
@Override
public Map<String, String> extract(MutateRowsRequest mutateRowsRequest) {
return ImmutableMap.of("table_name", mutateRowsRequest.getTableName(), "app_profile_id", mutateRowsRequest.getAppProfileId());
}
}).build(), settings.bulkMutateRowsSettings().getRetryableCodes());
ServerStreamingCallable<MutateRowsRequest, MutateRowsResponse> withStatsHeaders = new StatsHeadersServerStreamingCallable<>(base);
RetryAlgorithm<Void> retryAlgorithm = new RetryAlgorithm<>(new ApiResultRetryAlgorithm<Void>(), new ExponentialRetryAlgorithm(settings.bulkMutateRowsSettings().getRetrySettings(), clientContext.getClock()));
RetryingExecutorWithContext<Void> retryingExecutor = new ScheduledRetryingExecutor<>(retryAlgorithm, clientContext.getExecutor());
return new MutateRowsRetryingCallable(clientContext.getDefaultCallContext(), withStatsHeaders, retryingExecutor, settings.bulkMutateRowsSettings().getRetryableCodes());
}
Aggregations