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 @@ default void commitAsync(Runnable onSuccess) { */ 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 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 @@ default void recordGauge(String name, double value, CommitTiming commitTiming) { } + /** + * 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 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}.