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

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


The following commit(s) were added to refs/heads/main by this push:
     new 362bc54  NIFI-16307 Added Attributes to Counter and Gauge Session 
Methods (#107)
362bc54 is described below

commit 362bc54ea3f8d32a42a1ba26dfedf63d7b386f5a
Author: David Handermann <[email protected]>
AuthorDate: Mon Sep 7 09:03:11 2026 -0500

    NIFI-16307 Added Attributes to Counter and Gauge Session Methods (#107)
---
 .../org/apache/nifi/processor/ProcessSession.java  | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/main/java/org/apache/nifi/processor/ProcessSession.java 
b/src/main/java/org/apache/nifi/processor/ProcessSession.java
index 2f4b630..b239058 100644
--- a/src/main/java/org/apache/nifi/processor/ProcessSession.java
+++ b/src/main/java/org/apache/nifi/processor/ProcessSession.java
@@ -255,6 +255,20 @@ public interface ProcessSession {
      */
     void adjustCounter(String name, long delta, boolean immediate);
 
+    /**
+     * Adjust measurement value for the named Counter, registering the named 
Counter when not present in the system.
+     * The default implementation provides compatibility with earlier 
interface versions but ignores the attributes
+     *
+     * @param name Counter name to update or register
+     * @param delta Measure value delta to record
+     * @param attributes Map of keys and values associated with the Counter 
may be empty but not null
+     * @param commitTiming Timing for when the measurement value should be 
committed
+     */
+    default void adjustCounter(String name, long delta, Map<String, String> 
attributes, CommitTiming commitTiming) {
+        final boolean immediate = CommitTiming.NOW == commitTiming;
+        adjustCounter(name, delta, immediate);
+    }
+
     /**
      * Record measurement value for the named Gauge, registering the named 
Gauge when not present in the system.
      * Gauges represent a measurement at a point in time, unlike counters that 
track cumulative values.
@@ -267,6 +281,20 @@ public interface ProcessSession {
 
     }
 
+    /**
+     * Record measurement value for the named Gauge, registering the named 
Gauge when not present in the system.
+     * Gauges represent a measurement at a point in time, unlike counters that 
track cumulative values.
+     * The default implementation provides compatibility with earlier 
interface versions but ignores the attributes
+     *
+     * @param name Gauge name to update or register
+     * @param value Measurement value to record
+     * @param attributes Map of keys and values associated with the Gauge may 
be empty but not null
+     * @param commitTiming Timing for when the measurement value should be 
committed
+     */
+    default void recordGauge(String name, double value, Map<String, String> 
attributes, CommitTiming commitTiming) {
+        recordGauge(name, value, commitTiming);
+    }
+
     /**
      * Returns the {@link FlowFile} from the work queue that is next highest 
priority to process.
      * If no FlowFiles are available, returns {@code null}.

Reply via email to