pvillard31 commented on code in PR #49:
URL: https://github.com/apache/nifi-api/pull/49#discussion_r2699454045


##########
src/main/java/org/apache/nifi/processor/ProcessSession.java:
##########
@@ -253,6 +253,17 @@ default void commitAsync(Runnable onSuccess) {
      */
     void adjustCounter(String name, long delta, boolean immediate);
 
+    /**
+     * Record measurement value for the named Gauge, registering the named 
Gauge when not present in the system.

Review Comment:
   Could be useful addition in the javadoc for developers not familiar with the 
terminology
   
   ```suggestion
       /**
        * Record measurement value for the named Gauge, registering the named 
Gauge when not present in the system.
        * Unlike counters which track cumulative values, gauges represent 
point-in-time measurements that can increase or decrease.
   ```



##########
src/main/java/org/apache/nifi/processor/ProcessSession.java:
##########
@@ -253,6 +253,17 @@ default void commitAsync(Runnable onSuccess) {
      */
     void adjustCounter(String name, long delta, boolean immediate);
 
+    /**
+     * Record measurement value for the named Gauge, registering the named 
Gauge when not present in the system.
+     *
+     * @param name Gauge name to update or register
+     * @param value Measurement value to record
+     * @param commitTiming Timing for when the measurement value should be 
committed
+     */
+    default void recordGauge(String name, double value, CommitTiming 
commitTiming) {

Review Comment:
   Would it make sense to also have a convenience method like
   
   ```java
   default void recordGauge(String name, double value) {
       recordGauge(name, value, CommitTiming.SESSION_COMMITTED);
   }
   ```



##########
src/main/java/org/apache/nifi/processor/CommitTiming.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processor;

Review Comment:
   Is it the best package location in case it should apply to other components 
in the future? Maybe `org.apache.nifi.metrics`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to