[ https://issues.apache.org/jira/browse/NIFI-3674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15989165#comment-15989165 ]
ASF GitHub Bot commented on NIFI-3674: -------------------------------------- Github user bbende commented on a diff in the pull request: https://github.com/apache/nifi/pull/1660#discussion_r113976097 --- Diff: nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteStatusReportingTask.java --- @@ -0,0 +1,415 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.reporting; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.regex.Pattern; + +import javax.json.Json; +import javax.json.JsonArray; +import javax.json.JsonArrayBuilder; +import javax.json.JsonBuilderFactory; +import javax.json.JsonObjectBuilder; +import javax.json.JsonValue; + +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.controller.status.ConnectionStatus; +import org.apache.nifi.controller.status.PortStatus; +import org.apache.nifi.controller.status.ProcessGroupStatus; +import org.apache.nifi.controller.status.ProcessorStatus; +import org.apache.nifi.controller.status.RemoteProcessGroupStatus; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.remote.Transaction; +import org.apache.nifi.remote.TransferDirection; + +@Tags({"status", "metrics", "history", "site", "site to site"}) +@CapabilityDescription("Publishes Status events using the Site To Site protocol. " + + "The component type and name filter regexes form a union: only components matching both regexes will be reported. " + + "However, all process groups are recursively searched for matching components, regardless of whether the process group matches the component filters.") +public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTask { + + static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + + static final PropertyDescriptor PLATFORM = new PropertyDescriptor.Builder() + .name("Platform") + .description("The value to use for the platform field in each provenance event.") + .required(true) + .expressionLanguageSupported(true) + .defaultValue("nifi") + .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) + .build(); + static final PropertyDescriptor COMPONENT_TYPE_FILTER_REGEX = new PropertyDescriptor.Builder() + .name("Component Type Filter Regex") + .description("A regex specifying which component types to report. Any component type matching this regex will be included. " + + "Component types are: Processor, RootProcessGroup, ProcessGroup, RemoteProcessGroup, Connection, InputPort, OutputPort") + .required(true) + .expressionLanguageSupported(true) --- End diff -- It looks the code below doesn't evaluate expression language when getting the value, so we should either set this to false, or evaluate below. > Implement SiteToSiteStatusReportingTask > --------------------------------------- > > Key: NIFI-3674 > URL: https://issues.apache.org/jira/browse/NIFI-3674 > Project: Apache NiFi > Issue Type: Improvement > Components: Core Framework > Affects Versions: 1.1.1 > Reporter: Joseph Gresock > Assignee: Joseph Gresock > Priority: Minor > Labels: Site-to-Site, reporting_task, status > > I would like to see a reporting task similar to > SiteToSiteProvenanceReportingTask that sends controller status events using > JSON over S2S. Since the ProcessGroupStatus object structure is recursive, > ideally the JSON structure would be flat, with references to parentIds > embedded. > This would allow status history to be stored using any arbitrary mechanism. > Other interesting features would include: > * Properties to filter which components to include (Process Group, Processor, > Input/Output Ports, Remote Process Group, Connection) > * Properties to filter by regex which component names or ids to include in > the output -- This message was sent by Atlassian JIRA (v6.3.15#6346)