@Override public String getComponentType() { return event.getComponentType(); }
@Override public String getComponentType() { return record.getComponentType(); }
/** * @return whether this event originated from a remote group port */ default boolean isRemotePortType() { final String componentType = getComponentType(); return REMOTE_INPUT_PORT_TYPE.equals(componentType) || REMOTE_OUTPUT_PORT_TYPE.equals(componentType); }
@Override public void processEvent(AnalysisContext analysisContext, NiFiFlow nifiFlow, ProvenanceEventRecord event) { final DataSetRefs refs = executeAnalyzer(analysisContext, event); if (refs == null || (refs.isEmpty())) { return; } if ("Remote Input Port".equals(event.getComponentType()) || "Remote Output Port".equals(event.getComponentType())) { processRemotePortEvent(analysisContext, nifiFlow, event, refs); } else { addDataSetRefs(nifiFlow, refs); } }
private static String stringify(final ProvenanceEventRecord event, final int index, final long byteOffset) { final StringBuilder sb = new StringBuilder(); sb.append("Event Index in File = ").append(index).append(", Byte Offset = ").append(byteOffset); sb.append("\n\t").append("Event ID = ").append(event.getEventId()); sb.append("\n\t").append("Event Type = ").append(event.getEventType()); sb.append("\n\t").append("Event Time = ").append(new Date(event.getEventTime())); sb.append("\n\t").append("Event UUID = ").append(event.getFlowFileUuid()); sb.append("\n\t").append("Component ID = ").append(event.getComponentId()); sb.append("\n\t").append("Event ID = ").append(event.getComponentType()); sb.append("\n\t").append("Transit URI = ").append(event.getTransitUri()); sb.append("\n\t").append("Parent IDs = ").append(event.getParentUuids()); sb.append("\n\t").append("Child IDs = ").append(event.getChildUuids()); sb.append("\n\t").append("Previous Attributes = ").append(event.getPreviousAttributes()); sb.append("\n\t").append("Updated Attributes = ").append(event.getUpdatedAttributes()); return sb.toString(); } }
protected DataSetRefs executeAnalyzer(AnalysisContext analysisContext, ProvenanceEventRecord event) { final NiFiProvenanceEventAnalyzer analyzer = NiFiProvenanceEventAnalyzerFactory.getAnalyzer(event.getComponentType(), event.getTransitUri(), event.getEventType()); if (analyzer == null) { return null; } if (logger.isDebugEnabled()) { logger.debug("Analyzer {} is found for event: {}", analyzer, event); } return analyzer.analyze(analysisContext, event); }
continue; final String processGroupId = componentMapHolder.getProcessGroupId(componentId, provenanceEventRecord.getComponentType()); if (!StringUtils.isEmpty(processGroupId)) { continue; final String processGroupId = componentMapHolder.getProcessGroupId(componentId, provenanceEventRecord.getComponentType()); if (StringUtils.isEmpty(processGroupId)) { continue; if (componentTypeRegexExclude != null && componentTypeRegexExclude.matcher(provenanceEventRecord.getComponentType()).matches()) { continue; if (componentTypeRegex != null && !componentTypeRegex.matcher(provenanceEventRecord.getComponentType()).matches()) { continue;
protected Referenceable createDataSetRef(AnalysisContext context, ProvenanceEventRecord event) { final Referenceable ref = new Referenceable(TYPE); ref.set(ATTR_NAME, event.getComponentType()); ref.set(ATTR_QUALIFIED_NAME, toQualifiedName(context.getNiFiClusterName(), event.getComponentId())); ref.set(ATTR_DESCRIPTION, event.getEventType() + " was performed by " + event.getComponentType()); return ref; }
for (final ProvenanceEventRecord event : events) { final String componentName = mapHolder.getComponentName(event.getComponentId()); final String processGroupId = mapHolder.getProcessGroupId(event.getComponentId(), event.getComponentType()); final String processGroupName = mapHolder.getComponentName(processGroupId); arrayBuilder.add(serialize(factory, builder, event, df, componentName, processGroupId, processGroupName, hostname, url, rootGroupName, platform, nodeId));
@Override public DataSetRefs analyze(AnalysisContext context, ProvenanceEventRecord event) { if (!ProvenanceEventType.SEND.equals(event.getEventType()) && !ProvenanceEventType.RECEIVE.equals(event.getEventType())) { return null; } final boolean isRemoteInputPort = event.getComponentType().equals("Remote Input Port"); final String type = isRemoteInputPort ? TYPE_NIFI_INPUT_PORT : TYPE_NIFI_OUTPUT_PORT; final S2SPort s2SPort = analyzeS2SPort(event, context.getClusterResolver()); // Find connections that connects to/from the remote port. final String componentId = event.getComponentId(); final List<ConnectionStatus> connections = isRemoteInputPort ? context.findConnectionTo(componentId) : context.findConnectionFrom(componentId); if (connections == null || connections.isEmpty()) { logger.warn("Connection was not found: {}", new Object[]{event}); return null; } // The name of remote port can be retrieved from any connection, use the first one. final ConnectionStatus connection = connections.get(0); final Referenceable ref = new Referenceable(type); ref.set(ATTR_NAME, isRemoteInputPort ? connection.getDestinationName() : connection.getSourceName()); ref.set(ATTR_QUALIFIED_NAME, toQualifiedName(s2SPort.clusterName, s2SPort.targetPortId)); return singleDataSetRef(event.getComponentId(), event.getEventType(), ref); }
@Override public DataSetRefs analyze(AnalysisContext context, ProvenanceEventRecord event) { if (!ProvenanceEventType.SEND.equals(event.getEventType()) && !ProvenanceEventType.RECEIVE.equals(event.getEventType())) { return null; } final boolean isInputPort = event.getComponentType().equals("Input Port"); final String type = isInputPort ? TYPE_NIFI_INPUT_PORT : TYPE_NIFI_OUTPUT_PORT; final String rootPortId = event.getComponentId(); final S2SPort s2SPort = analyzeS2SPort(event, context.getClusterResolver()); // Find connections connecting to/from the remote port. final List<ConnectionStatus> connections = isInputPort ? context.findConnectionFrom(rootPortId) : context.findConnectionTo(rootPortId); if (connections == null || connections.isEmpty()) { logger.warn("Connection was not found: {}", new Object[]{event}); return null; } // The name of the port can be retrieved from any connection, use the first one. final ConnectionStatus connection = connections.get(0); final Referenceable ref = new Referenceable(type); ref.set(ATTR_NAME, isInputPort ? connection.getSourceName() : connection.getDestinationName()); ref.set(ATTR_QUALIFIED_NAME, toQualifiedName(s2SPort.clusterName, rootPortId)); return singleDataSetRef(event.getComponentId(), event.getEventType(), ref); }
writeNullableString(out, record.getComponentType(), "ComponentType"); writeUUID(out, record.getFlowFileUuid()); writeNullableString(out, record.getDetails(), "Details");
final boolean isRemoteInputPort = "Remote Input Port".equals(event.getComponentType()); remotePortProcess.setName(event.getComponentType()); remotePortProcess.addProcessor(portProcessId);
addField(builder, "details", event.getDetails()); addField(builder, "componentId", event.getComponentId()); addField(builder, "componentType", event.getComponentType()); addField(builder, "componentName", componentName); addField(builder, "processGroupId", processGroupId, true);
.setFlowFileEntryDate(System.currentTimeMillis()) .setLineageStartDate(event.getLineageStartDate()) .setComponentType(event.getComponentType()) .setComponentId(event.getComponentId()) .build();
dto.setFileSizeBytes(event.getFileSize()); dto.setComponentId(event.getComponentId()); dto.setComponentType(event.getComponentType());
return createLookupValue(event.getComponentId(), componentIdMap); case EventFieldNames.COMPONENT_TYPE: return createLookupValue(event.getComponentType(), componentTypeMap); case EventFieldNames.CONTENT_CLAIM: return createExplicitSameOrNoneValue(contentClaimRecord, previousClaimRecord, () -> contentClaimRecord);
return event.getComponentId(); case EventFieldNames.COMPONENT_TYPE: return event.getComponentType(); case EventFieldNames.CONTENT_CLAIM: return contentClaimRecord;
eventType = event.getEventType(); componentId = event.getComponentId(); componentType = event.getComponentType(); transitUri = event.getTransitUri(); sourceSystemFlowFileIdentifier = event.getSourceSystemFlowFileIdentifier();
protected Referenceable createDataSetRef(AnalysisContext context, ProvenanceEventRecord event) { final Referenceable ref = new Referenceable(TYPE); ref.set(ATTR_NAME, event.getComponentType()); ref.set(ATTR_QUALIFIED_NAME, toQualifiedName(context.getNiFiClusterName(), event.getComponentId())); ref.set(ATTR_DESCRIPTION, event.getEventType() + " was performed by " + event.getComponentType()); return ref; }