Java Code Examples for org.apache.nifi.controller.status.ProcessGroupStatus#setBytesTransferred()

The following examples show how to use org.apache.nifi.controller.status.ProcessGroupStatus#setBytesTransferred() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAzureLogAnalyticsReportingTask.java    From nifi with Apache License 2.0 6 votes vote down vote up
private void initTestGroupStatuses() {
    testGroupStatus = new ProcessGroupStatus();
    testGroupStatus.setId(TEST_GROUP1_ID);
    testGroupStatus.setFlowFilesReceived(5);
    testGroupStatus.setBytesReceived(10000);
    testGroupStatus.setFlowFilesSent(10);
    testGroupStatus.setBytesSent(20000);
    testGroupStatus.setQueuedCount(100);
    testGroupStatus.setQueuedContentSize(1024L);
    testGroupStatus.setBytesRead(60000L);
    testGroupStatus.setBytesWritten(80000L);
    testGroupStatus.setActiveThreadCount(5);
    testGroupStatus.setName(TEST_GROUP1_ID);
    testGroupStatus.setFlowFilesTransferred(5);
    testGroupStatus.setBytesTransferred(10000);
    testGroupStatus.setOutputContentSize(1000L);
    testGroupStatus.setInputContentSize(1000L);
    testGroupStatus.setOutputCount(100);
    testGroupStatus.setInputCount(1000);
}
 
Example 2
Source File: TestAzureLogAnalyticsReportingTask.java    From nifi with Apache License 2.0 6 votes vote down vote up
private void initTestGroup2Statuses() {
    testGroupStatus2 = new ProcessGroupStatus();
    testGroupStatus2.setId(TEST_GROUP2_ID);
    testGroupStatus2.setFlowFilesReceived(5);
    testGroupStatus2.setBytesReceived(10000);
    testGroupStatus2.setFlowFilesSent(10);
    testGroupStatus2.setBytesSent(20000);
    testGroupStatus2.setQueuedCount(100);
    testGroupStatus2.setQueuedContentSize(1024L);
    testGroupStatus2.setBytesRead(60000L);
    testGroupStatus2.setBytesWritten(80000L);
    testGroupStatus2.setActiveThreadCount(5);
    testGroupStatus2.setName(TEST_GROUP2_ID);
    testGroupStatus2.setFlowFilesTransferred(5);
    testGroupStatus2.setBytesTransferred(10000);
    testGroupStatus2.setOutputContentSize(1000L);
    testGroupStatus2.setInputContentSize(1000L);
    testGroupStatus2.setOutputCount(100);
    testGroupStatus2.setInputCount(1000);
}
 
Example 3
Source File: TestPrometheusReportingTask.java    From nifi-prometheus-reporter with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    status = new ProcessGroupStatus();
    status.setId("1234");
    status.setName("localTest");
    status.setFlowFilesReceived(5);
    status.setFlowFilesSent(10);
    status.setFlowFilesTransferred(10);
    status.setBytesReceived(10000);
    status.setBytesSent(20000);
    status.setBytesTransferred(10000);
    status.setBytesRead(60000L);
    status.setBytesWritten(80000L);
    status.setQueuedCount(100);
    status.setQueuedContentSize(1024L);
    status.setActiveThreadCount(5);
    status.setInputCount(10);
    status.setOutputCount(20);
    status.setQueuedCount(30);
    status.setInputContentSize(Integer.toUnsignedLong(0));
    status.setOutputContentSize(Integer.toUnsignedLong(0));
    status.setOutputContentSize(Integer.toUnsignedLong(0));


    // create a processor status with processing time
    ProcessorStatus procStatus = new ProcessorStatus();
    procStatus.setProcessingNanos(123456789);

    Collection<ProcessorStatus> processorStatuses = new ArrayList<>();
    processorStatuses.add(procStatus);
    status.setProcessorStatus(processorStatuses);

    // create a group status with processing time
    ProcessGroupStatus groupStatus = new ProcessGroupStatus();
    groupStatus.setProcessorStatus(processorStatuses);

    Collection<ProcessGroupStatus> groupStatuses = new ArrayList<>();
    groupStatuses.add(groupStatus);
    status.setProcessGroupStatus(groupStatuses);
}
 
Example 4
Source File: TestAzureLogAnalyticsReportingTask.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    testedReportingTask = new TestableAzureLogAnalyticsReportingTask();
    rootGroupStatus = new ProcessGroupStatus();
    reportingInitContextStub = new MockReportingInitializationContext(TEST_INIT_CONTEXT_ID, TEST_INIT_CONTEXT_NAME,
            new MockComponentLog(TEST_TASK_ID, testedReportingTask));

    reportingContextStub = new MockReportingContext(Collections.emptyMap(),
            new MockStateManager(testedReportingTask), new MockVariableRegistry());

    reportingContextStub.setProperty(AzureLogAnalyticsReportingTask.INSTANCE_ID.getName(), TEST_TASK_ID);
    reportingContextStub.setProperty(AzureLogAnalyticsReportingTask.LOG_ANALYTICS_WORKSPACE_ID.getName(), TEST_TASK_ID);
    reportingContextStub.setProperty(AzureLogAnalyticsReportingTask.LOG_ANALYTICS_WORKSPACE_KEY.getName(), MOCK_KEY);


    rootGroupStatus.setId("1234");
    rootGroupStatus.setFlowFilesReceived(5);
    rootGroupStatus.setBytesReceived(10000);
    rootGroupStatus.setFlowFilesSent(10);
    rootGroupStatus.setBytesSent(20000);
    rootGroupStatus.setQueuedCount(100);
    rootGroupStatus.setQueuedContentSize(1024L);
    rootGroupStatus.setBytesRead(60000L);
    rootGroupStatus.setBytesWritten(80000L);
    rootGroupStatus.setActiveThreadCount(5);
    rootGroupStatus.setName("root");
    rootGroupStatus.setFlowFilesTransferred(5);
    rootGroupStatus.setBytesTransferred(10000);
    rootGroupStatus.setOutputContentSize(1000L);
    rootGroupStatus.setInputContentSize(1000L);
    rootGroupStatus.setOutputCount(100);
    rootGroupStatus.setInputCount(1000);
    initProcessorStatuses();

}
 
Example 5
Source File: TestSiteToSiteStatusReportingTask.java    From nifi with Apache License 2.0 4 votes vote down vote up
/***********************************
 * Test component generator methods
 ***********************************/

public static ProcessGroupStatus generateProcessGroupStatus(String id, String namePrefix,
        int maxRecursion, int currentDepth) {
    Collection<ConnectionStatus> cStatus = new ArrayList<>();
    Collection<PortStatus> ipStatus = new ArrayList<>();
    Collection<PortStatus> opStatus = new ArrayList<>();
    Collection<ProcessorStatus> pStatus = new ArrayList<>();
    Collection<RemoteProcessGroupStatus> rpgStatus = new ArrayList<>();
    Collection<ProcessGroupStatus> childPgStatus = new ArrayList<>();

    if (currentDepth < maxRecursion) {
        for(int i = 1; i < 4; i++) {
            childPgStatus.add(generateProcessGroupStatus(id + "." + i, namePrefix + "." + i,
                    maxRecursion, currentDepth + 1));
        }
    }
    for(int i = 1; i < 4; i++) {
        pStatus.add(generateProcessorStatus(id + ".processor." + i, namePrefix + ".processor." + i));
    }
    for(int i = 1; i < 4; i++) {
        cStatus.add(generateConnectionStatus(id + ".connection." + i, namePrefix + ".connection." + i));
    }
    for(int i = 1; i < 4; i++) {
        rpgStatus.add(generateRemoteProcessGroupStatus(id + ".rpg." + i, namePrefix + ".rpg." + i));
    }
    for(int i = 1; i < 4; i++) {
        ipStatus.add(generatePortStatus(id + ".ip." + i, namePrefix + ".ip." + i));
    }
    for(int i = 1; i < 4; i++) {
        opStatus.add(generatePortStatus(id + ".op." + i, namePrefix + ".op." + i));
    }

    ProcessGroupStatus pgStatus = new ProcessGroupStatus();
    pgStatus.setId(id);
    pgStatus.setName(namePrefix + "-" + UUID.randomUUID().toString());
    pgStatus.setInputPortStatus(ipStatus);
    pgStatus.setOutputPortStatus(opStatus);
    pgStatus.setProcessGroupStatus(childPgStatus);
    pgStatus.setRemoteProcessGroupStatus(rpgStatus);
    pgStatus.setProcessorStatus(pStatus);
    pgStatus.setVersionedFlowState(VersionedFlowState.UP_TO_DATE);
    pgStatus.setActiveThreadCount(1);
    pgStatus.setBytesRead(2L);
    pgStatus.setBytesReceived(3l);
    pgStatus.setBytesSent(4l);
    pgStatus.setBytesTransferred(5l);
    pgStatus.setBytesWritten(6l);
    pgStatus.setConnectionStatus(cStatus);
    pgStatus.setFlowFilesReceived(7);
    pgStatus.setFlowFilesSent(8);
    pgStatus.setFlowFilesTransferred(9);
    pgStatus.setInputContentSize(10l);
    pgStatus.setInputCount(11);
    pgStatus.setOutputContentSize(12l);
    pgStatus.setOutputCount(13);
    pgStatus.setQueuedContentSize(14l);
    pgStatus.setQueuedCount(15);
    pgStatus.setTerminatedThreadCount(1);

    return pgStatus;
}
 
Example 6
Source File: TestPrometheusReportingTask.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
    testedReportingTask = new PrometheusReportingTask();
    rootGroupStatus = new ProcessGroupStatus();
    reportingInitContextStub = new MockReportingInitializationContext(TEST_INIT_CONTEXT_ID, TEST_INIT_CONTEXT_NAME,
            new MockComponentLog(TEST_TASK_ID, testedReportingTask));

    reportingContextStub = new MockReportingContext(Collections.emptyMap(),
            new MockStateManager(testedReportingTask), new MockVariableRegistry());

    reportingContextStub.setProperty(PrometheusMetricsUtil.INSTANCE_ID.getName(), "localhost");

    configurationContextStub = new MockConfigurationContext(reportingContextStub.getProperties(),
            reportingContextStub.getControllerServiceLookup());

    rootGroupStatus.setId("1234");
    rootGroupStatus.setFlowFilesReceived(5);
    rootGroupStatus.setBytesReceived(10000);
    rootGroupStatus.setFlowFilesSent(10);
    rootGroupStatus.setBytesSent(20000);
    rootGroupStatus.setQueuedCount(100);
    rootGroupStatus.setQueuedContentSize(1024L);
    rootGroupStatus.setBytesRead(60000L);
    rootGroupStatus.setBytesWritten(80000L);
    rootGroupStatus.setActiveThreadCount(5);
    rootGroupStatus.setName("root");
    rootGroupStatus.setFlowFilesTransferred(5);
    rootGroupStatus.setBytesTransferred(10000);
    rootGroupStatus.setOutputContentSize(1000L);
    rootGroupStatus.setInputContentSize(1000L);
    rootGroupStatus.setOutputCount(100);
    rootGroupStatus.setInputCount(1000);

    PortStatus outputPortStatus = new PortStatus();
    outputPortStatus.setId("9876");
    outputPortStatus.setName("out");
    outputPortStatus.setGroupId("1234");
    outputPortStatus.setRunStatus(RunStatus.Stopped);
    outputPortStatus.setActiveThreadCount(1);

    rootGroupStatus.setOutputPortStatus(Collections.singletonList(outputPortStatus));
    // Create a nested group status
    ProcessGroupStatus groupStatus2 = new ProcessGroupStatus();
    groupStatus2.setFlowFilesReceived(5);
    groupStatus2.setBytesReceived(10000);
    groupStatus2.setFlowFilesSent(10);
    groupStatus2.setBytesSent(20000);
    groupStatus2.setQueuedCount(100);
    groupStatus2.setQueuedContentSize(1024L);
    groupStatus2.setActiveThreadCount(2);
    groupStatus2.setBytesRead(12345L);
    groupStatus2.setBytesWritten(11111L);
    groupStatus2.setFlowFilesTransferred(5);
    groupStatus2.setBytesTransferred(10000);
    groupStatus2.setOutputContentSize(1000L);
    groupStatus2.setInputContentSize(1000L);
    groupStatus2.setOutputCount(100);
    groupStatus2.setInputCount(1000);
    groupStatus2.setId("3378");
    groupStatus2.setName("nestedPG");
    Collection<ProcessGroupStatus> nestedGroupStatuses = new ArrayList<>();
    nestedGroupStatuses.add(groupStatus2);
    rootGroupStatus.setProcessGroupStatus(nestedGroupStatuses);
}