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

exceptionfactory 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 916ccff  NIFI-16656: Added Counter and Gauge methods to 
ConnectorInitializationContext (#117)
916ccff is described below

commit 916ccfffff1611ef5410bb755ce2dcacf8f3be8d
Author: Mark Payne <[email protected]>
AuthorDate: Tue Dec 1 16:54:10 2026 -0500

    NIFI-16656: Added Counter and Gauge methods to 
ConnectorInitializationContext (#117)
    
    Co-authored-by: Cursor <[email protected]>
    Signed-off-by: David Handermann <[email protected]>
---
 .../connector/ConnectorInitializationContext.java  | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git 
a/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java
 
b/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java
index fa422b4..f3ae269 100644
--- 
a/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java
+++ 
b/src/main/java/org/apache/nifi/components/connector/ConnectorInitializationContext.java
@@ -21,6 +21,8 @@ import 
org.apache.nifi.components.connector.components.FlowContext;
 import org.apache.nifi.flow.VersionedExternalFlow;
 import org.apache.nifi.logging.ComponentLog;
 
+import java.util.Map;
+
 /**
  * <p>
  *     The ConnectorInitializationContext provides context about how the 
connector is being run.
@@ -111,4 +113,25 @@ public interface ConnectorInitializationContext {
      */
     void updateFlow(FlowContext flowContext, VersionedExternalFlow 
versionedExternalFlow, BundleCompatibility bundleCompatability) throws 
FlowUpdateException;
 
+    /**
+     * Adjusts the named Counter by the given amount, registering the Counter 
if it is not already present.
+     *
+     * @param name the name of the Counter
+     * @param delta the amount by which to change the Counter, which may be 
negative
+     * @param attributes keys and values associated with the Counter; may be 
empty but not null
+     */
+    default void adjustCounter(String name, long delta, Map<String, String> 
attributes) {
+    }
+
+    /**
+     * Records a measurement for the named Gauge, registering the Gauge if it 
is not already present.
+     * A Gauge represents a value at a point in time, unlike a Counter, which 
tracks a running total.
+     *
+     * @param name the name of the Gauge
+     * @param value the measurement to record
+     * @param attributes keys and values associated with the Gauge; may be 
empty but not null
+     */
+    default void recordGauge(String name, double value, Map<String, String> 
attributes) {
+    }
+
 }

Reply via email to