Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2351#discussion_r158616813
--- Diff:
nifi-nar-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/provenance/ProvenanceEventConsumer.java
---
@@ -218,18 +230,35 @@ private boolean isFilteringEnabled() {
return componentTypeRegex != null || !eventTypes.isEmpty() ||
!componentIds.isEmpty();
}
- private List<ProvenanceEventRecord>
filterEvents(List<ProvenanceEventRecord> provenanceEvents) {
- if(isFilteringEnabled()) {
- List<ProvenanceEventRecord> filteredEvents = new
ArrayList<ProvenanceEventRecord>();
+ private List<ProvenanceEventRecord> filterEvents(ComponentMapHolder
componentMapHolder, List<ProvenanceEventRecord> provenanceEvents) {
+ if (isFilteringEnabled()) {
+ List<ProvenanceEventRecord> filteredEvents = new ArrayList<>();
for (ProvenanceEventRecord provenanceEventRecord :
provenanceEvents) {
- if(!componentIds.isEmpty() &&
!componentIds.contains(provenanceEventRecord.getComponentId())) {
- continue;
+ final String componentId =
provenanceEventRecord.getComponentId();
+ if (!componentIds.isEmpty() &&
!componentIds.contains(componentId)) {
+ // If we aren't filtering it out based on component
ID, let's see if this component has a parent process group IDs
+ // that is being filtered on
+ if (componentMapHolder == null) {
+ continue;
+ }
+ final String processGroupId =
componentMapHolder.getProcessGroupId(componentId,
provenanceEventRecord.getComponentType());
+ if (StringUtils.isEmpty(processGroupId)) {
+ continue;
+ }
+ // Check if any parent process group has the specified
component ID
+ ParentProcessGroupSearchNode matchedComponent =
componentMapHolder.getProcessGroupParent(componentId);
--- End diff --
`componentMapHolder.getProcessGroupParent(componentId)` will not work with
RemoteInputPorts and RemoteOutputPorts.
---