This is an automated email from the ASF dual-hosted git repository.

mthomsen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8560eb9  NIFI-5435 Added Prometheus reporting task. NIFI-5435 Fixed 
Rebase Issue NIFI-5435 changes in capability description of reporting task 
NIFI-5435 Changes in capability description of reporting task NIFI-5435 Changes 
to build Property Descriptors in static constructor NIFI-5435 Indentation 
changes NIFI-5435 Test code changes NIFI-5435 Minor code changes NIFI-5435 
Changes related to client authentication NIFI-5435 Prometheus metrics changes 
NIFI-5435 Added process group name [...]
8560eb9 is described below

commit 8560eb995a94a157684b2ab753f1635f8335fea3
Author: Satwik <[email protected]>
AuthorDate: Tue Feb 26 07:19:13 2019 -0600

    NIFI-5435 Added Prometheus reporting task.
    NIFI-5435 Fixed Rebase Issue
    NIFI-5435 changes in capability description of reporting task
    NIFI-5435 Changes in capability description of reporting task
    NIFI-5435 Changes to build Property Descriptors in static constructor
    NIFI-5435 Indentation changes
    NIFI-5435 Test code changes
    NIFI-5435 Minor code changes
    NIFI-5435 Changes related to client authentication
    NIFI-5435 Prometheus metrics changes
    NIFI-5435 Added process group name and id to metrics
    
    This closes #3257
    
    Signed-off-by: Mike Thomsen <[email protected]>
---
 nifi-assembly/pom.xml                              |   6 +
 .../nifi-prometheus-nar/pom.xml                    |  36 ++++
 .../src/main/resources/META-INF/LICENSE            | 225 ++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE             |  71 +++++++
 .../nifi-prometheus-reporting-task/pom.xml         | 132 ++++++++++++
 .../prometheus/PrometheusReportingTask.java        | 169 +++++++++++++++
 .../reporting/prometheus/PrometheusServer.java     | 170 +++++++++++++++
 .../prometheus/api/PrometheusMetricsUtil.java      | 229 +++++++++++++++++++++
 .../org.apache.nifi.reporting.ReportingTask        |  16 ++
 .../PrometheusReportingTask/additionalDetails.html |  47 +++++
 .../prometheus/TestPrometheusReportingTask.java    | 111 ++++++++++
 nifi-nar-bundles/nifi-prometheus-bundle/pom.xml    |  36 ++++
 nifi-nar-bundles/pom.xml                           |   3 +-
 13 files changed, 1250 insertions(+), 1 deletion(-)

diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
index 7089b0e..5087dd6 100755
--- a/nifi-assembly/pom.xml
+++ b/nifi-assembly/pom.xml
@@ -381,6 +381,12 @@ language governing permissions and limitations under the 
License. -->
         </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-prometheus-nar</artifactId>
+            <version>1.10.0-SNAPSHOT</version>
+            <type>nar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-influxdb-nar</artifactId>
             <version>1.10.0-SNAPSHOT</version>
             <type>nar</type>
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/pom.xml 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/pom.xml
new file mode 100644
index 0000000..d039eca
--- /dev/null
+++ b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/pom.xml
@@ -0,0 +1,36 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <!--
+  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.
+-->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-prometheus-bundle</artifactId>
+        <version>1.10.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>nifi-prometheus-nar</artifactId>
+    <packaging>nar</packaging>
+    <properties>
+        <maven.javadoc.skip>true</maven.javadoc.skip>
+        <source.skip>true</source.skip>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-prometheus-reporting-task</artifactId>
+            <version>1.10.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/src/main/resources/META-INF/LICENSE
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..a421946
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,225 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2017 nifi
+
+   Licensed 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.
+   
+APACHE NIFI SUBCOMPONENTS:
+
+The Apache NiFi project contains subcomponents with separate copyright
+notices and license terms. Your use of the source code for the these
+subcomponents is subject to the terms and conditions of the following
+licenses.
+
+This product bundles 'jBCrypt' which is available under an MIT license.
+For details see https://github.com/svenkubiak/jBCrypt/blob/0.4.1/LICENSE
+
+    Copyright (c) 2006 Damien Miller <[email protected]>
+
+    Permission to use, copy, modify, and distribute this software for any
+    purpose with or without fee is hereby granted, provided that the above
+    copyright notice and this permission notice appear in all copies.
+
+    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/src/main/resources/META-INF/NOTICE
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..ec59289
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-nar/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,71 @@
+Copyright 2015-2017 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+******************
+Apache Software License v2
+******************
+
+The following binary components are provided under the Apache Software License 
v2
+
+  (ASLv2) Yammer Metrics
+    The following NOTICE information applies:
+      Metrics
+      Copyright 2010-2012 Coda Hale and Yammer, Inc.
+
+      This product includes software developed by Coda Hale and Yammer, Inc.
+
+      This product includes code derived from the JSR-166 project 
(ThreadLocalRandom), which was released
+      with the following comments:
+
+          Written by Doug Lea with assistance from members of JCP JSR-166
+          Expert Group and released to the public domain, as explained at
+          http://creativecommons.org/publicdomain/zero/1.0/
+
+  (ASLv2) Prometheus Simple Client libraries
+    Copyright 2012-2019 The Prometheus Authors
+
+  (ASLv2) Jetty
+    The following NOTICE information applies:
+       Jetty Web Container
+       Copyright 1995-2017 Mort Bay Consulting Pty Ltd.
+
+  (ASLv2) Apache Commons Codec
+      The following NOTICE information applies:
+        Apache Commons Codec
+        Copyright 2002-2014 The Apache Software Foundation
+
+        src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java
+        contains test data from http://aspell.net/test/orig/batch0.tab.
+        Copyright (C) 2002 Kevin Atkinson ([email protected])
+
+        
===============================================================================
+
+        The content of package org.apache.commons.codec.language.bm has been 
translated
+        from the original php source code available at 
http://stevemorse.org/phoneticinfo.htm
+        with permission from the original authors.
+        Original source copyright:
+        Copyright (c) 2008 Alexander Beider & Stephen P. Morse.
+
+    (ASLv2) Apache Commons Lang
+    The following NOTICE information applies:
+      Apache Commons Lang
+      Copyright 2001-2017 The Apache Software Foundation
+
+      This product includes software from the Spring Framework,
+      under the Apache License 2.0 (see: StringUtils.containsWhitespace())
+       
+
+************
+MIT
+************
+
+       This product optionally depends on 'Bouncy Castle Crypto APIs' to 
generate
+       a temporary self-signed X.509 certificate when the JVM does not provide 
the
+       equivalent functionality.  It can be obtained at:
+
+         * LICENSE:
+           * license/LICENSE.bouncycastle.txt (MIT License)
+         * HOMEPAGE:
+           * http://www.bouncycastle.org/
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml
new file mode 100644
index 0000000..55c9266
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/pom.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+xmlns="http://maven.apache.org/POM/4.0.0";
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+<!-- 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. -->
+<modelVersion>4.0.0</modelVersion>
+<parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-prometheus-bundle</artifactId>
+        <version>1.10.0-SNAPSHOT</version>
+</parent>
+<properties>
+        <prometheus.version>0.3.0</prometheus.version>
+        <yammer.metrics.version>2.2.0</yammer.metrics.version>
+        <jetty.version>9.3.8.v20160314</jetty.version>
+</properties>
+
+<artifactId>nifi-prometheus-reporting-task</artifactId>
+<description>Prometheus /metrics http endpoint for monitoring</description>
+
+<dependencies>
+        <dependency>
+                <groupId>com.yammer.metrics</groupId>
+                <artifactId>metrics-core</artifactId>
+                <version>${yammer.metrics.version}</version>
+        </dependency>
+        <dependency>
+                <groupId>org.apache.nifi</groupId>
+               <artifactId>nifi-api</artifactId>
+        </dependency>
+        <dependency>
+               <groupId>org.apache.nifi</groupId>
+               <artifactId>nifi-utils</artifactId>
+               <version>1.10.0-SNAPSHOT</version>
+        </dependency>
+        <!-- The client -->
+        <dependency>
+               <groupId>io.prometheus</groupId>
+               <artifactId>simpleclient</artifactId>
+               <version>${prometheus.version}</version>
+        </dependency>
+        <!-- Hotspot JVM metrics -->
+        <dependency>
+               <groupId>io.prometheus</groupId>
+               <artifactId>simpleclient_hotspot</artifactId>
+               <version>${prometheus.version}</version>
+        </dependency>
+        <!-- Exposition servlet -->
+       <dependency>
+                <groupId>io.prometheus</groupId>
+                <artifactId>simpleclient_servlet</artifactId>
+                <version>${prometheus.version}</version>
+        </dependency>
+        <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-mock</artifactId>
+                <version>1.10.0-SNAPSHOT</version>
+                <scope>test</scope>
+        </dependency>
+        <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-ssl-context-service</artifactId>
+                <version>1.10.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+                 <groupId>org.apache.nifi</groupId>
+                 <artifactId>nifi-security-utils</artifactId>
+                 <version>1.10.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-ssl-context-service-api</artifactId>
+                 <version>1.10.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-standard-services-api-nar</artifactId>
+                <version>1.10.0-SNAPSHOT</version>
+                <type>nar</type>
+        </dependency>
+        <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-continuation</artifactId>
+                <version>${jetty.version}</version>
+                <scope>test</scope>
+        </dependency>
+        <dependency>
+               <groupId>org.eclipse.jetty</groupId>
+               <artifactId>jetty-http</artifactId>
+               <version>${jetty.version}</version>
+               <scope>test</scope>
+        </dependency>
+
+
+        <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-servlet</artifactId>
+                <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+               <groupId>org.eclipse.jetty</groupId>
+               <artifactId>jetty-server</artifactId>
+               <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>javax.servlet-api</artifactId>
+                <scope>provided</scope>
+        </dependency>
+        <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-util</artifactId>
+                <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpclient</artifactId>
+                <version>4.5.3</version>
+                <scope>test</scope>
+        </dependency>
+
+</dependencies>
+</project>
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusReportingTask.java
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusReportingTask.java
new file mode 100644
index 0000000..daaddd3
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusReportingTask.java
@@ -0,0 +1,169 @@
+/*
+ * 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.prometheus;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.nifi.annotation.configuration.DefaultSchedule;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnShutdown;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.AllowableValue;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.expression.ExpressionLanguageScope;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.AbstractReportingTask;
+import org.apache.nifi.reporting.ReportingContext;
+import org.apache.nifi.scheduling.SchedulingStrategy;
+import org.apache.nifi.ssl.RestrictedSSLContextService;
+import org.apache.nifi.ssl.SSLContextService;
+import org.eclipse.jetty.server.Server;
+
+@Tags({ "reporting", "prometheus", "metrics", "time series data" })
+@CapabilityDescription("Reports metrics in Prometheus format by creating 
/metrics http endpoint which can be used for external monitoring of the 
application."
+        + " The reporting task reports a set of metrics regarding the JVM 
(optional) and the NiFi instance")
+@DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "60 sec")
+
+public class PrometheusReportingTask extends AbstractReportingTask {
+
+    private PrometheusServer prometheusServer;
+    private SSLContextService sslContextService;
+
+    public static final AllowableValue CLIENT_NONE = new AllowableValue("No 
Authentication", "No Authentication",
+            "ReportingTask will not authenticate clients. Anyone can 
communicate with this ReportingTask anonymously");
+    public static final AllowableValue CLIENT_WANT = new AllowableValue("Want 
Authentication", "Want Authentication",
+            "ReportingTask will try to verify the client but if unable to 
verify will allow the client to communicate anonymously");
+    public static final AllowableValue CLIENT_NEED = new AllowableValue("Need 
Authentication", "Need Authentication",
+            "ReportingTask will reject communications from any client unless 
the client provides a certificate that is trusted by the TrustStore"
+            + "specified in the SSL Context Service");
+
+    public static final PropertyDescriptor METRICS_ENDPOINT_PORT = new 
PropertyDescriptor.Builder()
+            .name("Prometheus Metrics Endpoint Port")
+            .description("The Port where prometheus metrics can be accessed")
+            .required(true)
+            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .defaultValue("9092")
+            .addValidator(StandardValidators.INTEGER_VALIDATOR)
+            .build();
+
+    public static final PropertyDescriptor INSTANCE_ID = new 
PropertyDescriptor.Builder()
+            .name("Instance ID")
+            .description("Id of this NiFi instance to be included in the 
metrics sent to Prometheus")
+            .required(true)
+            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .defaultValue("${hostname(true)}")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
+    public static final PropertyDescriptor SEND_JVM_METRICS = new 
PropertyDescriptor.Builder()
+            .name("Send JVM-metrics")
+            .description("Send JVM-metrics in addition to the Nifi-metrics")
+            .allowableValues("true", "false")
+            .defaultValue("false")
+            .required(true)
+            .build();
+
+    public static final PropertyDescriptor SSL_CONTEXT = new 
PropertyDescriptor.Builder()
+            .name("SSL Context Service")
+            .description("The SSL Context Service to use in order to secure 
the server. If specified, the server will"
+                    + "accept only HTTPS requests; otherwise, the server will 
accept only HTTP requests")
+            .required(false)
+            .identifiesControllerService(RestrictedSSLContextService.class)
+            .build();
+
+    public static final PropertyDescriptor CLIENT_AUTH = new 
PropertyDescriptor.Builder()
+            .name("Client Authentication")
+            .description("Specifies whether or not the Reporting Task should 
authenticate clients. This value is ignored if the <SSL Context Service> "
+                    + "Property is not specified or the SSL Context provided 
uses only a KeyStore and not a TrustStore.")
+            .required(true)
+            .allowableValues(CLIENT_NONE, CLIENT_WANT, CLIENT_NEED)
+            .defaultValue(CLIENT_NONE.getValue())
+            .build();
+
+    private static final List<PropertyDescriptor> properties;
+
+    static {
+        List<PropertyDescriptor> props = new ArrayList<>();
+        props.add(METRICS_ENDPOINT_PORT);
+        props.add(INSTANCE_ID);
+        props.add(SEND_JVM_METRICS);
+        props.add(SSL_CONTEXT);
+        props.add(CLIENT_AUTH);
+        properties = Collections.unmodifiableList(props);
+    }
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return properties;
+    }
+
+    @OnScheduled
+    public void onScheduled(final ConfigurationContext context) {
+        sslContextService = 
context.getProperty(SSL_CONTEXT).asControllerService(SSLContextService.class);
+        final String metricsEndpointPort = 
context.getProperty(METRICS_ENDPOINT_PORT).getValue();
+
+        try {
+            if (sslContextService == null) {
+                this.prometheusServer = new PrometheusServer(new 
InetSocketAddress(Integer.parseInt(metricsEndpointPort)), getLogger());
+            } else {
+                final String clientAuthValue = 
context.getProperty(CLIENT_AUTH).getValue();
+                final boolean need;
+                final boolean want;
+                if (CLIENT_NEED.equals(clientAuthValue)) {
+                    need = true;
+                    want = false;
+                } else if (CLIENT_WANT.equals(clientAuthValue)) {
+                    need = false;
+                    want = true;
+                } else {
+                    need = false;
+                    want = false;
+                }
+                this.prometheusServer = new 
PrometheusServer(Integer.parseInt(metricsEndpointPort),sslContextService, 
getLogger(), need, want);
+            }
+            
this.prometheusServer.setInstanceId(context.getProperty(INSTANCE_ID).evaluateAttributeExpressions().getValue());
+            
this.prometheusServer.setSendJvmMetrics(context.getProperty(SEND_JVM_METRICS).asBoolean());
+            getLogger().info("Started JETTY server");
+        } catch (Exception e) {
+            getLogger().error("Failed to start Jetty server", e);
+        }
+    }
+
+    @OnStopped
+    public void OnStopped() throws Exception {
+        Server server = this.prometheusServer.getServer();
+        server.stop();
+    }
+
+    @OnShutdown
+    public void onShutDown() throws Exception {
+        Server server = prometheusServer.getServer();
+        server.stop();
+    }
+
+    @Override
+    public void onTrigger(final ReportingContext context) {
+        this.prometheusServer.setReportingContext(context);
+    }
+}
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java
new file mode 100644
index 0000000..acaa447
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/PrometheusServer.java
@@ -0,0 +1,170 @@
+/*
+ * 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.prometheus;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.nifi.controller.status.ProcessGroupStatus;
+import org.apache.nifi.logging.ComponentLog;
+import org.apache.nifi.reporting.ReportingContext;
+import org.apache.nifi.reporting.prometheus.api.PrometheusMetricsUtil;
+import org.apache.nifi.ssl.SSLContextService;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+
+import com.yammer.metrics.core.VirtualMachineMetrics;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.exporter.common.TextFormat;
+
+public class PrometheusServer {
+    private static ComponentLog logger;
+    private Server server;
+    private ServletContextHandler handler;
+    private ReportingContext context;
+    private boolean sendJvmMetrics;
+    private String instanceId;
+
+    class MetricsServlet extends HttpServlet {
+        private CollectorRegistry nifiRegistry, jvmRegistry;
+        private ProcessGroupStatus rootGroupStatus;
+
+        @Override
+        protected void doGet(final HttpServletRequest req, final 
HttpServletResponse resp) throws ServletException, IOException {
+            if (logger.isDebugEnabled()) {
+                logger.debug("PrometheusServer Do get called");
+            }
+
+            rootGroupStatus = 
PrometheusServer.this.context.getEventAccess().getControllerStatus();
+            ServletOutputStream response = resp.getOutputStream();
+            OutputStreamWriter osw = new OutputStreamWriter(response);
+            nifiRegistry = 
PrometheusMetricsUtil.createNifiMetrics(rootGroupStatus, 
PrometheusServer.this.instanceId);
+            TextFormat.write004(osw, nifiRegistry.metricFamilySamples());
+
+            if (PrometheusServer.this.sendJvmMetrics == true) {
+                jvmRegistry = 
PrometheusMetricsUtil.createJvmMetrics(VirtualMachineMetrics.getInstance(), 
PrometheusServer.this.instanceId);
+                TextFormat.write004(osw, jvmRegistry.metricFamilySamples());
+            }
+
+            osw.flush();
+            osw.close();
+            response.flush();
+            response.close();
+            resp.setHeader("Content-Type", TextFormat.CONTENT_TYPE_004);
+            resp.setStatus(HttpURLConnection.HTTP_OK);
+            resp.flushBuffer();
+        }
+    }
+
+    public PrometheusServer(InetSocketAddress addr, ComponentLog logger) 
throws Exception {
+        PrometheusServer.logger = logger;
+        this.server = new Server(addr);
+
+        this.handler = new ServletContextHandler(server, "/metrics");
+        this.handler.addServlet(new ServletHolder(new MetricsServlet()), "/");
+        this.server.start();
+    }
+
+    public PrometheusServer(int addr, SSLContextService sslContextService, 
ComponentLog logger, boolean needClientAuth, boolean wantClientAuth) throws 
Exception {
+        PrometheusServer.logger = logger;
+        this.server = new Server();
+        this.handler = new ServletContextHandler(server, "/metrics");
+        this.handler.addServlet(new ServletHolder(new MetricsServlet()), "/");
+
+        SslContextFactory sslFactory = createSslFactory(sslContextService, 
needClientAuth, wantClientAuth);
+        HttpConfiguration httpsConfiguration = new HttpConfiguration();
+        httpsConfiguration.setSecureScheme("https");
+        httpsConfiguration.setSecurePort(addr);
+        httpsConfiguration.addCustomizer(new SecureRequestCustomizer());
+
+        ServerConnector https = new ServerConnector(server, new 
SslConnectionFactory(sslFactory, "http/1.1"),
+                new HttpConnectionFactory(httpsConfiguration));
+        https.setPort(addr);
+        this.server.setConnectors(new Connector[]{https});
+        this.server.start();
+
+    }
+
+    private SslContextFactory createSslFactory(final SSLContextService 
sslService, boolean needClientAuth, boolean wantClientAuth) {
+        SslContextFactory sslFactory = new SslContextFactory();
+
+        sslFactory.setNeedClientAuth(needClientAuth);
+        sslFactory.setWantClientAuth(wantClientAuth);
+        sslFactory.setProtocol(sslService.getSslAlgorithm());
+
+        if (sslService.isKeyStoreConfigured()) {
+            sslFactory.setKeyStorePath(sslService.getKeyStoreFile());
+            sslFactory.setKeyStorePassword(sslService.getKeyStorePassword());
+            sslFactory.setKeyStoreType(sslService.getKeyStoreType());
+        }
+
+        if (sslService.isTrustStoreConfigured()) {
+            sslFactory.setTrustStorePath(sslService.getTrustStoreFile());
+            
sslFactory.setTrustStorePassword(sslService.getTrustStorePassword());
+            sslFactory.setTrustStoreType(sslService.getTrustStoreType());
+        }
+
+        return sslFactory;
+    }
+
+    public Server getServer() {
+        return this.server;
+    }
+
+    public ReportingContext getReportingContext() {
+        return this.context;
+    }
+
+    public boolean getSendJvmMetrics() {
+        return this.sendJvmMetrics;
+    }
+
+    public String getInstanceId() {
+        return this.instanceId;
+    }
+
+    public void setReportingContext(ReportingContext rc) {
+        this.context = rc;
+    }
+
+    public void setSendJvmMetrics(boolean jvm) {
+        this.sendJvmMetrics = jvm;
+    }
+
+    public void setInstanceId(String iid) {
+        this.instanceId = iid;
+    }
+
+}
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/api/PrometheusMetricsUtil.java
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/api/PrometheusMetricsUtil.java
new file mode 100644
index 0000000..ebd0102
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/java/org/apache/nifi/reporting/prometheus/api/PrometheusMetricsUtil.java
@@ -0,0 +1,229 @@
+/*
+ * 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.prometheus.api;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.nifi.controller.status.ProcessGroupStatus;
+import org.apache.nifi.controller.status.ProcessorStatus;
+
+import com.yammer.metrics.core.VirtualMachineMetrics;
+
+import io.prometheus.client.CollectorRegistry;
+import io.prometheus.client.Gauge;
+
+public class PrometheusMetricsUtil {
+    private static final CollectorRegistry NIFI_REGISTRY = new 
CollectorRegistry();
+    private static final CollectorRegistry JVM_REGISTRY = new 
CollectorRegistry();
+
+    private static final Gauge AMOUNT_FLOWFILES_SENT = Gauge.build()
+            .name("nifi_process_group_amount_flowfiles_sent")
+            .help("Total number of FlowFiles in ProcessGroup sent")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_FLOWFILES_TRANSFERRED = Gauge.build()
+            .name("nifi_process_group_amount_flowfiles_transferred")
+            .help("Total number of FlowFiles in ProcessGroup transferred")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_FLOWFILES_RECEIVED = Gauge.build()
+            .name("nifi_process_group_amount_flowfiles_received")
+            .help("Total number of FlowFiles in ProcessGroup received")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_BYTES_SENT = Gauge.build()
+            .name("nifi_process_group_amount_bytes_sent")
+            .help("Total number of Bytes in ProcessGroup sent")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_BYTES_READ = Gauge.build()
+            .name("nifi_process_group_amount_bytes_read")
+            .help("Total number of Bytes in ProcessGroup read")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_BYTES_WRITTEN = Gauge.build()
+            .name("nifi_process_group_amount_bytes_written")
+            .help("Total number of Bytes in ProcessGroup written")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_BYTES_RECEIVED = Gauge.build()
+            .name("nifi_process_group_amount_bytes_received")
+            .help("Total number of Bytes in ProcessGroup received")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_BYTES_TRANSFERRED = Gauge.build()
+            .name("nifi_process_group_amount_bytes_transferred")
+            .help("Total number of Bytes in ProcessGroup transferred")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+
+    private static final Gauge AMOUNT_THREADS_TOTAL_ACTIVE = Gauge.build()
+            .name("nifi_process_group_amount_threads_active")
+            .help("Total number of threads in ProcessGroup active")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge SIZE_CONTENT_OUTPUT_TOTAL = Gauge.build()
+            .name("nifi_process_group_size_content_output_total")
+            .help("Total size of content output in ProcessGroup")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge SIZE_CONTENT_INPUT_TOTAL = Gauge.build()
+            .name("nifi_process_group_size_content_input_total")
+            .help("Total size of content input in ProcessGroup")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge SIZE_CONTENT_QUEUED_TOTAL = Gauge.build()
+            .name("nifi_process_group_size_content_queued_total")
+            .help("Total size of content queued in ProcessGroup")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_ITEMS_OUTPUT = Gauge.build()
+            .name("nifi_process_group_amount_items_output")
+            .help("Total amount of items in ProcessGroup output")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_ITEMS_INPUT = Gauge.build()
+            .name("nifi_process_group_amount_items_input")
+            .help("Total amount of items in ProcessGroup input")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge AMOUNT_ITEMS_QUEUED = Gauge.build()
+            .name("nifi_process_group_amount_items_queued")
+            .help("Total amount of items in ProcessGroup queued")
+            .labelNames("instance", "process_group_name", "process_group_id")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge PROCESSOR_COUNTERS = Gauge.build()
+            .name("nifi_processor_counters")
+            .help("Counters exposed by NiFi Processors")
+            .labelNames("processor_name", "counter_name", "processor_id", 
"instance")
+            .register(NIFI_REGISTRY);
+
+    private static final Gauge JVM_HEAP_USED = Gauge.build()
+            .name("nifi_jvm_heap_used")
+            .help("NiFi JVM heap used")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    private static final Gauge JVM_HEAP_USAGE = Gauge.build()
+            .name("nifi_jvm_heap_usage")
+            .help("NiFi JVM heap usage")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    private static final Gauge JVM_HEAP_NON_USAGE = Gauge.build()
+            .name("nifi_jvm_heap_non_usage")
+            .help("NiFi JVM heap non usage")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    private static final Gauge JVM_THREAD_COUNT = Gauge.build()
+            .name("nifi_jvm_thread_count")
+            .help("NiFi JVM thread count")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    private static final Gauge JVM_DAEMON_THREAD_COUNT = Gauge.build()
+            .name("nifi_jvm_daemon_thread_count")
+            .help("NiFi JVM daemon thread count")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    private static final Gauge JVM_UPTIME = Gauge.build()
+            .name("nifi_jvm_uptime")
+            .help("NiFi JVM uptime")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    private static final Gauge JVM_FILE_DESCRIPTOR_USAGE = Gauge.build()
+            .name("nifi_jvm_file_descriptor_usage")
+            .help("NiFi JVM file descriptor usage")
+            .labelNames("instance")
+            .register(JVM_REGISTRY);
+
+    public static CollectorRegistry createNifiMetrics(ProcessGroupStatus 
status, String instanceId) {
+
+        final String processGroupId = status.getId();
+        final String processGroupName = status.getName();
+        Collection<ProcessorStatus> processorStatus = 
status.getProcessorStatus();
+
+        AMOUNT_FLOWFILES_SENT.labels(instanceId, processGroupName, 
processGroupId).set(status.getFlowFilesSent());
+        AMOUNT_FLOWFILES_TRANSFERRED.labels(instanceId, processGroupName, 
processGroupId).set(status.getFlowFilesTransferred());
+        AMOUNT_FLOWFILES_RECEIVED.labels(instanceId, processGroupName, 
processGroupId).set(status.getFlowFilesReceived());
+
+        AMOUNT_BYTES_SENT.labels(instanceId, processGroupName, 
processGroupId).set(status.getBytesSent());
+        AMOUNT_BYTES_READ.labels(instanceId, processGroupName, 
processGroupId).set(status.getBytesRead());
+        AMOUNT_BYTES_WRITTEN.labels(instanceId, processGroupName, 
processGroupId).set(status.getBytesWritten());
+        AMOUNT_BYTES_RECEIVED.labels(instanceId, processGroupName, 
processGroupId).set(status.getBytesReceived());
+        AMOUNT_BYTES_TRANSFERRED.labels(instanceId, processGroupName, 
processGroupId).set(status.getBytesTransferred());
+
+        SIZE_CONTENT_OUTPUT_TOTAL.labels(instanceId, processGroupName, 
processGroupId).set(status.getOutputContentSize());
+        SIZE_CONTENT_INPUT_TOTAL.labels(instanceId, processGroupName, 
processGroupId).set(status.getInputContentSize());
+        SIZE_CONTENT_QUEUED_TOTAL.labels(instanceId, processGroupName, 
processGroupId).set(status.getQueuedContentSize());
+
+        AMOUNT_ITEMS_OUTPUT.labels(instanceId, processGroupName, 
processGroupId).set(status.getOutputCount());
+        AMOUNT_ITEMS_INPUT.labels(instanceId, processGroupName, 
processGroupId).set(status.getInputCount());
+        AMOUNT_ITEMS_QUEUED.labels(instanceId, processGroupName, 
processGroupId).set(status.getQueuedCount());
+
+
+
+        AMOUNT_THREADS_TOTAL_ACTIVE.labels(instanceId, processGroupName, 
processGroupId).set(status.getActiveThreadCount());
+
+        for (ProcessorStatus pstatus : processorStatus) {
+            Map<String, Long> counters = pstatus.getCounters();
+
+            if(counters != null) {
+                counters.entrySet().stream().forEach(entry -> 
PROCESSOR_COUNTERS
+                        .labels(pstatus.getName(), entry.getKey(), 
pstatus.getId(), instanceId).set(entry.getValue()));
+            }
+        }
+
+        return NIFI_REGISTRY;
+
+    }
+
+    public static CollectorRegistry createJvmMetrics(VirtualMachineMetrics 
jvmMetrics, String instanceId) {
+        JVM_HEAP_USED.labels(instanceId).set(jvmMetrics.heapUsed());
+        JVM_HEAP_USAGE.labels(instanceId).set(jvmMetrics.heapUsage());
+        JVM_HEAP_NON_USAGE.labels(instanceId).set(jvmMetrics.nonHeapUsage());
+
+        JVM_THREAD_COUNT.labels(instanceId).set(jvmMetrics.threadCount());
+        
JVM_DAEMON_THREAD_COUNT.labels(instanceId).set(jvmMetrics.daemonThreadCount());
+
+        JVM_UPTIME.labels(instanceId).set(jvmMetrics.uptime());
+        
JVM_FILE_DESCRIPTOR_USAGE.labels(instanceId).set(jvmMetrics.fileDescriptorUsage());
+
+        return JVM_REGISTRY;
+    }
+
+}
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/resources/META-INF/services/org.apache.nifi.reporting.ReportingTask
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/resources/META-INF/services/org.apache.nifi.reporting.ReportingTask
new file mode 100644
index 0000000..30bcc47
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/resources/META-INF/services/org.apache.nifi.reporting.ReportingTask
@@ -0,0 +1,16 @@
+# 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.
+
+org.apache.nifi.reporting.prometheus.PrometheusReportingTask
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/resources/docs/org/apache/nifi/reporting/prometheus/PrometheusReportingTask/additionalDetails.html
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/resources/docs/org/apache/nifi/reporting/prometheus/PrometheusReportingTask/additionalDetails.html
new file mode 100644
index 0000000..d97d00d
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/main/resources/docs/org/apache/nifi/reporting/prometheus/PrometheusReportingTask/additionalDetails.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html lang="en">
+<!--
+  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.
+-->
+<head>
+    <meta charset="utf-8"/>
+    <title>PrometheusReportingTask</title>
+    <link rel="stylesheet" href="../../../../../css/component-usage.css" 
type="text/css"/>
+</head>
+
+<body>
+<h2>PrometheusReportingTask</h2>
+
+<p>This ReportingTask sends the following metrics to Prometheus:</p>
+<ul>
+    <li>FlowFilesReceivedLast5Minutes</li>
+    <li>BytesReceivedLast5Minutes</li>
+    <li>FlowFilesSentLast5Minutes</li>
+    <li>BytesSentLast5Minutes</li>
+    <li>FlowFilesQueued</li>
+    <li>BytesQueued</li>
+    <li>BytesReadLast5Minutes</li>
+    <li>BytesWrittenLast5Minutes</li>
+    <li>ActiveThreads</li>
+    <li>TotalTaskDurationSeconds</li>
+    <li>jvm.heap_used</li>
+    <li>jvm.heap_usage</li>
+    <li>jvm.non_heap_usage</li>
+    <li>jvm.thread_count</li>
+    <li>jvm.daemon_thread_count</li>
+    <li>jvm.file_descriptor_usage</li>
+</ul>
+
+</body>
+</html>
diff --git 
a/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/test/java/org/apache/nifi/reporting/prometheus/TestPrometheusReportingTask.java
 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/test/java/org/apache/nifi/reporting/prometheus/TestPrometheusReportingTask.java
new file mode 100644
index 0000000..bba7a8b
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-prometheus-bundle/nifi-prometheus-reporting-task/src/test/java/org/apache/nifi/reporting/prometheus/TestPrometheusReportingTask.java
@@ -0,0 +1,111 @@
+/*
+ * 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.prometheus;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Collections;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.apache.nifi.controller.status.ProcessGroupStatus;
+import org.apache.nifi.reporting.InitializationException;
+import org.apache.nifi.state.MockStateManager;
+import org.apache.nifi.util.MockComponentLog;
+import org.apache.nifi.util.MockConfigurationContext;
+import org.apache.nifi.util.MockReportingContext;
+import org.apache.nifi.util.MockReportingInitializationContext;
+import org.apache.nifi.util.MockVariableRegistry;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestPrometheusReportingTask {
+    private static final String TEST_INIT_CONTEXT_ID = "test-init-context-id";
+    private static final String TEST_INIT_CONTEXT_NAME = 
"test-init-context-name";
+    private static final String TEST_TASK_ID = "test-task-id";
+    private MockReportingInitializationContext reportingInitContextStub;
+    private MockReportingContext reportingContextStub;
+    private MockConfigurationContext configurationContextStub; // new
+    private PrometheusReportingTask testedReportingTask;
+    private ProcessGroupStatus rootGroupStatus;
+
+    @Before
+    public void setup() {
+        testedReportingTask = new PrometheusReportingTask();
+        rootGroupStatus = new ProcessGroupStatus();
+        reportingInitContextStub = new 
MockReportingInitializationContext(TEST_INIT_CONTEXT_ID, TEST_INIT_CONTEXT_NAME,
+                new MockComponentLog(TEST_TASK_ID, testedReportingTask));
+
+        reportingContextStub = new MockReportingContext(Collections.emptyMap(),
+                new MockStateManager(testedReportingTask), new 
MockVariableRegistry());
+
+        
reportingContextStub.setProperty(PrometheusReportingTask.INSTANCE_ID.getName(), 
"localhost");
+
+        configurationContextStub = new 
MockConfigurationContext(reportingContextStub.getProperties(),
+                reportingContextStub.getControllerServiceLookup());
+
+        rootGroupStatus.setId("1234");
+        rootGroupStatus.setFlowFilesReceived(5);
+        rootGroupStatus.setBytesReceived(10000);
+        rootGroupStatus.setFlowFilesSent(10);
+        rootGroupStatus.setBytesSent(20000);
+        rootGroupStatus.setQueuedCount(100);
+        rootGroupStatus.setQueuedContentSize(1024L);
+        rootGroupStatus.setBytesRead(60000L);
+        rootGroupStatus.setBytesWritten(80000L);
+        rootGroupStatus.setActiveThreadCount(5);
+        rootGroupStatus.setName("root");
+        rootGroupStatus.setFlowFilesTransferred(5);
+        rootGroupStatus.setBytesTransferred(10000);
+        rootGroupStatus.setOutputContentSize(1000L);
+        rootGroupStatus.setInputContentSize(1000L);
+        rootGroupStatus.setOutputCount(100);
+        rootGroupStatus.setInputCount(1000);
+
+    }
+
+    @Test
+    public void testOnTrigger() throws IOException, InterruptedException, 
InitializationException {
+        testedReportingTask.initialize(reportingInitContextStub);
+        testedReportingTask.onScheduled(configurationContextStub);
+        
reportingContextStub.getEventAccess().setProcessGroupStatus(rootGroupStatus);
+        testedReportingTask.onTrigger(reportingContextStub);
+
+        URL url = new URL("http://localhost:9092/metrics";);
+        HttpURLConnection con = (HttpURLConnection) url.openConnection();
+        con.setRequestMethod("GET");
+        int status = con.getResponseCode();
+        Assert.assertEquals(HttpURLConnection.HTTP_OK, status);
+
+        HttpClient client = HttpClientBuilder.create().build();
+        HttpGet request = new HttpGet("http://localhost:9092/metrics";);
+        HttpResponse response = client.execute(request);
+        HttpEntity entity = response.getEntity();
+        String content = EntityUtils.toString(entity);
+        Assert.assertEquals(true, content.contains(
+                
"nifi_process_group_amount_flowfiles_received{instance=\"localhost\",process_group_name=\"root\",process_group_id=\"1234\",}
 5.0"));
+        Assert.assertEquals(true, content.contains(
+                
"nifi_process_group_amount_threads_active{instance=\"localhost\",process_group_name=\"root\",process_group_id=\"1234\",}
 5.0"));
+    }
+
+}
diff --git a/nifi-nar-bundles/nifi-prometheus-bundle/pom.xml 
b/nifi-nar-bundles/nifi-prometheus-bundle/pom.xml
new file mode 100644
index 0000000..97d19c6
--- /dev/null
+++ b/nifi-nar-bundles/nifi-prometheus-bundle/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <!--
+  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.
+-->
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-nar-bundles</artifactId>
+        <version>1.10.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>nifi-prometheus-bundle</artifactId>
+    <version>1.10.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>nifi-prometheus-reporting-task</module>
+        <module>nifi-prometheus-nar</module>
+    </modules>
+
+
+</project>
diff --git a/nifi-nar-bundles/pom.xml b/nifi-nar-bundles/pom.xml
index a8a4eb7..55e6d36 100755
--- a/nifi-nar-bundles/pom.xml
+++ b/nifi-nar-bundles/pom.xml
@@ -94,7 +94,8 @@
         <module>nifi-atlas-bundle</module>
         <module>nifi-druid-bundle</module>
         <module>nifi-jolt-record-bundle</module>
-               <module>nifi-network-bundle</module>
+       <module>nifi-network-bundle</module>
+        <module>nifi-prometheus-bundle</module>
   </modules>
 
     <build>

Reply via email to