You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "abij (via GitHub)" <gi...@apache.org> on 2026/09/04 11:44:07 UTC

[PR] NIFI-16296 Remove connected_nodes label from cluster_connected_node_count [nifi]

abij opened a new pull request, #11623:
URL: https://github.com/apache/nifi/pull/11623

   ### Summary
   
   The Prometheus flow metrics endpoint (`/nifi-api/flow/metrics/prometheus`) exposes `cluster_connected_node_count` with a `connected_nodes` label containing a human-readable ratio string, e.g. `connected_nodes="3 / 4"`. Because `ClusterMetricsRegistry` is a long-lived singleton on `StandardNiFiServiceFacade` that is never cleared, and this label's value changes every time cluster membership changes, every distinct ratio the cluster has ever reported over the process's lifetime remains permanently exposed as a separate, frozen time series alongside the current one — e.g. a fully-connected 4-node cluster can still show a stale `connected_nodes="3 / 4"` series from an earlier transient disconnect, in addition to the correct `connected_nodes="4 / 4"` series. This makes the metric unreliable for dashboards/alerts without manually filtering out label combinations that can't be distinguished from current ones.
   
   This is the same class of bug fixed twice before in this file for other registries (NIFI-8272, NIFI-11899), both times by no longer using a churning/derived value as a metric label.
   
   ### What this PR does
   
   Removes `connected_nodes` from the gauge's label set entirely, since it's purely a cosmetic rendering of `connectedNodeCount`/`totalNodeCount`, both of which are already exposed numerically (`cluster_connected_node_count`'s own value, and the separate `cluster_total_node_count` gauge). This brings `CONNECTED_NODE_COUNT` in line with its sibling gauges in the same registry (`cluster_is_clustered`, `cluster_is_connected_to_cluster`, `cluster_total_node_count`), none of which carry a churning label.
   
   - `ClusterMetricsRegistry`: `.labelNames("instance", "connected_nodes")` → `.labelNames("instance")`
   - `PrometheusMetricsUtil#createClusterMetrics`: drop the now-unused `connectedNodes` parameter
   - `StandardNiFiServiceFacade#populateFlowMetrics`: drop the now-unused `connectedNodesLabel` string assembly
   - `TestFlowResource`: update the corresponding test fixture call
   
   No information is lost — clients relying on the ratio can compute it from the two existing numeric gauges instead. This is technically a breaking change to the metric's label surface for anyone rendering the `connected_nodes` label text directly (e.g. a Grafana table column), documented here for visibility.
   
   ### Tests
   
   - `./mvnw -pl nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api -am install` — build succeeds
   - `./mvnw -pl nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api test -Dtest=TestFlowResource` — 22/22 tests pass


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-16296 Remove connected_nodes label from cluster_connected_node_count [nifi]

Posted by "abij (via GitHub)" <gi...@apache.org>.
abij commented on PR #11623:
URL: https://github.com/apache/nifi/pull/11623#issuecomment-5541946737

   I guess the failed test: `OffloadIT.testOffload » Timeout testOffload() timed out after 10 minutes` is unrelated to the issue. Should I re-ran the test-suite?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-16296 Remove connected_nodes label from cluster_connected_node_count [nifi]

Posted by "pvillard31 (via GitHub)" <gi...@apache.org>.
pvillard31 merged PR #11623:
URL: https://github.com/apache/nifi/pull/11623


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org