Bryan Bende created NIFI-16631:
----------------------------------
Summary: 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
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)