From 2455f222a03596d590cbf0827b5d100fd3a7a2d3 Mon Sep 17 00:00:00 2001 From: bstrzele Date: Fri, 10 Jan 2025 10:27:47 +0000 Subject: [PATCH] fix --- docs/metrics.md | 2 +- src/mediapipe_internal/mediapipegraphexecutor.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/metrics.md b/docs/metrics.md index 8a6e2b3b04..162501be8d 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -241,7 +241,7 @@ For [MediaPipe Graphs](./mediapipe.md) execution there are 4 generic metrics whi | counter | ovms_responses | Useful to track number of packets generated by MediaPipe graph. Keep in mind that single request may trigger production of multiple (or zero) packets, therefore tracking number of responses is complementary to tracking accepted requests. For example tracking streaming partial responses of LLM text generation graphs. | | gauge | ovms_current_graphs | Number of graphs currently in-process. For unary communication it is equal to number of currently processing requests (each request initializes separate MediaPipe graph). For streaming communication it is equal to number of active client connections. Each connection is able to reuse the graph and decide when to delete it when the connection is closed. | | counter | ovms_graph_error | Counts errors in MediaPipe graph execution phase. For example V3 LLM text generation fails in LLMCalculator due to missing prompt - calculator returns an error and graph cancels. | -| histogram | ovms_graph_processing_time_us | Time for which mediapipe graph was opened. | +| histogram | ovms_graph_processing_time_us | Time for which mediapipe graph was opened and been successfully closed. | Exposing custom metrics in calculator implementations (MediaPipe graph nodes) is not supported yet. diff --git a/src/mediapipe_internal/mediapipegraphexecutor.hpp b/src/mediapipe_internal/mediapipegraphexecutor.hpp index def898599e..e3466dc380 100644 --- a/src/mediapipe_internal/mediapipegraphexecutor.hpp +++ b/src/mediapipe_internal/mediapipegraphexecutor.hpp @@ -203,13 +203,13 @@ class MediapipeGraphExecutor { INCREMENT_IF_ENABLED(this->mediapipeServableMetricReporter->getGraphErrorMetric(executionContext)); } MP_RETURN_ON_FAIL(status, "graph wait until done", mediapipeAbslToOvmsStatus(status.code())); - timer.stop(PROCESS); - double processTime = timer.template elapsed(PROCESS); - OBSERVE_IF_ENABLED(this->mediapipeServableMetricReporter->getProcessingTimeMetric(executionContext), processTime); if (outputPollers.size() != outputPollersWithReceivedPacket.size()) { SPDLOG_DEBUG("Mediapipe failed to execute. Failed to receive all output packets"); return Status(StatusCode::MEDIAPIPE_EXECUTION_ERROR, "Unknown error during mediapipe execution"); } + timer.stop(PROCESS); + double processTime = timer.template elapsed(PROCESS); + OBSERVE_IF_ENABLED(this->mediapipeServableMetricReporter->getProcessingTimeMetric(executionContext), processTime); INCREMENT_IF_ENABLED(this->mediapipeServableMetricReporter->getResponsesMetric(executionContext)); SPDLOG_DEBUG("Received all output stream packets for graph: {}", this->name); return StatusCode::OK;