public Map<String,String> getConnectionStatusTags(ConnectionStatus status) { final Map<String, String> connectionTags = new HashMap<>(); connectionTags.put(MetricNames.CONNECTION_ID, status.getId()); connectionTags.put(MetricNames.CONNECTION_NAME, status.getName()); connectionTags.put(MetricNames.CONNECTION_GROUP_ID, status.getGroupId()); connectionTags.put(MetricNames.CONNECTION_DESTINATION_ID, status.getDestinationId()); connectionTags.put(MetricNames.CONNECTTION_DESTINATION_NAME, status.getDestinationName()); connectionTags.put(MetricNames.CONNECTION_SOURCE_ID, status.getSourceId()); connectionTags.put(MetricNames.CONNECTION_SOURCE_NAME, status.getSourceName()); return connectionTags; }
public static ComponentDetails forConnection(final ConnectionStatus status) { return forConnection(status.getId(), status.getGroupId(), status.getName(), status.getSourceName(), status.getDestinationName()); }
componentNameMap.computeIfAbsent(connectionStatus.getDestinationId(), k -> connectionStatus.getDestinationName()); sourceToConnectionParentGroupMap.put(connectionStatus.getSourceId(), connectionStatus.getGroupId()); destinationToConnectionParentGroupMap.put(connectionStatus.getDestinationId(), connectionStatus.getGroupId());
@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); }
@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); }
connectionStatus.getSourceName(), connectionStatus.getName(), connectionStatus.getDestinationName(), input + inputDiff, output + outputDiff, connectionStatus.getSourceName(), connectionStatus.getName(), connectionStatus.getDestinationName(), input, output,
connectionStatusDto.setSourceName(connectionStatus.getSourceName()); connectionStatusDto.setDestinationId(connectionStatus.getDestinationId()); connectionStatusDto.setDestinationName(connectionStatus.getDestinationName()); connectionStatusDto.setStatsLastRefreshed(new Date()); snapshot.setName(connectionStatus.getName()); snapshot.setSourceName(connectionStatus.getSourceName()); snapshot.setDestinationName(connectionStatus.getDestinationName());
private void serializeConnectionStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final ConnectionStatus status, final DateFormat df, final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate) { final JsonObjectBuilder builder = factory.createObjectBuilder(); final String componentType = "Connection"; final String componentName = status.getName(); if (componentMatchesFilters(componentType, componentName)) { addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate, componentType, componentName); addField(builder, "componentId", status.getId()); addField(builder, "sourceId", status.getSourceId()); addField(builder, "sourceName", status.getSourceName()); addField(builder, "destinationId", status.getDestinationId()); addField(builder, "destinationName", status.getDestinationName()); addField(builder, "maxQueuedBytes", status.getMaxQueuedBytes()); addField(builder, "maxQueuedCount", status.getMaxQueuedCount()); addField(builder, "queuedBytes", status.getQueuedBytes()); addField(builder, "queuedCount", status.getQueuedCount()); addField(builder, "inputBytes", status.getInputBytes()); addField(builder, "inputCount", status.getInputCount()); addField(builder, "outputBytes", status.getOutputBytes()); addField(builder, "outputCount", status.getOutputCount()); addField(builder, "backPressureBytesThreshold", status.getBackPressureBytesThreshold()); addField(builder, "backPressureObjectThreshold", status.getBackPressureObjectThreshold()); addField(builder, "isBackPressureEnabled", Boolean.toString((status.getBackPressureObjectThreshold() > 0 && status.getBackPressureObjectThreshold() <= status.getQueuedCount()) || (status.getBackPressureBytesThreshold() > 0 && status.getBackPressureBytesThreshold() <= status.getMaxQueuedBytes()))); arrayBuilder.add(builder.build()); } }
@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); }
private void serializeConnectionStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final ConnectionStatus status, final DateFormat df, final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate) { final JsonObjectBuilder builder = factory.createObjectBuilder(); final String componentType = "Connection"; final String componentName = status.getName(); if (componentMatchesFilters(componentType, componentName)) { addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate, componentType, componentName); addField(builder, "componentId", status.getId()); addField(builder, "sourceId", status.getSourceId()); addField(builder, "sourceName", status.getSourceName()); addField(builder, "destinationId", status.getDestinationId()); addField(builder, "destinationName", status.getDestinationName()); addField(builder, "maxQueuedBytes", status.getMaxQueuedBytes()); addField(builder, "maxQueuedCount", status.getMaxQueuedCount()); addField(builder, "queuedBytes", status.getQueuedBytes()); addField(builder, "queuedCount", status.getQueuedCount()); addField(builder, "inputBytes", status.getInputBytes()); addField(builder, "inputCount", status.getInputCount()); addField(builder, "outputBytes", status.getOutputBytes()); addField(builder, "outputCount", status.getOutputCount()); addField(builder, "backPressureBytesThreshold", status.getBackPressureBytesThreshold()); addField(builder, "backPressureObjectThreshold", status.getBackPressureObjectThreshold()); addField(builder, "isBackPressureEnabled", Boolean.toString((status.getBackPressureObjectThreshold() > 0 && status.getBackPressureObjectThreshold() <= status.getQueuedCount()) || (status.getBackPressureBytesThreshold() > 0 && status.getBackPressureBytesThreshold() <= status.getMaxQueuedBytes()))); arrayBuilder.add(builder.build()); } }