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

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


The following commit(s) were added to refs/heads/main by this push:
     new 8cfef99ff5 NIFI-15595 Fixed Prometheus Metrics for Framework Build 
properties
8cfef99ff5 is described below

commit 8cfef99ff5db268814e9bed5eea11ad1c9ff870b
Author: exceptionfactory <[email protected]>
AuthorDate: Thu Feb 12 14:27:02 2026 -0600

    NIFI-15595 Fixed Prometheus Metrics for Framework Build properties
    
    Signed-off-by: Pierre Villard <[email protected]>
    
    This closes #10894.
---
 .../apache/nifi/prometheusutil/VersionInfoRegistry.java  | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
 
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
index 6ab14d9de1..92900f76f8 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/prometheusutil/VersionInfoRegistry.java
@@ -24,6 +24,8 @@ import org.apache.nifi.nar.NarClassLoadersHolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Objects;
+
 public class VersionInfoRegistry extends AbstractMetricsRegistry {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(VersionInfoRegistry.class);
     private static final String DEFAULT_LABEL_STRING = "unknown";
@@ -78,13 +80,15 @@ public class VersionInfoRegistry extends 
AbstractMetricsRegistry {
             final Bundle frameworkBundle = 
NarClassLoadersHolder.getInstance().getFrameworkBundle();
             if (frameworkBundle != null) {
                 final BundleDetails frameworkDetails = 
frameworkBundle.getBundleDetails();
-                frameworkVersion = 
frameworkDetails.getCoordinate().getVersion();
-                revision = frameworkDetails.getBuildRevision();
-                tag = frameworkDetails.getBuildTag();
-                buildBranch = frameworkDetails.getBuildBranch();
+                frameworkVersion = 
Objects.requireNonNullElse(frameworkDetails.getCoordinate().getVersion(), 
DEFAULT_LABEL_STRING);
+
+                // Handle null Build properties
+                revision = 
Objects.requireNonNullElse(frameworkDetails.getBuildRevision(), 
DEFAULT_LABEL_STRING);
+                tag = 
Objects.requireNonNullElse(frameworkDetails.getBuildTag(), 
DEFAULT_LABEL_STRING);
+                buildBranch = 
Objects.requireNonNullElse(frameworkDetails.getBuildBranch(), 
DEFAULT_LABEL_STRING);
             }
-        } catch (Exception e) {
-            LOGGER.debug("Could not retrieve NiFi bundle details for version 
info metric", e);
+        } catch (final Exception e) {
+            LOGGER.warn("Failed to get Framework Bundle for Version Details", 
e);
         }
         return new VersionDetails(frameworkVersion, revision, tag, 
buildBranch, javaVersion, javaVendor, osVersion, osName, osArchitecture);
     }

Reply via email to