Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Tensorflow Serving ProcessModelStatusRequest

From Leeroopedia
Knowledge Sources
Domains Operations, Monitoring
Last Updated 2026-02-13 17:00 GMT

Overview

Concrete tool for handling model status and metadata HTTP requests, provided by the HttpRestApiHandler class.

Description

HttpRestApiHandler::ProcessModelStatusRequest() and ProcessModelMetadataRequest() handle GET requests to the model status and metadata REST endpoints. They:

  1. Parse model name, optional version, and optional label from the URL
  2. Delegate to GetModelStatusImpl or GetModelMetadataImpl using ServerCore
  3. Serialize the protobuf response to JSON using google::protobuf::util::MessageToJsonString()

URL routing is performed by ParseModelInfo() in http_rest_api_util.cc using a regex pattern: (?i)/v1/models(?:/([^/:]+))?(?:(?:/versions/(\d+))|(?:/labels/([^/:]+)))?(?:/(metadata))?

Usage

These endpoints are automatically available when the HTTP server is enabled. No special configuration is required beyond starting the server with --rest_api_port.

Code Reference

Source Location

  • Repository: tensorflow/serving
  • File: tensorflow_serving/model_servers/http_rest_api_handler.cc
  • Lines: L180-202 (ProcessModelStatusRequest), L204-226 (ProcessModelMetadataRequest)
  • URL Parsing: tensorflow_serving/model_servers/http_rest_api_util.cc L90-131

Signature

Status HttpRestApiHandler::ProcessModelStatusRequest(
    const absl::string_view model_name,
    const absl::optional<int64_t>& model_version,
    const absl::optional<absl::string_view>& model_version_label,
    string* output
);

Status HttpRestApiHandler::ProcessModelMetadataRequest(
    const absl::string_view model_name,
    const absl::optional<int64_t>& model_version,
    const absl::optional<absl::string_view>& model_version_label,
    string* output
);

Import

#include "tensorflow_serving/model_servers/http_rest_api_handler.h"

I/O Contract

Inputs

Name Type Required Description
model_name string_view Yes Name of the model
model_version optional<int64_t> No Specific version number
model_version_label optional<string_view> No Version label (e.g., "stable")

Outputs

Name Type Description
output string* JSON string with model status or metadata

Usage Examples

REST API Queries

# Get status of all versions
curl http://localhost:8501/v1/models/mnist

# Get status of specific version
curl http://localhost:8501/v1/models/mnist/versions/1

# Get status via label
curl http://localhost:8501/v1/models/mnist/labels/stable

# Get model metadata (signatures)
curl http://localhost:8501/v1/models/mnist/metadata

Example Response

{
  "model_version_status": [
    {
      "version": "1",
      "state": "AVAILABLE",
      "status": {
        "error_code": "OK"
      }
    }
  ]
}

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment