use of org.apache.nifi.web.api.dto.status.ControllerStatusDTO in project nifi by apache.
the class FlowResource method getControllerStatus.
/**
* Retrieves the status for this NiFi.
*
* @return A controllerStatusEntity.
* @throws InterruptedException if interrupted
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("status")
@ApiOperation(value = "Gets the current status of this NiFi", response = ControllerStatusEntity.class, authorizations = { @Authorization(value = "Read - /flow") })
@ApiResponses(value = { @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(code = 401, message = "Client could not be authenticated."), @ApiResponse(code = 403, message = "Client is not authorized to make this request."), @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") })
public Response getControllerStatus() throws InterruptedException {
authorizeFlow();
if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}
final ControllerStatusDTO controllerStatus = serviceFacade.getControllerStatus();
// create the response entity
final ControllerStatusEntity entity = new ControllerStatusEntity();
entity.setControllerStatus(controllerStatus);
// generate the response
return generateOkResponse(entity).build();
}
use of org.apache.nifi.web.api.dto.status.ControllerStatusDTO in project nifi by apache.
the class ControllerFacade method getControllerStatus.
/**
* Gets the status of this controller.
*
* @return the status of this controller
*/
public ControllerStatusDTO getControllerStatus() {
final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
final QueueSize controllerQueueSize = flowController.getTotalFlowFileCount(rootGroup);
final ControllerStatusDTO controllerStatus = new ControllerStatusDTO();
controllerStatus.setActiveThreadCount(flowController.getActiveThreadCount());
controllerStatus.setQueued(FormatUtils.formatCount(controllerQueueSize.getObjectCount()) + " / " + FormatUtils.formatDataSize(controllerQueueSize.getByteCount()));
controllerStatus.setBytesQueued(controllerQueueSize.getByteCount());
controllerStatus.setFlowFilesQueued(controllerQueueSize.getObjectCount());
final ProcessGroupCounts counts = rootGroup.getCounts();
controllerStatus.setRunningCount(counts.getRunningCount());
controllerStatus.setStoppedCount(counts.getStoppedCount());
controllerStatus.setInvalidCount(counts.getInvalidCount());
controllerStatus.setDisabledCount(counts.getDisabledCount());
controllerStatus.setActiveRemotePortCount(counts.getActiveRemotePortCount());
controllerStatus.setInactiveRemotePortCount(counts.getInactiveRemotePortCount());
controllerStatus.setUpToDateCount(counts.getUpToDateCount());
controllerStatus.setLocallyModifiedCount(counts.getLocallyModifiedCount());
controllerStatus.setStaleCount(counts.getStaleCount());
controllerStatus.setLocallyModifiedAndStaleCount(counts.getLocallyModifiedAndStaleCount());
controllerStatus.setSyncFailureCount(counts.getSyncFailureCount());
return controllerStatus;
}
use of org.apache.nifi.web.api.dto.status.ControllerStatusDTO in project nifi by apache.
the class ControllerStatusEndpointMerger method mergeResponses.
@Override
protected void mergeResponses(ControllerStatusDTO clientDto, Map<NodeIdentifier, ControllerStatusDTO> dtoMap, Set<NodeResponse> successfulResponses, Set<NodeResponse> problematicResponses) {
ControllerStatusDTO mergedStatus = clientDto;
for (final Map.Entry<NodeIdentifier, ControllerStatusDTO> entry : dtoMap.entrySet()) {
final ControllerStatusDTO nodeStatus = entry.getValue();
if (nodeStatus == mergedStatus) {
continue;
}
StatusMerger.merge(mergedStatus, nodeStatus);
}
}
Aggregations