featzhang commented on code in PR #27560:
URL: https://github.com/apache/flink/pull/27560#discussion_r2925654609


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/AsyncPredictFunction.java:
##########
@@ -30,22 +33,170 @@
  * A wrapper class of {@link AsyncTableFunction} for asynchronous model 
inference.
  *
  * <p>The output type of this table function is fixed as {@link RowData}.
+ *
+ * <p>This class provides built-in metrics for monitoring model inference 
performance, including:
+ *
+ * <ul>
+ *   <li>inference_requests: Total number of inference requests
+ *   <li>inference_requests_success: Number of successful inference requests
+ *   <li>inference_requests_failure: Number of failed inference requests
+ *   <li>inference_latency: Histogram of inference latency in milliseconds
+ *   <li>inference_rows_output: Total number of output rows from inference
+ * </ul>
  */
 @PublicEvolving
 public abstract class AsyncPredictFunction extends AsyncTableFunction<RowData> 
{
 
+    // ------------------------------------------------------------------------
+    // Metrics
+    // ------------------------------------------------------------------------
+
+    /** Counter for total inference requests. */
+    private transient Counter inferenceRequests;

Review Comment:
   Abstracted PredictFunctionMetrics: Extracted the duplicated metric 
    fields and logic from both PredictFunction and AsyncPredictFunction 
    into a new shared PredictFunctionMetrics class, as suggested.



-- 
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