[
https://issues.apache.org/jira/browse/NIFI-16631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150404#comment-18150404
]
ASF subversion and git services commented on NIFI-16631:
--------------------------------------------------------
Commit ae49304ea7455118945786c163fa160ba4da1147 in nifi's branch
refs/heads/main from Bryan Bende
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=ae49304ea74 ]
NIFI-16631 Fix Process Group flowFilesSent overwritten by Output Port status
(#11966)
Co-authored-by: Cursor <[email protected]>
> Process Group status reports flowFilesSent as 0 when the group has an active
> Output Port
> ----------------------------------------------------------------------------------------
>
> Key: NIFI-16631
> URL: https://issues.apache.org/jira/browse/NIFI-16631
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 2.12.0
> Reporter: Bryan Bende
> Assignee: Bryan Bende
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> h3. Summary
> AbstractEventAccess.getGroupStatus() assigns flowFilesSent in the Output Port
> loop instead of adding to it. That replaces the total already summed from the
> group's processors, child groups and remote process groups with the Output
> Port's own sent count. For a local Output Port, that count is always 0.
> As a result, any Process Group containing an Output Port that moved a
> FlowFile in the last 5 minutes reports flowFilesSent = 0, even when
> processors in the group are actively sending. The 0 carries up through every
> ancestor group to the root group. bytesSent on the next line is added
> correctly, so the same status shows flowFilesSent = 0 with a non-zero
> bytesSent.
> h3. Code
> In nifi-framework-components, org.apache.nifi.reporting.AbstractEventAccess,
> Output Port loop in getGroupStatus():
> flowFilesSent = entry.getFlowFilesSent();
> bytesSent += entry.getBytesSent();
> The first line should be flowFilesSent += entry.getFlowFilesSent(). The Input
> Port loop handles the equivalent received fields correctly (flowFilesReceived
> += entry.getFlowFilesReceived()).
> h3. Steps to Reproduce
> Under the root group, create Process Group "A".
> In "A", connect GenerateFlowFile to PutFile, and PutFile success to an Output
> Port named "out". Any processor that reports a SEND provenance event works in
> place of PutFile.
> In the root group, connect A's "out" port to any processor, for example a
> stopped UpdateAttribute, so the port can run.
> Start everything and wait about a minute.
> Call GET /nifi-api/flow/process-groups/root/status, or the same endpoint for
> group A.
> Actual: flowFilesSent = 0 and bytesSent > 0, for "A" and for root. The sent
> field shows something like "0 (514.69 MB)".
> Expected: flowFilesSent equals the sum of FlowFiles sent by processors in
> "A". It should match PutFile's "FlowFiles Sent" in status history.
> To confirm: auto-terminate PutFile's success relationship instead of routing
> it to "out". After about 5 minutes, the group's flowFilesSent becomes correct.
> h3. Impact
> Anything that reads Process Group flowFilesSent under-reports it, including:
> * REST API group status and the Sent column in the UI, which shows "0 (N
> bytes)".
> * Cluster-merged status, since StatusMerger sums per-node values that are
> already 0.
> * The Prometheus AMOUNT_FLOWFILES_SENT metric for process groups,
> MetricsService, the Azure Log Analytics reporting task,
> SiteToSiteStatusReportingTask, and the SQL reporting PROCESS_GROUP_STATUS
> table.
> * Any external monitoring that infers flow activity from the root group's
> sent and received counts.
> h3. Proposed Fix
> Change the assignment to flowFilesSent += entry.getFlowFilesSent() and add a
> test to AbstractEventAccessTest. The test should cover a group with a
> processor reporting sends plus an Output Port that has a status report entry,
> and assert that the group's flowFilesSent includes the processor's count.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)