/** * Returns a unique identifier for the record. By default, it uses * {@link ProvenanceEventRecord#getEventId()} but if it has not been persisted to the * repository, this is {@code -1}, so it constructs a String of the format * {@code <event type>_on_<flowfile UUID>_by_<component UUID>_at_<event time>}. * * @return a String identifying the record for later analysis */ @Override public String getBestEventIdentifier() { if (getEventId() != -1) { return Long.toString(getEventId()); } else { return getEventType().name() + "_on_" + getFlowFileUuid() + "_by_" + getComponentId() + "_at_" + getEventTime(); } }
final ProvenanceEventType eventType = ProvenanceEventType.valueOf(eventTypeName); builder.setEventType(eventType); builder.setEventTime(dis.readLong());
public boolean isComplete() { // If the FlowFile is DROPed right after create child FlowFile, then the path is not worth for reporting. final boolean isDroppedImmediately = events.size() == 2 && events.get(0).getEventType().equals(ProvenanceEventType.DROP) && shouldCreateSeparatePath(events.get(1).getEventType()); return !isDroppedImmediately && hasInput() && hasOutput(); }
private void addEventType(final Map<String, BitSet> map, final String id, final ProvenanceEventType eventType) { final BitSet eventTypes = map.computeIfAbsent(id, key -> new BitSet()); eventTypes.set(eventType.ordinal()); }
@Override public int hashCode() { final int eventTypeCode; if (eventType == ProvenanceEventType.CLONE || eventType == ProvenanceEventType.JOIN || eventType == ProvenanceEventType.FORK) { eventTypeCode = 1472; } else if (eventType == ProvenanceEventType.REPLAY) { eventTypeCode = 21479 + (int) (0x7FFFFFFF & eventTime); // use lower bits of event time. } else { eventTypeCode = 4812 + eventType.hashCode() + 4 * uuid.hashCode(); } return -37423 + 3 * componentId.hashCode() + (transitUri == null ? 0 : 41 * transitUri.hashCode()) + (relationship == null ? 0 : 47 * relationship.hashCode()) + 44 * eventTypeCode + 47 * getChildUuids().hashCode() + 47 * getParentUuids().hashCode(); }
/** * Creates a ProvenanceEventNodeDTO for the specified ProvenanceEventLineageNode. * * @param node node * @return dto */ public ProvenanceNodeDTO createProvenanceEventNodeDTO(final ProvenanceEventLineageNode node) { final ProvenanceNodeDTO dto = new ProvenanceNodeDTO(); dto.setId(node.getIdentifier()); dto.setType("EVENT"); dto.setEventType(node.getEventType().toString()); dto.setTimestamp(new Date(node.getTimestamp())); dto.setMillis(node.getTimestamp()); dto.setFlowFileUuid(node.getFlowFileUuid()); dto.setParentUuids(node.getParentUuids()); dto.setChildUuids(node.getChildUuids()); return dto; }
boolean creationEventRegistered = false; if (registeredTypes != null) { if (registeredTypes.get(ProvenanceEventType.CREATE.ordinal()) || registeredTypes.get(ProvenanceEventType.FORK.ordinal()) || registeredTypes.get(ProvenanceEventType.JOIN.ordinal()) || registeredTypes.get(ProvenanceEventType.RECEIVE.ordinal()) || registeredTypes.get(ProvenanceEventType.FETCH.ordinal())) {
@Override public int hashCode() { final int eventTypeCode; if (eventType == ProvenanceEventType.CLONE || eventType == ProvenanceEventType.JOIN || eventType == ProvenanceEventType.FORK) { eventTypeCode = 1472; } else if (eventType == ProvenanceEventType.REPLAY) { eventTypeCode = 21479 + (int) (0x7FFFFFFF & eventTime); // use lower bits of event time. } else { eventTypeCode = 4812 + eventType.hashCode() + 4 * uuid.hashCode(); } return -37423 + 3 * componentId.hashCode() + (transitUri == null ? 0 : 41 * transitUri.hashCode()) + (relationship == null ? 0 : 47 * relationship.hashCode()) + 44 * eventTypeCode + 47 * getChildUuids().hashCode() + 47 * getParentUuids().hashCode(); }
final String firstEventType = events.get(0).getEventType().name(); queueBetweenParent.set(ATTR_NAME, firstEventType); dataSetRefs.addInput(queueBetweenParent);
final ProvenanceEventType eventType = ProvenanceEventType.valueOf(eventTypeName); builder.setEventType(eventType); builder.setEventTime(dis.readLong());
@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); }
writeUTFLimited(out, record.getEventType().name(), "EventType"); out.writeLong(record.getEventTime()); out.writeLong(record.getFlowFileEntryDate());
for(String type : targetEventTypes) { try { consumer.addTargetEventType(ProvenanceEventType.valueOf(type)); } catch (Exception e) { getLogger().warn(type + " is not a correct event type, removed from the filtering."); for(String type : targetEventTypesExclude) { try { consumer.addTargetEventTypeExclude(ProvenanceEventType.valueOf(type)); } catch (Exception e) { getLogger().warn(type + " is not a correct event type, removed from the exclude filtering.");
@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); }
addField(doc, SearchableFields.ComponentID, record.getComponentId(), Store.NO); addField(doc, SearchableFields.AlternateIdentifierURI, record.getAlternateIdentifierUri(), Store.NO); addField(doc, SearchableFields.EventType, record.getEventType().name(), Store.NO); addField(doc, SearchableFields.Relationship, record.getRelationship(), Store.NO); addField(doc, SearchableFields.Details, record.getDetails(), Store.NO);
} else { try { eventType = ProvenanceEventType.valueOf(eventTypes.get(eventTypeOrdinal)); } catch (final Exception e) { eventType = ProvenanceEventType.UNKNOWN;
@Override public void processEvent(AnalysisContext analysisContext, NiFiFlow nifiFlow, ProvenanceEventRecord event) { if (!ProvenanceEventType.DROP.equals(event.getEventType())) { return;
addField(doc, SearchableFields.ComponentID, record.getComponentId()); addField(doc, SearchableFields.AlternateIdentifierURI, record.getAlternateIdentifierUri()); addField(doc, SearchableFields.EventType, record.getEventType().name()); addField(doc, SearchableFields.Relationship, record.getRelationship()); addField(doc, SearchableFields.Details, record.getDetails());
builder.setEventDuration((Long) record.getFieldValue(EventFieldNames.EVENT_DURATION)); builder.setEventTime((Long) record.getFieldValue(EventFieldNames.EVENT_TIME)); builder.setEventType(ProvenanceEventType.valueOf((String) record.getFieldValue(EventFieldNames.EVENT_TYPE))); builder.setFlowFileEntryDate((Long) record.getFieldValue(EventFieldNames.FLOWFILE_ENTRY_DATE)); builder.setFlowFileUUID((String) record.getFieldValue(EventFieldNames.FLOWFILE_UUID));
public boolean isComplete() { // If the FlowFile is DROPed right after create child FlowFile, then the path is not worth for reporting. final boolean isDroppedImmediately = events.size() == 2 && events.get(0).getEventType().equals(ProvenanceEventType.DROP) && shouldCreateSeparatePath(events.get(1).getEventType()); return !isDroppedImmediately && hasInput() && hasOutput(); }