Metrics#

Introduction#

This document describes how to use metrics endpoint in the OpenVINO Model Server. They can be applied for:

  • Providing performance and utilization statistics for monitoring and benchmarking purposes

  • Auto scaling of the model server instances in Kubernetes and OpenShift based on application related metrics

Built-in metrics allow tracking the performance without any extra logic on the client side or using network traffic monitoring tools like load balancers or reverse-proxies.

It also exposes metrics which are not related to the network traffic.

For example, statistics of the inference execution queue, model runtime parameters etc. They can also track the usage based on model version, API type or requested endpoint methods.

OpenVINO Model Server metrics are compatible with Prometheus standard

They are exposed on the /metrics endpoint.

Available metrics families#

Metrics from default list are enabled with the metrics_enable flag or json configuration.

However, you can enable also additional metrics by listing all the metrics you want to enable in the metric_list flag or json configuration.

Default metrics

Type

Name

Labels

Description

gauge

ovms_streams

name,version

Number of OpenVINO execution streams.

gauge

ovms_current_requests

name,version

Number of requests being currently processed by the model server.

gauge

ovms_current_graphs

name

Number of MediaPipe graphs in process.

gauge

ovms_graph_loaded

name

Whether MediaPipe graph resources are loaded (1) or idle-unloaded (0).

counter

ovms_requests_success

api,interface,method,name,version

Number of successful requests to a model or a DAG.

counter

ovms_requests_fail

api,interface,method,name,version

Number of failed requests to a model or a DAG.

counter

ovms_requests_accepted

api,interface,method,name

Number of accepted requests which ended up inserting packet(s) into a MediaPipe graph.

counter

ovms_requests_rejected

api,interface,method,name

Number of rejected which failed at MediaPipe packet creation step.

counter

ovms_responses

api,interface,method,name

Number of responses generated by the MediaPipe graph.

histogram

ovms_request_time_us

interface,name,version

Processing time of requests to a model or a DAG.

histogram

ovms_inference_time_us

name,version

Inference execution time in the OpenVINO backend.

histogram

ovms_wait_for_infer_req_time_us

name,version

Request waiting time in the scheduling queue. Indicates how long the request has to wait before required resources are assigned to it.

Optional metrics

Type

Name

Labels

Description

gauge

ovms_infer_req_queue_size

name,version

Inference request queue size (nireq).

gauge

ovms_infer_req_active

name,version

Number of currently consumed inference requests from the processing queue that are now either in the data loading or inference process.

gauge

ovms_kv_cache_utilization_percent

name,node

GenAI-reported cache utilization (0-100) for a continuous-batching LLM or VLM pipeline.

gauge

ovms_kv_cache_size_bytes

name,node

GenAI-reported KV-cache size in bytes for a continuous-batching LLM or VLM pipeline.

counter

ovms_llm_prompt_tokens_total

name,node

Input prompt tokens from successfully completed continuous-batching LLM/VLM requests, as reported by GenAI.

counter

ovms_llm_generated_tokens_total

name,node

Generated output tokens from successfully completed continuous-batching LLM/VLM requests; excludes partial output from failed or cancelled requests.

gauge

ovms_llm_scheduled_requests

name,node

Number of requests scheduled in the last continuous-batching generation step; set to zero when the executor becomes idle.

histogram

ovms_llm_ttft_milliseconds

name,node

GenAI time to first token in milliseconds for successfully completed continuous-batching LLM/VLM requests, excluding VLM embedding preparation.

histogram

ovms_llm_tpot_milliseconds

name,node

GenAI time per output token in milliseconds for successfully completed continuous-batching LLM/VLM requests.

Note: While ovms_current_requests and ovms_infer_req_active both indicate how much resources are engaged in the requests processing, they are quite distinct. A request is counted in ovms_current_requests metric starting as soon as it’s received by the server and stays there until the response is sent back to the user. The ovms_infer_req_active counter informs about the number of OpenVINO Infer Requests that are bound to user requests and are either loading the data or already running inference.

Labels description

Name

Values

Description

api

KServe, TensorFlowServing, V3

Name of the serving API.

interface

REST, gRPC

Name of the serving interface.

method

ModelMetadata, ModelReady, ModelInfer, Predict, GetModelStatus, GetModelMetadata, Unary, Stream

Interface methods.

version

1, 2, …, n

Model version. Note that GetModelStatus and ModelReady and all MediaPipe servables do not have the version label.

name

As defined in model server config

Model name, DAG name or MediaPipe graph name.

node

As defined in the graph configuration

LLM calculator node name; distinguishes independent pipelines within a graph.

LLM-specific metrics#

The currently supported GenAI metric families are optional and supported for continuous-batching language and vision-language models, not legacy/NPU or Omni pipelines. Use the all_llm preset in the metrics list to enable all seven, or list individual families:

ovms --config_path /models/config.json --rest_port 8000 --metrics_enable --metrics_list all_llm
curl http://localhost:8000/metrics

The preset can also be used in monitoring.metrics.metrics_list in the configuration file. An explicit list selects only the listed families; include other metric names if you also need the default serving metrics. The preset includes only currently supported LLM metric families; it does not enable proposed or future LLM metrics automatically.

The scheduled-request gauge is refreshed after every generation step. Cache utilization and cache-size gauges are refreshed every 10 generation steps and when the executor becomes idle, before waiting for new requests. Scrapes return the latest published values; cache changes between updates may not be visible.

Cache utilization is GenAI’s maximum utilization percentage across registered cache types, not total device-memory utilization. Its denominator can change with dynamic cache allocation. While a pipeline is waiting for new requests, cache gauges retain their latest values; waiting does not imply an empty cache or zero utilization. KV-cache size is reported in bytes and can also change with dynamic allocation; it is not total device memory.

LLM metric series lifecycle#

LLM metric series are identified by the graph and node name and are owned by the metric registry, which keeps them until the server stops. Graph unload, idle-unload and reload do not remove or reset them: the reloaded pipeline continues the same series, so token counters and timing histograms keep accumulating. A request that completes on the previous pipeline after a reload is counted in the same series. Counters reset only on server restart; Prometheus handles that in rate() and increase().

The cache utilization, cache size and scheduled-request gauges describe the running pipeline. OVMS sets them to 0 when the pipeline stops, so an unloaded graph does not keep exporting its last values. After a reload the previous pipeline can stay alive until its requests finish; only the newest pipeline of a graph node updates these gauges, so the previous one cannot overwrite or reset the values of its replacement.

Prompt and generated-token counters increase once per successfully completed request, for both unary and streaming responses. Failed and cancelled requests are excluded. Since counters update at completion, their rates do not include tokens from requests still in progress. For example, aggregate prompt and generated-token rates over five minutes are:

sum by (name, node) (rate(ovms_llm_prompt_tokens_total[5m]))
sum by (name, node) (rate(ovms_llm_generated_tokens_total[5m]))

Streaming requests are recorded once, at final response, not once per chunk.

TTFT and TPOT are GenAI request timings, not HTTP end-to-end latency. For VLMs, TTFT excludes embedding preparation. The histograms export _bucket, _sum, and _count series. Their finite bucket boundaries, in milliseconds, are 1, 5, 10, 20, 40, 60, 80, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000, 20000, 40000, 80000, 160000, 640000 for TTFT, and 10, 20, 40, 60, 80, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000, 20000, 40000, 80000 for TPOT. Only finite, strictly positive samples are observed; an invalid timing sample is skipped without discarding the request’s token counts or the other valid timing sample.

The scheduled-requests gauge reports GenAI’s count from the latest generation step. It is zero while the pipeline is waiting for new requests. It is not the waiting queue size or the total number of requests accepted by the server.

Enable metrics#

By default, the metrics feature is disabled.

Metrics endpoint is using the same port as the REST interface for running the model queries.

It is required to enable REST in the model server by setting the parameter –rest_port.

To enable default metrics set you need to specify the metrics_enable flag or json setting:

Option 1: CLI#

mkdir -p ${HOME}/models
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.bin -o ${HOME}/models/resnet50.bin
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.xml -o ${HOME}/models/resnet50.xml
docker run -d -u $(id -u) -v ${HOME}/models:/models -p 9000:9000 -p 8000:8000 openvino/model_server:latest \
      --model_name resnet --model_path /models/resnet50.xml \
      --mean "[123.675,116.28,103.53]" --scale "[58.395,57.12,57.375]" --layout "NHWC:NCHW" --port 9000 \
      --rest_port 8000 \
      --metrics_enable

Option 2: Configuration file#

mkdir -p workspace
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.bin -o workspace/resnet50.bin
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.xml -o workspace/resnet50.xml
echo '{
 "model_config_list": [
     {
        "config": {
             "name": "resnet",
             "base_path": "/workspace/resnet50.xml",
             "mean": "[123.675,116.28,103.53]",
             "scale": "[58.395,57.12,57.375]",
             "layout": "NHWC:NCHW"
        }
     }
 ],
 "monitoring":
     {
         "metrics":
         {
             "enable" : true
         }
     }
}' >> workspace/config.json

Start with configuration file#

docker run -d -u $(id -u) -v ${PWD}/workspace:/workspace -p 9000:9000 -p 8000:8000 openvino/model_server:latest \
       --config_path /workspace/config.json \
       --port 9000 --rest_port 8000

Change the default list of metrics#

You can enable from one up to all the metrics available at once.

To enable specific set of metrics you need to specify the metrics_list flag or json setting:

Option 1: CLI#

mkdir -p ${HOME}/models
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.bin -o ${HOME}/models/resnet50.bin
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.xml -o ${HOME}/models/resnet50.xml
docker run -d -u $(id -u) -v ${HOME}/models:/models -p 9000:9000 -p 8000:8000 openvino/model_server:latest \
      --model_name resnet --model_path /models/resnet50.xml \
      --mean "[123.675,116.28,103.53]" --scale "[58.395,57.12,57.375]" --layout "NHWC:NCHW" --port 9000 \
      --rest_port 8000 \
      --metrics_enable \
      --metrics_list ovms_requests_success,ovms_infer_req_queue_size

Option 2: Configuration file#

mkdir -p workspace
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.bin -o workspace/resnet50.bin
curl -L https://huggingface.co/OpenVINO/resnet50-int8-ov/resolve/main/resnet50.xml -o workspace/resnet50.xml
echo '{
 "model_config_list": [
     {
        "config": {
             "name": "resnet",
             "base_path": "/workspace/resnet50.xml",
             "mean": "[123.675,116.28,103.53]",
             "scale": "[58.395,57.12,57.375]",
             "layout": "NHWC:NCHW"
        }
     }
 ],
 "monitoring":
     {
         "metrics":
         {
             "enable" : true,
             "metrics_list": ["ovms_requests_success", "ovms_infer_req_queue_size"]
         }
     }
}' > workspace/config.json

Start with configuration file#

docker run -d -u $(id -u) -v ${PWD}/workspace:/workspace -p 9000:9000 -p 8000:8000 openvino/model_server:latest \
   --config_path /workspace/config.json \
   --port 9000 --rest_port 8000

Configuration file with all metrics enabled#

echo '{
 "model_config_list": [
     {
        "config": {
             "name": "resnet",
             "base_path": "/workspace/resnet50.xml"
        }
     }
 ],
 "monitoring":
     {
         "metrics":
         {
             "enable" : true,
             "metrics_list": 
                 [ "ovms_requests_success",
                 "ovms_requests_fail",
                 "ovms_requests_accepted",
                 "ovms_requests_rejected",
                 "ovms_responses",
                 "ovms_inference_time_us",
                 "ovms_wait_for_infer_req_time_us",
                 "ovms_request_time_us",
                 "ovms_current_requests",
                 "ovms_current_graphs",
                 "ovms_infer_req_active",
                 "ovms_streams",
                 "ovms_infer_req_queue_size"]
         }
     }
}' > workspace/config.json

Start with the configuration file above#

docker run -d -u $(id -u) -v ${PWD}/workspace:/workspace -p 9000:9000 -p 8000:8000 openvino/model_server:latest \
   --config_path /workspace/config.json \
   --port 9000 --rest_port 8000

Example response from metrics endpoint#

To use data from metrics endpoint you can use the curl command:

curl http://localhost:8000/metrics

Example metrics output

Performance considerations#

Collecting metrics has negligible performance overhead when used with models of average size and complexity. However when used with very lightweight, fast models which inference time is very short, the metric incrementation can take noticeable proportion of the processing time. Consider it while enabling metrics for such models.

Metrics implementation for MediaPipe Graphs#

For MediaPipe Graphs execution there are 6 generic metrics which apply to all graphs:

Type

Name

Description

counter

ovms_requests_accepted

Counts number of requests which ended up pushing MediaPipe packet down the graph stream. For example image frame in vision use cases, LLM prompt in text generation use cases.

counter

ovms_requests_rejected

Counts errors in MediaPipe packet creation phase. For example bad image format in vision use cases. Please note that for V3 API, the LLM request is validated at graph node level meaning that packet creation always succeeds. Please refer to specific graph definition and implementation.

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

Tracks duration of successfully started mediapipe graphs in us. It can represent pipeline processing time for unary calls or the session length for streamed requests.

histogram

ovms_graph_request_latency_us

Difference between MediaPipe packet timestamps at the time of creation (request receival) and when the packet generation has concluded (full or partial response). Server automatically timestamps the incoming packets and is used as a source of truth for receival time, unless client opts-in to manual timestamping (NOTE: manual timestamping causes the metric results to become invalid).

Custom metrics in C++ calculators#

OVMS supports custom counters, gauges, and histograms in C++ MediaPipe calculators. These metrics are exposed on the existing /metrics endpoint with graph and calculator-node labels. For setup instructions, API usage, naming rules, and lifecycle details, see the custom metrics guide.

Visualize with Grafana#

With server metrics being scraped by Prometheus it is possible to integrate Grafana to visualize them on the dashboards. Once you have Grafana configured with Prometheus as a data source, you can create your own dashboard or import one.

In OpenVINO Model Server repository you can find grafana_dashboard.json file that can be used to visualize per model metrics like:

  • Throughput [RPS] - number of requests being processed by the model per second.

  • Mean Latency [ms] - latency averaged across all requests processed by the model in a certain timeframe.

  • Latency Quantile [ms] - value of latency for quantiles [0.75, 0.90, 0.99], meaning the latency that has NOT been exceeded by 75%, 90% and 99% of the requests.

  • Latency Distribution [%] - distribution of the latencies across the buckets.

  • Mean Inference Time [ms] - time of inference execution, averaged across all requests processed by the model in a certain timeframe.

  • Mean Time of Request Waiting For Inference [ms] - time of a request waiting for the inference execution, averaged across all requests processed by the model in a certain timeframe.

  • Currently Processed Requests - Number of requests being currently processed by the model server.

The dashboard works with three variables: model_name, model_version and interface that determine the model instance and interface (gRPC or REST) of interest. The interface value is ignored for panels with: Mean Inference Time, Mean Time of Request Waiting For Inference, Currently Processed Requests as they concern only backend performance and are interface agnostic.

Service Performance Metrics Backend Performance Metrics