Skip to main content

Monitoring Statistics

Page Outline

GET/api/v1/models/{model_id}/monitoring/stats

The Monitoring Statistics endpoint returns aggregate telemetry and health statistics for a specific model over a defined time window. This comprehensive snapshot is optimized for populating high-level dashboard metrics, exposing critical indicators such as average data drift scores, data quality rates, and overall inference throughput.

[!TIP] For granular, time-series data points spanning these metrics, consider utilizing the Get Alert Rules and configuring dedicated webhooks for real-time anomaly detection rather than polling this endpoint continuously.

Authentication Requirements

This endpoint requires secure authorization via a Bearer token.

  • Header: Authorization: Bearer <Your-JWT-Token>
  • Permissions Required: The authenticated user must have model:read or organization:viewer access rights for the targeted model.

Path Parameters

ParameterTypeRequiredDescription
model_idstringYesThe unique identifier (mdl-xxx) of the model whose statistics you are retrieving.

Query Parameters

You can refine the statistical scope using the following query strings:

ParameterTypeDefaultDescription
periodstring7dThe historical aggregation window. Valid options: 1d (1 day), 7d (7 days), 30d (30 days), and 90d (90 days).
version_idstringLatest PromotedOptional filter to scope statistics to a specific model version (ver-xxx). By default, it aggregates stats for the currently active/promoted version.

Operational Behavior

When querying the monitoring statistics, the backend performs several aggregations:

  1. Drift Calculation: The avg_drift_score represents the mean Population Stability Index (PSI) calculated across all actively monitored features over the selected period.
  2. Data Quality Assessment: The data_quality_rate is a ratio reflecting the proportion of inference requests that successfully passed schema validation (i.e., no missing required fields or out-of-range numerical values).
  3. Throughput Metrics: The total_inferences represents the absolute count of prediction requests successfully processed by the inference endpoints within the time window.
  4. Latency Tracking: Evaluates inference speed, providing avg_latency_ms and the 99th percentile (p99_latency_ms).

Response

Upon success, the API responds with an HTTP 200 OK status, returning a MonitoringStats JSON object.

Example JSON Response

{
"model_id": "mdl-7f3a19bc92",
"period": "7d",
"version_id": "ver-001",
"total_inferences": 124870,
"avg_drift_score": 0.082,
"max_drift_score": 0.241,
"data_quality_rate": 0.974,
"active_alerts": 1,
"resolved_alerts": 2,
"avg_latency_ms": 18.4,
"p99_latency_ms": 52.1
}

Error Codes

Implement robust error handling for the following potential failure states:

CodeReasonResolution
400Bad RequestYou provided an invalid period or malformed version_id.
401UnauthorizedVerify your JWT token format and ensure it has not expired.
403ForbiddenEnsure the user has model:read permissions for the underlying model logic.
404Not FoundThe model_id does not exist or falls outside your organization's scope.
429Too Many RequestsRate limit exceeded. Standard basic backoff procedures apply.