@@ -394,16 +394,13 @@ private void recordPredictMetrics(
394394 if (model != null ) {
395395 if (model .getConnector () == null && model .getConnectorId () != null ) {
396396 mlModelManager .getConnector (model .getConnectorId (), model .getTenantId (), ActionListener .wrap (connector -> {
397- MLOperationalMetricsCounter .getInstance ().incrementCounter (
398- OperationalMetric .MODEL_PREDICT_COUNT ,
399- model .getTags (connector )
400- );
397+ MLOperationalMetricsCounter
398+ .getInstance ()
399+ .incrementCounter (OperationalMetric .MODEL_PREDICT_COUNT , model .getTags (connector ));
401400
402- MLOperationalMetricsCounter .getInstance ().recordHistogram (
403- OperationalMetric .MODEL_PREDICT_LATENCY ,
404- durationInMs ,
405- model .getTags (connector )
406- );
401+ MLOperationalMetricsCounter
402+ .getInstance ()
403+ .recordHistogram (OperationalMetric .MODEL_PREDICT_LATENCY , durationInMs , model .getTags (connector ));
407404
408405 internalListener .onResponse (output );
409406 }, e -> {
@@ -413,15 +410,10 @@ private void recordPredictMetrics(
413410 return ;
414411 }
415412
416- MLOperationalMetricsCounter .getInstance ().incrementCounter (
417- OperationalMetric .MODEL_PREDICT_COUNT ,
418- model .getTags ()
419- );
420- MLOperationalMetricsCounter .getInstance ().recordHistogram (
421- OperationalMetric .MODEL_PREDICT_LATENCY ,
422- durationInMs ,
423- model .getTags ()
424- );
413+ MLOperationalMetricsCounter .getInstance ().incrementCounter (OperationalMetric .MODEL_PREDICT_COUNT , model .getTags ());
414+ MLOperationalMetricsCounter
415+ .getInstance ()
416+ .recordHistogram (OperationalMetric .MODEL_PREDICT_LATENCY , durationInMs , model .getTags ());
425417
426418 internalListener .onResponse (output );
427419 } else {
@@ -517,7 +509,8 @@ private void runPredict(
517509 predictor .asyncPredict (mlInput , trackPredictDurationListener ); // with listener
518510 } else {
519511 long startTime = System .nanoTime ();
520- MLOutput output = mlModelManager .trackPredictDuration (modelId , () -> predictor .predict (mlInput )); // without listener
512+ MLOutput output = mlModelManager .trackPredictDuration (modelId , () -> predictor .predict (mlInput )); // without
513+ // listener
521514 if (output instanceof MLPredictionOutput ) {
522515 ((MLPredictionOutput ) output ).setStatus (MLTaskState .COMPLETED .name ());
523516 }
0 commit comments