use of io.pravega.common.tracing.RequestTag in project pravega by pravega.
the class ControllerServiceImpl method updateStream.
@Override
public void updateStream(StreamConfig request, StreamObserver<UpdateStreamStatus> responseObserver) {
String scope = request.getStreamInfo().getScope();
String stream = request.getStreamInfo().getStream();
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), UPDATE_STREAM, scope, stream);
log.info(requestTag.getRequestId(), "updateStream called for stream {}/{}.", scope, stream);
Supplier<String> authorizationSupplier = () -> this.grpcAuthHelper.checkAuthorization(StreamAuthParams.toResourceString(scope, stream), AuthHandler.Permissions.READ_UPDATE);
authenticateExecuteAndProcessResults(authorizationSupplier, authorizationResult -> controllerService.updateStream(scope, stream, ModelHelper.encode(request), requestTag.getRequestId()), responseObserver, requestTag);
}
use of io.pravega.common.tracing.RequestTag in project pravega by pravega.
the class ControllerServiceImpl method createStream.
@Override
public void createStream(StreamConfig request, StreamObserver<CreateStreamStatus> responseObserver) {
String scope = request.getStreamInfo().getScope();
String stream = request.getStreamInfo().getStream();
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), CREATE_STREAM, scope, stream);
log.info(requestTag.getRequestId(), "createStream called for stream {}/{}.", scope, stream);
StreamAuthParams streamAuthParams = new StreamAuthParams(scope, stream, this.isRGStreamWritesWithReadPermEnabled);
AuthHandler.Permissions requiredPermission = streamAuthParams.requiredPermissionForWrites();
log.debug(requestTag.getRequestId(), "Creating stream : requiredPermission is [{}], for scope [{}] and stream [{}]", requiredPermission, scope, stream);
authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorizationAndCreateToken(authorizationResource.ofStreamsInScope(scope), requiredPermission), delegationToken -> controllerService.createStream(scope, stream, ModelHelper.encode(request), System.currentTimeMillis(), requestTag.getRequestId()), responseObserver, requestTag);
}
use of io.pravega.common.tracing.RequestTag in project pravega by pravega.
the class ControllerServiceImpl method getURI.
@Override
public void getURI(SegmentId request, StreamObserver<NodeUri> responseObserver) {
String segment = NameUtils.getQualifiedStreamSegmentName(request.getStreamInfo().getScope(), request.getStreamInfo().getStream(), request.getSegmentId());
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), GET_URI, segment);
log.info(requestTag.getRequestId(), "getURI called for segment {}.", segment);
authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorization(StreamAuthParams.toResourceString(request.getStreamInfo().getScope(), request.getStreamInfo().getStream()), AuthHandler.Permissions.READ), delegationToken -> controllerService.getURI(request), responseObserver);
}
use of io.pravega.common.tracing.RequestTag in project pravega by pravega.
the class ControllerServiceImpl method getCurrentSegmentsKeyValueTable.
@Override
public void getCurrentSegmentsKeyValueTable(KeyValueTableInfo request, StreamObserver<SegmentRanges> responseObserver) {
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE, request.getScope(), request.getKvtName());
log.info(requestTag.getRequestId(), "getCurrentSegmentsKeyValueTable called for kvtable {}/{}.", request.getScope(), request.getKvtName());
authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorizationAndCreateToken(authorizationResource.ofKeyValueTableInScope(request.getScope(), request.getKvtName()), AuthHandler.Permissions.READ_UPDATE), delegationToken -> {
logIfEmpty(delegationToken, "getCurrentSegmentsKeyValueTable", request.getScope(), request.getKvtName());
return controllerService.getCurrentSegmentsKeyValueTable(request.getScope(), request.getKvtName(), requestTag.getRequestId()).thenApply(segmentRanges -> SegmentRanges.newBuilder().addAllSegmentRanges(segmentRanges).setDelegationToken(delegationToken).build());
}, responseObserver);
}
use of io.pravega.common.tracing.RequestTag in project pravega by pravega.
the class ControllerServiceImpl method noteTimestampFromWriter.
// region watermarking apis
@Override
public void noteTimestampFromWriter(Controller.TimestampFromWriter request, StreamObserver<Controller.TimestampResponse> responseObserver) {
StreamInfo streamInfo = request.getPosition().getStreamInfo();
RequestTag requestTag = requestTracker.initializeAndTrackRequestTag(controllerService.nextRequestId(), NOTE_TIMESTAMP_FROM_WRITER, streamInfo.getScope(), streamInfo.getStream(), request.getWriter());
log.info(requestTag.getRequestId(), "noteWriterMark called for stream {}/{}, writer={} time={}", streamInfo.getScope(), streamInfo.getStream(), request.getWriter(), request.getTimestamp());
authenticateExecuteAndProcessResults(() -> this.grpcAuthHelper.checkAuthorization(authorizationResource.ofStreamInScope(streamInfo.getScope(), streamInfo.getStream()), AuthHandler.Permissions.READ_UPDATE), delegationToken -> controllerService.noteTimestampFromWriter(streamInfo.getScope(), streamInfo.getStream(), request.getWriter(), request.getTimestamp(), request.getPosition().getCutMap(), requestTag.getRequestId()), responseObserver, requestTag);
}
Aggregations