use of io.pravega.shared.MetricsNames.SEGMENT_WRITE_EVENTS in project pravega by pravega.
the class PravegaRequestProcessor method sealSegment.
@Override
public void sealSegment(SealSegment sealSegment) {
String segment = sealSegment.getSegment();
log.debug("Sealing segment {} ", sealSegment);
if (!verifyToken(segment, sealSegment.getRequestId(), sealSegment.getDelegationToken(), READ_UPDATE, "Seal Segment")) {
return;
}
segmentStore.sealStreamSegment(segment, TIMEOUT).thenAccept(size -> connection.send(new SegmentSealed(sealSegment.getRequestId(), segment))).whenComplete((r, e) -> {
if (e != null) {
handleException(sealSegment.getRequestId(), segment, "Seal segment", e);
} else {
DYNAMIC_LOGGER.freezeCounter(nameFromSegment(SEGMENT_WRITE_BYTES, segment));
DYNAMIC_LOGGER.freezeCounter(nameFromSegment(SEGMENT_WRITE_EVENTS, segment));
if (statsRecorder != null) {
statsRecorder.sealSegment(sealSegment.getSegment());
}
}
});
}
Aggregations