Vincenzo Lombardo created NIFI-16456:
----------------------------------------
Summary: Include nested Process Groups in MiNiFi C2 heartbeat flow
info
Key: NIFI-16456
URL: https://issues.apache.org/jira/browse/NIFI-16456
Project: Apache NiFi
Issue Type: Improvement
Components: MiNiFi
Affects Versions: 2.11.0
Reporter: Vincenzo Lombardo
h3. Problem
The MiNiFi Java C2 heartbeat ({{flowInfo}}) only reports components that belong
directly to the root Process Group:
* {{processorStatuses}} contains only processors of the root group
* {{queues}} contains only connections of the root group
* {{processorBulletins}} contains only bulletins from processors of the root
group
Processors, connections and bulletins inside nested Process Groups are never
sent to the C2 server. C2 operations already work on nested components (for
example START/STOP with operand PROCESSOR on a processor inside a child group
is applied), so a C2 server can control a component it can never observe.
h3. Cause
{{C2NifiClientService}} (minifi-framework-core) calls
{{flowController.getEventAccess().getGroupStatus("root")}}. That call already
computes the complete status tree
({{AbstractEventAccess.getGroupStatus(String)}} uses {{recursiveStatusDepth =
Integer.MAX_VALUE}}), but:
* {{getProcessorStatus()}} reads only
{{ProcessGroupStatus.getProcessorStatus()}} of the root group
* {{getQueueStatus()}} reads only {{ProcessGroupStatus.getConnectionStatus()}}
of the root group
* {{getBulletins()}} builds a {{BulletinQuery}} with {{groupIdMatches(<root
group id>)}}, which excludes bulletins whose groupId is a child group
The child groups in {{ProcessGroupStatus.getProcessGroupStatus()}} are never
visited.
h3. Steps to reproduce
# Start a MiNiFi Java agent with C2 enabled and
{{c2.flow.info.processor.status.enabled=true}}
# Deploy a flow with one processor in the root group and a child Process Group
containing processors and a connection
# Inspect the heartbeat received by the C2 server: only root group processors
and connections are present, although the nested processors are running
(visible in the agent log)
Observed on MiNiFi 2.11.0: heartbeat with 3 processors / 3 connections for a
flow that has 5 processors / 4 connections.
h3. Proposed change
Walk the already computed {{ProcessGroupStatus}} tree (root and all
descendants) when collecting processor and queue status, and drop the root
group filter from the processor bulletin query. No protocol change is needed:
{{ProcessorStatus}} and {{ProcessorBulletin}} already carry {{groupId}}, so C2
servers can tell which group each component belongs to. No extra status
computation is introduced.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)