use of org.apache.nifi.reporting.Bulletin in project nifi by apache.
the class FlowController method createEventReporter.
private static EventReporter createEventReporter(final BulletinRepository bulletinRepository) {
return new EventReporter() {
private static final long serialVersionUID = 1L;
@Override
public void reportEvent(final Severity severity, final String category, final String message) {
final Bulletin bulletin = BulletinFactory.createBulletin(category, severity.name(), message);
bulletinRepository.addBulletin(bulletin);
}
};
}
use of org.apache.nifi.reporting.Bulletin in project nifi by apache.
the class BulletinFactory method createBulletin.
public static Bulletin createBulletin(final String category, final String severity, final String message) {
final Bulletin bulletin = new SystemBulletin(currentId.getAndIncrement());
bulletin.setCategory(category);
bulletin.setLevel(severity);
bulletin.setMessage(message);
bulletin.setSourceType(ComponentType.FLOW_CONTROLLER);
return bulletin;
}
use of org.apache.nifi.reporting.Bulletin in project nifi-minifi by apache.
the class StatusRequestParser method parseInstanceRequest.
static InstanceStatus parseInstanceRequest(String statusTypes, FlowController flowController, ProcessGroupStatus rootGroupStatus) {
InstanceStatus instanceStatus = new InstanceStatus();
flowController.getAllControllerServices();
List<Bulletin> bulletinList = flowController.getBulletinRepository().findBulletinsForController();
String[] statusSplits = statusTypes.split(",");
for (String statusType : statusSplits) {
switch(statusType.toLowerCase().trim()) {
case "health":
InstanceHealth instanceHealth = new InstanceHealth();
instanceHealth.setQueuedCount(rootGroupStatus.getQueuedCount());
instanceHealth.setQueuedContentSize(rootGroupStatus.getQueuedContentSize());
instanceHealth.setHasBulletins(!bulletinList.isEmpty());
instanceHealth.setActiveThreads(rootGroupStatus.getActiveThreadCount());
instanceStatus.setInstanceHealth(instanceHealth);
break;
case "bulletins":
instanceStatus.setBulletinList(transformBulletins(flowController.getBulletinRepository().findBulletinsForController()));
break;
case "stats":
InstanceStats instanceStats = new InstanceStats();
instanceStats.setBytesRead(rootGroupStatus.getBytesRead());
instanceStats.setBytesWritten(rootGroupStatus.getBytesWritten());
instanceStats.setBytesSent(rootGroupStatus.getBytesSent());
instanceStats.setFlowfilesSent(rootGroupStatus.getFlowFilesSent());
instanceStats.setBytesTransferred(rootGroupStatus.getBytesTransferred());
instanceStats.setFlowfilesTransferred(rootGroupStatus.getFlowFilesTransferred());
instanceStats.setBytesReceived(rootGroupStatus.getBytesReceived());
instanceStats.setFlowfilesReceived(rootGroupStatus.getFlowFilesReceived());
instanceStatus.setInstanceStats(instanceStats);
break;
}
}
return instanceStatus;
}
use of org.apache.nifi.reporting.Bulletin in project nifi-minifi by apache.
the class StatusRequestParser method parseRemoteProcessGroupStatusRequest.
static RemoteProcessGroupStatusBean parseRemoteProcessGroupStatusRequest(RemoteProcessGroupStatus inputRemoteProcessGroupStatus, String statusTypes, FlowController flowController) {
RemoteProcessGroupStatusBean remoteProcessGroupStatusBean = new RemoteProcessGroupStatusBean();
remoteProcessGroupStatusBean.setName(inputRemoteProcessGroupStatus.getName());
String rootGroupId = flowController.getRootGroupId();
String[] statusSplits = statusTypes.split(",");
List<Bulletin> bulletinList = flowController.getBulletinRepository().findBulletins(new BulletinQuery.Builder().sourceIdMatches(inputRemoteProcessGroupStatus.getId()).build());
for (String statusType : statusSplits) {
switch(statusType.toLowerCase().trim()) {
case "health":
RemoteProcessGroupHealth remoteProcessGroupHealth = new RemoteProcessGroupHealth();
remoteProcessGroupHealth.setTransmissionStatus(inputRemoteProcessGroupStatus.getTransmissionStatus().name());
remoteProcessGroupHealth.setActivePortCount(inputRemoteProcessGroupStatus.getActiveRemotePortCount());
remoteProcessGroupHealth.setInactivePortCount(inputRemoteProcessGroupStatus.getInactiveRemotePortCount());
remoteProcessGroupHealth.setHasBulletins(!bulletinList.isEmpty());
remoteProcessGroupStatusBean.setRemoteProcessGroupHealth(remoteProcessGroupHealth);
break;
case "bulletins":
remoteProcessGroupStatusBean.setBulletinList(transformBulletins(bulletinList));
break;
case "inputports":
remoteProcessGroupStatusBean.setInputPortStatusList(getPortStatusList(inputRemoteProcessGroupStatus, flowController, rootGroupId, RemoteProcessGroup::getInputPorts));
break;
case "outputports":
remoteProcessGroupStatusBean.setOutputPortStatusList(getPortStatusList(inputRemoteProcessGroupStatus, flowController, rootGroupId, RemoteProcessGroup::getOutputPorts));
break;
case "stats":
RemoteProcessGroupStats remoteProcessGroupStats = new RemoteProcessGroupStats();
remoteProcessGroupStats.setActiveThreads(inputRemoteProcessGroupStatus.getActiveThreadCount());
remoteProcessGroupStats.setSentContentSize(inputRemoteProcessGroupStatus.getSentContentSize());
remoteProcessGroupStats.setSentCount(inputRemoteProcessGroupStatus.getSentCount());
remoteProcessGroupStatusBean.setRemoteProcessGroupStats(remoteProcessGroupStats);
break;
}
}
return remoteProcessGroupStatusBean;
}
use of org.apache.nifi.reporting.Bulletin in project nifi-minifi by apache.
the class StatusRequestParser method parseReportingTaskStatusRequest.
static ReportingTaskStatus parseReportingTaskStatusRequest(String id, ReportingTaskNode reportingTaskNode, String statusTypes, FlowController flowController, Logger logger) {
ReportingTaskStatus reportingTaskStatus = new ReportingTaskStatus();
reportingTaskStatus.setName(id);
String[] statusSplits = statusTypes.split(",");
List<Bulletin> bulletinList = flowController.getBulletinRepository().findBulletins(new BulletinQuery.Builder().sourceIdMatches(id).build());
for (String statusType : statusSplits) {
switch(statusType.toLowerCase().trim()) {
case "health":
ReportingTaskHealth reportingTaskHealth = new ReportingTaskHealth();
reportingTaskHealth.setScheduledState(reportingTaskNode.getScheduledState().name());
reportingTaskHealth.setActiveThreads(reportingTaskNode.getActiveThreadCount());
reportingTaskHealth.setHasBulletins(!bulletinList.isEmpty());
Collection<ValidationResult> validationResults = reportingTaskNode.getValidationErrors();
reportingTaskHealth.setValidationErrorList(transformValidationResults(validationResults));
reportingTaskStatus.setReportingTaskHealth(reportingTaskHealth);
break;
case "bulletins":
reportingTaskStatus.setBulletinList(transformBulletins(bulletinList));
break;
}
}
return reportingTaskStatus;
}
Aggregations