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

The following examples show how to use org.apache.nifi.controller.status.ProcessGroupStatus#getName() . 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: PrometheusMetricsFactory.java    From nifi-prometheus-reporter with Apache License 2.0 6 votes vote down vote up
public static CollectorRegistry createNifiMetrics(ProcessGroupStatus status, String applicationId) {
    String processGroupName = status.getName();
    AMOUNT_FLOWFILES_TOTAL.labels("sent", applicationId, processGroupName).set(status.getFlowFilesSent());
    AMOUNT_FLOWFILES_TOTAL.labels("transferred", applicationId, processGroupName).set(status.getFlowFilesTransferred());
    AMOUNT_FLOWFILES_TOTAL.labels("received", applicationId, processGroupName).set(status.getFlowFilesReceived());

    AMOUNT_BYTES_TOTAL.labels("sent", applicationId, processGroupName).set(status.getBytesSent());
    AMOUNT_BYTES_TOTAL.labels("read", applicationId, processGroupName).set(status.getBytesRead());
    AMOUNT_BYTES_TOTAL.labels("written", applicationId, processGroupName).set(status.getBytesWritten());
    AMOUNT_BYTES_TOTAL.labels("received", applicationId, processGroupName).set(status.getBytesReceived());
    AMOUNT_BYTES_TOTAL.labels("transferred", applicationId, processGroupName).set(status.getBytesTransferred());

    SIZE_CONTENT_TOTAL.labels("output", applicationId, processGroupName).set(status.getOutputContentSize());
    SIZE_CONTENT_TOTAL.labels("input", applicationId, processGroupName).set(status.getInputContentSize());
    SIZE_CONTENT_TOTAL.labels("queued", applicationId, processGroupName).set(status.getQueuedContentSize());

    AMOUNT_ITEMS.labels("output", applicationId, processGroupName).set(status.getOutputCount());
    AMOUNT_ITEMS.labels("input", applicationId, processGroupName).set(status.getInputCount());
    AMOUNT_ITEMS.labels("queued", applicationId, processGroupName).set(status.getQueuedCount());

    AMOUNT_THREADS_TOTAL.labels("nano", applicationId, processGroupName).set(status.getActiveThreadCount());

    return NIFI_METRICS_REGISTRY;
}
 
Example 2
Source File: AzureLogAnalyticsMetricsFactory.java    From nifi with Apache License 2.0 6 votes vote down vote up
public static List<Metric> getDataFlowMetrics(ProcessGroupStatus status, String instanceId){

        final String groupId = status.getId();
        final String groupName = status.getName();
        MetricsBuilder builder= new MetricsBuilder(Metric.CATEGORY_DATAFLOW,instanceId, groupId, groupName);

        // build dataflow metrics
        builder.metric(MetricNames.FLOW_FILES_RECEIVED, status.getFlowFilesReceived())
            .metric(MetricNames.FLOW_FILES_SENT, status.getFlowFilesSent())
            .metric(MetricNames.FLOW_FILES_QUEUED, status.getQueuedCount())
            .metric(MetricNames.BYTES_RECEIVED,status.getBytesReceived())
            .metric(MetricNames.BYTES_WRITTEN,status.getBytesWritten())
            .metric(MetricNames.BYTES_READ, status.getBytesRead())
            .metric(MetricNames.BYTES_SENT, status.getBytesSent())
            .metric(MetricNames.BYTES_QUEUED,status.getQueuedContentSize())
            .metric(MetricNames.ACTIVE_THREADS,status.getActiveThreadCount())
            .metric(MetricNames.TOTAL_TASK_DURATION_SECONDS,calculateProcessingNanos(status));
        return builder.build();
    }
 
Example 3
Source File: ProcessGroupStatusEnumerator.java    From nifi with Apache License 2.0 4 votes vote down vote up
private Object filterColumns(final ProcessGroupStatus status, final String parentId) {
    if (status == null) {
        return null;
    }

    final Object[] row = new Object[]{
            status.getId(),
            parentId,
            status.getName(),
            status.getBytesRead(),
            status.getBytesWritten(),
            status.getBytesReceived(),
            status.getBytesSent(),
            status.getBytesTransferred(),
            status.getFlowFilesReceived(),
            status.getFlowFilesSent(),
            status.getFlowFilesTransferred(),
            status.getInputContentSize(),
            status.getInputCount(),
            status.getOutputContentSize(),
            status.getOutputCount(),
            status.getQueuedContentSize(),
            status.getActiveThreadCount(),
            status.getTerminatedThreadCount(),
            status.getQueuedCount(),
            status.getVersionedFlowState() == null ? null : status.getVersionedFlowState().name()
    };

    // If we want no fields just return null
    if (fields == null) {
        return row;
    }

    // If we want only a single field, then Calcite is going to expect us to return
    // the actual value, NOT a 1-element array of values.
    if (fields.length == 1) {
        final int desiredCellIndex = fields[0];
        return row[desiredCellIndex];
    }

    // Create a new Object array that contains only the desired fields.
    final Object[] filtered = new Object[fields.length];
    for (int i = 0; i < fields.length; i++) {
        final int indexToKeep = fields[i];
        filtered[i] = row[indexToKeep];
    }

    return filtered;
}