Greetings! I believe I came across a bug that may have snuck through the cracks. Benjamin Charron originally reported this issue in the Summer of 2020 in the following ticket NIFI-7616<https://issues.apache.org/jira/browse/NIFI-7616>. The suggestion was to replace the status.getActiveThreadCount() call with processorStatus.getActiveThreadCount() in order to have the component’s thread count accurately reported instead of the process group’s thread count. At the moment the call remains unchanged in PrometheusMetricsUtil.java<https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-extension-utils/nifi-prometheus-utils/src/main/java/org/apache/nifi/prometheus/util/PrometheusMetricsUtil.java#L173> at both lines 173<https://github.com/apache/nifi/blob/2b330d9feea82764721e6190f7320d49c73986b0/nifi-nar-bundles/nifi-extension-utils/nifi-prometheus-utils/src/main/java/org/apache/nifi/prometheus/util/PrometheusMetricsUtil.java#L173> and 175<https://github.com/apache/nifi/blob/2b330d9feea82764721e6190f7320d49c73986b0/nifi-nar-bundles/nifi-extension-utils/nifi-prometheus-utils/src/main/java/org/apache/nifi/prometheus/util/PrometheusMetricsUtil.java#L175>. NIFI-7616<https://issues.apache.org/jira/browse/NIFI-7616> as closed as a duplicate for NiFi-7796<https://issues.apache.org/jira/browse/NIFI-7796> but it appears Benjamin Charron’s diff was not merged in.
I originally observed this erroneous behavior with Prometheus when a component configured with a low number of concurrent tasks was reporting a high active thread count for hours. After combing through PrometheusMetricsUtil.java<https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-extension-utils/nifi-prometheus-utils/src/main/java/org/apache/nifi/prometheus/util/PrometheusMetricsUtil.java#L173> and isolating that specific component into its own process group with local input and output ports, the current number of active threads was then reported to Prometheus. Robert Agbozo Senior Security Operations Engineer Sony Interactive Entertainment