From 1d21e3baf85ec622fd9d0fb9d3f18c27802a0978 Mon Sep 17 00:00:00 2001
From: Pierre Villard
+ The Site-to-Site Bulletin Reporting Task allows the user to publish Bulletin events using the Site To Site protocol. Note:
+ only up to 5 bulletins are stored per component and up to 10 bulletins at controller level for a duration of up to 5 minutes.
+ If this reporting task is not scheduled frequently enough some bulletins may not be sent.
+
+ The user can define a Record Writer and directly specify the output format and data with the assumption that the input schema
+ is the following:
+ Record writer
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteProvenanceReportingTask/additionalDetails.html b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteProvenanceReportingTask/additionalDetails.html
index 86736a6616..676674eb85 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteProvenanceReportingTask/additionalDetails.html
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteProvenanceReportingTask/additionalDetails.html
@@ -33,8 +33,8 @@
+{
+ "type" : "record",
+ "name" : "bulletins",
+ "namespace" : "bulletins",
+ "fields" : [
+ { "name" : "objectId", "type" : "string" },
+ { "name" : "platform", "type" : "string" },
+ { "name" : "bulletinId", "type" : "long" },
+ { "name" : "bulletinCategory", "type" : ["string", "null"] },
+ { "name" : "bulletinGroupId", "type" : ["string", "null"] },
+ { "name" : "bulletinGroupName", "type" : ["string", "null"] },
+ { "name" : "bulletinLevel", "type" : ["string", "null"] },
+ { "name" : "bulletinMessage", "type" : ["string", "null"] },
+ { "name" : "bulletinNodeAddress", "type" : ["string", "null"] },
+ { "name" : "bulletinNodeId", "type" : ["string", "null"] },
+ { "name" : "bulletinSourceId", "type" : ["string", "null"] },
+ { "name" : "bulletinSourceName", "type" : ["string", "null"] },
+ { "name" : "bulletinSourceType", "type" : ["string", "null"] },
+ { "name" : "bulletinTimestamp", "type" : ["string", "null"], "doc" : "Format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" }
+ ]
+}
+
+
- When published to a NiFi instance, the Provenance data is sent as a JSON array. Quite often, it can be useful to work with this data using - a schema. As such, the schema for this Provenance data can be defined as follows: + By default, when published to a NiFi instance, the Provenance data is sent as a JSON array. However, the user can define a Record Writer + and directly specify the output format and data with the assumption that the input schema is defined as follows:
@@ -53,6 +53,9 @@ { "name": "details", "type": "string" }, { "name": "componentId", "type": "string" }, { "name": "componentType", "type": "string" }, + { "name": "componentName", "type": "string" }, + { "name": "processGroupId", "type": "string" }, + { "name": "processGroupName", "type": "string" }, { "name": "entityId", "type": "string" }, { "name": "entityType", "type": "string" }, { "name": "entitySize", "type": ["null", "long"] }, @@ -66,6 +69,8 @@ { "name": "childIds", "type": { "type": "array", "items": "string" } }, { "name": "platform", "type": "string" }, { "name": "application", "type": "string" }, + { "name": "remoteIdentifier", "type": "string" }, + { "name": "alternateIdentifier", "type": "string" }, { "name": "transitUri", "type": ["null", "string"] } ] } diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html new file mode 100644 index 0000000000..2d0be38717 --- /dev/null +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html @@ -0,0 +1,122 @@ + + + + + +SiteToSiteStatusReportingTask + + + + + ++ The Site-to-Site Status Reporting Task allows the user to publish 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. +
+ +Record writer
+ ++ The user can define a Record Writer and directly specify the output format and data with the assumption that the + input schema is the following: +
+ +++ + + \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-bulletins.avsc b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-bulletins.avsc new file mode 100644 index 0000000000..01b0f33ab2 --- /dev/null +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-bulletins.avsc @@ -0,0 +1,21 @@ +{ + "type" : "record", + "name" : "bulletins", + "namespace" : "bulletins", + "fields" : [ + { "name" : "objectId", "type" : "string" }, + { "name" : "platform", "type" : "string" }, + { "name" : "bulletinId", "type" : "long" }, + { "name" : "bulletinCategory", "type" : ["string", "null"] }, + { "name" : "bulletinGroupId", "type" : ["string", "null"] }, + { "name" : "bulletinGroupName", "type" : ["string", "null"] }, + { "name" : "bulletinLevel", "type" : ["string", "null"] }, + { "name" : "bulletinMessage", "type" : ["string", "null"] }, + { "name" : "bulletinNodeAddress", "type" : ["string", "null"] }, + { "name" : "bulletinNodeId", "type" : ["string", "null"] }, + { "name" : "bulletinSourceId", "type" : ["string", "null"] }, + { "name" : "bulletinSourceName", "type" : ["string", "null"] }, + { "name" : "bulletinSourceType", "type" : ["string", "null"] }, + { "name" : "bulletinTimestamp", "type" : ["string", "null"], "doc" : "Format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" } + ] +} diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-provenance.avsc b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-provenance.avsc new file mode 100644 index 0000000000..840bde607d --- /dev/null +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-provenance.avsc @@ -0,0 +1,35 @@ +{ + "namespace": "nifi", + "name": "provenanceEvent", + "type": "record", + "fields": [ + { "name": "eventId", "type": "string" }, + { "name": "eventOrdinal", "type": "long" }, + { "name": "eventType", "type": "string" }, + { "name": "timestampMillis", "type": "long" }, + { "name": "durationMillis", "type": "long" }, + { "name": "lineageStart", "type": { "type": "long", "logicalType": "timestamp-millis" } }, + { "name": "details", "type": "string" }, + { "name": "componentId", "type": "string" }, + { "name": "componentType", "type": "string" }, + { "name": "componentName", "type": "string" }, + { "name": "processGroupId", "type": "string" }, + { "name": "processGroupName", "type": "string" }, + { "name": "entityId", "type": "string" }, + { "name": "entityType", "type": "string" }, + { "name": "entitySize", "type": ["null", "long"] }, + { "name": "previousEntitySize", "type": ["null", "long"] }, + { "name": "updatedAttributes", "type": { "type": "map", "values": "string" } }, + { "name": "previousAttributes", "type": { "type": "map", "values": "string" } }, + { "name": "actorHostname", "type": "string" }, + { "name": "contentURI", "type": "string" }, + { "name": "previousContentURI", "type": "string" }, + { "name": "parentIds", "type": { "type": "array", "items": "string" } }, + { "name": "childIds", "type": { "type": "array", "items": "string" } }, + { "name": "platform", "type": "string" }, + { "name": "application", "type": "string" }, + { "name": "remoteIdentifier", "type": "string" }, + { "name": "alternateIdentifier", "type": "string" }, + { "name": "transitUri", "type": ["null", "string"] } + ] +} \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc new file mode 100644 index 0000000000..6f16d0e91f --- /dev/null +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc @@ -0,0 +1,78 @@ +{ + "type" : "record", + "name" : "status", + "namespace" : "status", + "fields" : [ + + // common fields for all components + { "name" : "statusId", "type" : "string"}, + { "name" : "timestampMillis", "type": { "type": "long", "logicalType": "timestamp-millis" } }, + { "name" : "timestamp", "type" : "string"}, + { "name" : "actorHostname", "type" : "string"}, + { "name" : "componentType", "type" : "string"}, + { "name" : "componentName", "type" : "string"}, + { "name" : "parentId", "type" : ["string", "null"]}, + { "name" : "platform", "type" : "string"}, + { "name" : "application", "type" : "string"}, + { "name" : "componentId", "type" : "string"}, + + // PG + RPG + Ports + Processors + { "name" : "activeThreadCount", "type" : ["long", "null"]}, + + // PG + Ports + Processors + { "name" : "flowFilesReceived", "type" : ["long", "null"]}, + { "name" : "flowFilesSent", "type" : ["long", "null"]}, + + // PG + Ports + Processors + { "name" : "bytesReceived", "type" : ["long", "null"]}, + { "name" : "bytesSent", "type" : ["long", "null"]}, + + // PG + Connections + { "name" : "queuedCount", "type" : ["long", "null"]}, + + // PG + Processors + { "name" : "bytesRead", "type" : ["long", "null"]}, + { "name" : "bytesWritten", "type" : ["long", "null"]}, + + // fields for process group status + { "name" : "bytesTransferred", "type" : ["long", "null"]}, + { "name" : "flowFilesTransferred", "type" : ["long", "null"]}, + { "name" : "inputContentSize", "type" : ["long", "null"]}, + { "name" : "outputContentSize", "type" : ["long", "null"]}, + { "name" : "queuedContentSize", "type" : ["long", "null"]}, + + // fields for remote process groups + { "name" : "activeRemotePortCount", "type" : ["long", "null"]}, + { "name" : "inactiveRemotePortCount", "type" : ["long", "null"]}, + { "name" : "receivedContentSize", "type" : ["long", "null"]}, + { "name" : "receivedCount", "type" : ["long", "null"]}, + { "name" : "sentContentSize", "type" : ["long", "null"]}, + { "name" : "sentCount", "type" : ["long", "null"]}, + { "name" : "averageLineageDuration", "type" : ["long", "null"]}, + + // fields for input/output ports + connections + PG + { "name" : "inputBytes", "type" : ["long", "null"]}, + { "name" : "inputCount", "type" : ["long", "null"]}, + { "name" : "outputBytes", "type" : ["long", "null"]}, + { "name" : "outputCount", "type" : ["long", "null"]}, + + // fields for connections + { "name" : "sourceId", "type" : ["string", "null"]}, + { "name" : "sourceName", "type" : ["string", "null"]}, + { "name" : "destinationId", "type" : ["string", "null"]}, + { "name" : "destinationName", "type" : ["string", "null"]}, + { "name" : "maxQueuedBytes", "type" : ["long", "null"]}, + { "name" : "maxQueuedCount", "type" : ["long", "null"]}, + { "name" : "queuedBytes", "type" : ["long", "null"]}, + { "name" : "backPressureBytesThreshold", "type" : ["long", "null"]}, + { "name" : "backPressureObjectThreshold", "type" : ["long", "null"]}, + { "name" : "isBackPressureEnabled", "type" : ["string", "null"]}, + + // fields for processors + { "name" : "processorType", "type" : ["string", "null"]}, + { "name" : "averageLineageDurationMS", "type" : ["long", "null"]}, + { "name" : "flowFilesRemoved", "type" : ["long", "null"]}, + { "name" : "invocations", "type" : ["long", "null"]}, + { "name" : "processingNanos", "type" : ["long", "null"]} + ] +} diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java index 6d70442a0b..4f6bd5f525 100644 --- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteBulletinReportingTask.java @@ -125,6 +125,10 @@ public class TestSiteToSiteBulletinReportingTask { private static final class MockSiteToSiteBulletinReportingTask extends SiteToSiteBulletinReportingTask { + public MockSiteToSiteBulletinReportingTask() throws IOException { + super(); + } + final List+{ + "type" : "record", + "name" : "status", + "namespace" : "status", + "fields" : [ + // common fields for all components + { "name" : "statusId", "type" : "string"}, + { "name" : "timestampMillis", "type": { "type": "long", "logicalType": "timestamp-millis" } }, + { "name" : "timestamp", "type" : "string"}, + { "name" : "actorHostname", "type" : "string"}, + { "name" : "componentType", "type" : "string"}, + { "name" : "componentName", "type" : "string"}, + { "name" : "parentId", "type" : ["string", "null"]}, + { "name" : "platform", "type" : "string"}, + { "name" : "application", "type" : "string"}, + { "name" : "componentId", "type" : "string"}, + + // PG + RPG + Ports + Processors + { "name" : "activeThreadCount", "type" : ["long", "null"]}, + + // PG + Ports + Processors + { "name" : "flowFilesReceived", "type" : ["long", "null"]}, + { "name" : "flowFilesSent", "type" : ["long", "null"]}, + + // PG + Ports + Processors + { "name" : "bytesReceived", "type" : ["long", "null"]}, + { "name" : "bytesSent", "type" : ["long", "null"]}, + + // PG + Connections + { "name" : "queuedCount", "type" : ["long", "null"]}, + + // PG + Processors + { "name" : "bytesRead", "type" : ["long", "null"]}, + { "name" : "bytesWritten", "type" : ["long", "null"]}, + + // fields for process group status + { "name" : "bytesTransferred", "type" : ["long", "null"]}, + { "name" : "flowFilesTransferred", "type" : ["long", "null"]}, + { "name" : "inputContentSize", "type" : ["long", "null"]}, + { "name" : "outputContentSize", "type" : ["long", "null"]}, + { "name" : "queuedContentSize", "type" : ["long", "null"]}, + + // fields for remote process groups + { "name" : "activeRemotePortCount", "type" : ["long", "null"]}, + { "name" : "inactiveRemotePortCount", "type" : ["long", "null"]}, + { "name" : "receivedContentSize", "type" : ["long", "null"]}, + { "name" : "receivedCount", "type" : ["long", "null"]}, + { "name" : "sentContentSize", "type" : ["long", "null"]}, + { "name" : "sentCount", "type" : ["long", "null"]}, + { "name" : "averageLineageDuration", "type" : ["long", "null"]}, + + // fields for input/output ports + connections + PG + { "name" : "inputBytes", "type" : ["long", "null"]}, + { "name" : "inputCount", "type" : ["long", "null"]}, + { "name" : "outputBytes", "type" : ["long", "null"]}, + { "name" : "outputCount", "type" : ["long", "null"]}, + + // fields for connections + { "name" : "sourceId", "type" : ["string", "null"]}, + { "name" : "sourceName", "type" : ["string", "null"]}, + { "name" : "destinationId", "type" : ["string", "null"]}, + { "name" : "destinationName", "type" : ["string", "null"]}, + { "name" : "maxQueuedBytes", "type" : ["long", "null"]}, + { "name" : "maxQueuedCount", "type" : ["long", "null"]}, + { "name" : "queuedBytes", "type" : ["long", "null"]}, + { "name" : "backPressureBytesThreshold", "type" : ["long", "null"]}, + { "name" : "backPressureObjectThreshold", "type" : ["long", "null"]}, + { "name" : "isBackPressureEnabled", "type" : ["string", "null"]}, + + // fields for processors + { "name" : "processorType", "type" : ["string", "null"]}, + { "name" : "averageLineageDurationMS", "type" : ["long", "null"]}, + { "name" : "flowFilesRemoved", "type" : ["long", "null"]}, + { "name" : "invocations", "type" : ["long", "null"]}, + { "name" : "processingNanos", "type" : ["long", "null"]} + ] +} +
+dataSent = new ArrayList<>(); @Override diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java index c699a1c883..e4f24cb6f6 100644 --- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteMetricsReportingTask.java @@ -17,7 +17,6 @@ package org.apache.nifi.reporting; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -53,7 +52,6 @@ import org.apache.nifi.serialization.RecordSetWriterFactory; import org.apache.nifi.serialization.record.MockRecordWriter; import org.apache.nifi.state.MockStateManager; import org.apache.nifi.util.MockPropertyValue; -import org.apache.nifi.util.TestRunner; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -65,7 +63,6 @@ public class TestSiteToSiteMetricsReportingTask { private ReportingContext context; private ProcessGroupStatus status; - private TestRunner runner; @Before public void setup() { diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java index 31054c2471..d39df59c9f 100644 --- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteProvenanceReportingTask.java @@ -604,6 +604,10 @@ public class TestSiteToSiteProvenanceReportingTask { private static final class MockSiteToSiteProvenanceReportingTask extends SiteToSiteProvenanceReportingTask { + public MockSiteToSiteProvenanceReportingTask() throws IOException { + super(); + } + final List dataSent = new ArrayList<>(); @Override diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java index 79ba213284..6fe795f537 100644 --- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java +++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java @@ -60,7 +60,7 @@ public class TestSiteToSiteStatusReportingTask { private ReportingContext context; public MockSiteToSiteStatusReportingTask initTask(Map customProperties, - ProcessGroupStatus pgStatus) throws InitializationException { + ProcessGroupStatus pgStatus) throws InitializationException, IOException { final MockSiteToSiteStatusReportingTask task = new MockSiteToSiteStatusReportingTask(); Map properties = new HashMap<>(); for (final PropertyDescriptor descriptor : task.getSupportedPropertyDescriptors()) { @@ -338,6 +338,10 @@ public class TestSiteToSiteStatusReportingTask { private static final class MockSiteToSiteStatusReportingTask extends SiteToSiteStatusReportingTask { + public MockSiteToSiteStatusReportingTask() throws IOException { + super(); + } + final List dataSent = new ArrayList<>(); @Override