use of io.pravega.shared.controller.tracing.RPCTracingTags.GET_READER_GROUP_CONFIG in project pravega by pravega.
the class ControllerImpl method getReaderGroupConfig.
@Override
public CompletableFuture<ReaderGroupConfig> getReaderGroupConfig(final String scope, final String rgName) {
Exceptions.checkNotClosed(closed.get(), this);
Exceptions.checkNotNullOrEmpty(scope, "scope");
final String emptyUUID = "";
final long requestId = requestIdGenerator.get();
long traceId = LoggerHelpers.traceEnter(log, "getReaderGroupConfig", scope, rgName, requestId);
final String scopedRGName = NameUtils.getScopedReaderGroupName(scope, rgName);
final CompletableFuture<ReaderGroupConfigResponse> result = this.retryConfig.runAsync(() -> {
RPCAsyncCallback<ReaderGroupConfigResponse> callback = new RPCAsyncCallback<>(requestId, "getReaderGroupConfig", scope, rgName);
new ControllerClientTagger(client, timeoutMillis).withTag(requestId, GET_READER_GROUP_CONFIG, scope, rgName).getReaderGroupConfig(ModelHelper.createReaderGroupInfo(scope, rgName, emptyUUID, 0L), callback);
return callback.getFuture();
}, this.executor);
return result.thenApplyAsync(x -> {
switch(x.getStatus()) {
case FAILURE:
log.warn(requestId, "Failed to get config for reader group: {}", scopedRGName);
throw new ControllerFailureException("Failed to get config for reader group: " + scopedRGName);
case RG_NOT_FOUND:
log.warn(requestId, "ReaderGroup not found: {}", scopedRGName);
throw new ReaderGroupNotFoundException(scopedRGName);
case SUCCESS:
log.info(requestId, "Successfully got config for Reader Group: {}", scopedRGName);
return encode(x.getConfig());
case UNRECOGNIZED:
default:
throw new ControllerFailureException("Unknown return status getting config for ReaderGroup " + scopedRGName + " " + x.getStatus());
}
}, this.executor).whenComplete((x, e) -> {
if (e != null) {
log.warn(requestId, "getReaderGroupConfig failed for Reader Group: {}", scopedRGName, e);
}
LoggerHelpers.traceLeave(log, "getReaderGroupConfig", traceId, scope, rgName, requestId);
});
}
Aggregations