# Service health
URL: https://docs.datarobot.com/en/docs/api/reference/public-api/observability_service_health.html

> Use the endpoints described below to manage service health. Service health tracks metrics about a deployment's ability to respond to prediction requests quickly and reliably. This helps identify bottlenecks and assess capacity, which is critical to proper provisioning.

# Service health

Use the endpoints described below to manage service health. Service health tracks metrics about a deployment's ability to respond to prediction requests quickly and reliably. This helps identify bottlenecks and assess capacity, which is critical to proper provisioning.

## Retrieve service health metrics by deployment ID

Operation path: `GET /api/v2/deployments/{deploymentId}/batchServiceStats/`

Authentication requirements: `BearerAuth`

Retrieve all deployment service health metrics over a set of batches.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| executionTimeQuantile | query | number | false | Quantile for executionTime metric. |
| responseTimeQuantile | query | number | false | Quantile for responseTime metric. |
| slowRequestsThreshold | query | integer | false | Threshold for slowRequests metric. |
| segmentAttribute | query | string | false | The name of a segment attribute used for segment analysis. |
| segmentValue | query | string,null | false | The value of the segmentAttribute to segment on. |
| batchId | query | any | false | The id of the batch for which metrics are being retrieved. |
| modelId | query | string | false | The id of the model for which metrics are being retrieved. |
| deploymentId | path | string | true | Unique identifier of the deployment. |

### Enumerated Values

| Parameter | Value |
| --- | --- |
| segmentAttribute | [DataRobot-Consumer, DataRobot-Remote-IP, DataRobot-Host-IP] |

### Example responses

> 200 Response

```
{
  "properties": {
    "batches": {
      "description": "Info of the batches the metric is aggregated on.",
      "items": {
        "description": "Batch info.",
        "properties": {
          "earliestPredictionTimestamp": {
            "description": "Earliest prediction timestamp of a batch.",
            "format": "date-time",
            "type": "string",
            "x-versionadded": "v2.33"
          },
          "id": {
            "description": "Batch ID.",
            "type": "string",
            "x-versionadded": "v2.33"
          },
          "latestPredictionTimestamp": {
            "description": "Latest prediction timestamp of a batch.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ],
            "x-versionadded": "v2.33"
          },
          "name": {
            "description": "Batch name.",
            "type": "string",
            "x-versionadded": "v2.33"
          }
        },
        "required": [
          "earliestPredictionTimestamp",
          "id",
          "latestPredictionTimestamp",
          "name"
        ],
        "type": "object"
      },
      "type": "array",
      "x-versionadded": "v2.33"
    },
    "metrics": {
      "description": "Service health metrics of the deployment",
      "properties": {
        "cacheHitRatio": {
          "description": "Number of cache hits.",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "executionTime": {
          "description": "Request execution time at executionTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "numConsumers": {
          "description": "Number of unique users performing requests.",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "responseTime": {
          "description": "Request response time at responseTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "serverErrorRate": {
          "description": "Ratio of server errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "slowRequests": {
          "description": "Number of requests with response time greater than slowRequestsThreshold",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "totalPredictions": {
          "description": "Total number of prediction rows.",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "totalRequests": {
          "description": "Total number of prediction requests performed.",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "userErrorRate": {
          "description": "Ratio of user errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        }
      },
      "required": [
        "cacheHitRatio",
        "executionTime",
        "numConsumers",
        "responseTime",
        "serverErrorRate",
        "slowRequests",
        "totalPredictions",
        "totalRequests",
        "userErrorRate"
      ],
      "type": "object"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    }
  },
  "required": [
    "batches",
    "metrics"
  ],
  "type": "object"
}
```

### Responses

| Status | Meaning | Description | Schema |
| --- | --- | --- | --- |
| 200 | OK | Service health metric data retrieved. | ServiceStatsForBatchRetrieveResponse |

## Retrieve service stats by id

Operation path: `GET /api/v2/deployments/{deploymentId}/serviceStats/`

Authentication requirements: `BearerAuth`

Retrieve all deployment service health metrics over a single period of time.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| start | query | string,null(date-time) | false | Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: 2019-08-01T00:00:00Z. |
| end | query | string,null(date-time) | false | End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: 2019-08-01T00:00:00Z. |
| executionTimeQuantile | query | number | false | Quantile for executionTime metric. |
| responseTimeQuantile | query | number | false | Quantile for responseTime metric. |
| slowRequestsThreshold | query | integer | false | Threshold for slowRequests metric. |
| segmentAttribute | query | string | false | The name of a segment attribute used for segment analysis. |
| segmentValue | query | string,null | false | The value of the segmentAttribute to segment on. |
| modelId | query | string | false | The id of the model for which metrics are being retrieved. |
| deploymentId | path | string | true | Unique identifier of the deployment. |

### Enumerated Values

| Parameter | Value |
| --- | --- |
| segmentAttribute | [DataRobot-Consumer, DataRobot-Remote-IP, DataRobot-Host-IP] |

### Example responses

> 200 Response

```
{
  "properties": {
    "metrics": {
      "description": "Service health metrics of the deployment",
      "properties": {
        "cacheHitRatio": {
          "description": "Number of cache hits.",
          "type": [
            "number",
            "null"
          ]
        },
        "executionTime": {
          "description": "Request execution time at executionTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ]
        },
        "medianLoad": {
          "description": "Median of the request rate (in requests per minute).",
          "type": [
            "number",
            "null"
          ]
        },
        "numConsumers": {
          "description": "Number of unique users performing requests.",
          "type": [
            "integer",
            "null"
          ]
        },
        "peakLoad": {
          "description": "Maximum of the request rate (in requests per minute).",
          "type": [
            "number",
            "null"
          ]
        },
        "responseTime": {
          "description": "Request response time at responseTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ]
        },
        "serverErrorRate": {
          "description": "Ratio of server errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ]
        },
        "slowRequests": {
          "description": "Number of requests with response time greater than slowRequestsThreshold",
          "type": [
            "integer",
            "null"
          ]
        },
        "totalPredictions": {
          "description": "Total number of prediction rows.",
          "type": [
            "integer",
            "null"
          ]
        },
        "totalRequests": {
          "description": "Total number of prediction requests performed.",
          "type": [
            "integer",
            "null"
          ]
        },
        "userErrorRate": {
          "description": "Ratio of user errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "cacheHitRatio",
        "executionTime",
        "medianLoad",
        "numConsumers",
        "peakLoad",
        "responseTime",
        "serverErrorRate",
        "slowRequests",
        "totalPredictions",
        "totalRequests",
        "userErrorRate"
      ],
      "type": "object"
    },
    "modelId": {
      "description": "The id of the model for which metrics are being retrieved.",
      "type": "string"
    },
    "period": {
      "description": "An object with the keys \"start\" and \"end\" defining the period.",
      "properties": {
        "end": {
          "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "start": {
          "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    }
  },
  "required": [
    "metrics",
    "period"
  ],
  "type": "object"
}
```

### Responses

| Status | Meaning | Description | Schema |
| --- | --- | --- | --- |
| 200 | OK | Service health metric data retrieved. | ServiceStatsForTimeRangeResponse |

## Retrieve service health metric over batch by deployment ID

Operation path: `GET /api/v2/deployments/{deploymentId}/serviceStatsOverBatch/`

Authentication requirements: `BearerAuth`

Retrieve values for one single deployment service health metric over batch.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| segmentAttribute | query | string | false | The name of a segment attribute used for segment analysis. |
| segmentValue | query | string,null | false | The value of the segmentAttribute to segment on. |
| batchId | query | any | false | The id of the batch for which metrics are being retrieved. |
| modelId | query | string | false | The id of the model for which metrics are being retrieved. |
| metric | query | string | false | A service health metric. |
| quantile | query | number | false | Quantile for executionTime and responseTime metrics |
| threshold | query | integer | false | Threshold for slowQueries metric. |
| deploymentId | path | string | true | Unique identifier of the deployment. |

### Enumerated Values

| Parameter | Value |
| --- | --- |
| segmentAttribute | [DataRobot-Consumer, DataRobot-Remote-IP, DataRobot-Host-IP] |
| metric | [totalPredictions, totalRequests, slowRequests, executionTime, responseTime, userErrorRate, serverErrorRate, numConsumers, cacheHitRatio] |

### Example responses

> 200 Response

```
{
  "properties": {
    "buckets": {
      "description": "An array of buckets, representing service health stats of the deployment over selected batches.",
      "items": {
        "description": "Service health stats of the deployment over a batch.",
        "properties": {
          "batch": {
            "description": "Batch info.",
            "properties": {
              "earliestPredictionTimestamp": {
                "description": "Earliest prediction timestamp of a batch.",
                "format": "date-time",
                "type": "string",
                "x-versionadded": "v2.33"
              },
              "id": {
                "description": "Batch ID.",
                "type": "string",
                "x-versionadded": "v2.33"
              },
              "latestPredictionTimestamp": {
                "description": "Latest prediction timestamp of a batch.",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ],
                "x-versionadded": "v2.33"
              },
              "name": {
                "description": "Batch name.",
                "type": "string",
                "x-versionadded": "v2.33"
              }
            },
            "required": [
              "earliestPredictionTimestamp",
              "id",
              "latestPredictionTimestamp",
              "name"
            ],
            "type": "object"
          },
          "value": {
            "description": "Value of the metric in the bucket.",
            "type": [
              "number",
              "null"
            ],
            "x-versionadded": "v2.33"
          }
        },
        "required": [
          "batch",
          "value"
        ],
        "type": "object"
      },
      "type": "array",
      "x-versionadded": "v2.33"
    },
    "metric": {
      "description": "Name of the metric requested.",
      "type": "string",
      "x-versionadded": "v2.33"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    }
  },
  "required": [
    "buckets",
    "metric"
  ],
  "type": "object"
}
```

### Responses

| Status | Meaning | Description | Schema |
| --- | --- | --- | --- |
| 200 | OK | Service health metric data retrieved. | ServiceStatsOverBatchResponse |

## Retrieve service health metric over time by deployment ID

Operation path: `GET /api/v2/deployments/{deploymentId}/serviceStatsOverTime/`

Authentication requirements: `BearerAuth`

Retrieve values for one single deployment service health metric over time.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| start | query | string,null(date-time) | false | Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: 2019-08-01T00:00:00Z. |
| end | query | string,null(date-time) | false | End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: 2019-08-01T00:00:00Z. |
| bucketSize | query | string(duration) | false | The time duration of a bucket. Needs to be multiple of one hour. Can not be longer than the total length of the period. If not set, a default value will be calculated based on the start and end time. |
| segmentAttribute | query | string | false | The name of a segment attribute used for segment analysis. |
| segmentValue | query | string,null | false | The value of the segmentAttribute to segment on. |
| modelId | query | any | false | The ID of the models for which metrics are being retrieved. |
| metric | query | string | false | Name of the metric. See below for a list of supported metrics. |
| quantile | query | number | false | A quantile for resulting data, used if metric is executionTime or responseTime, defaults to 0.5. |
| threshold | query | integer | false | A threshold for filtering results, used if metric is slowQueries, defaults to 1000. |
| deploymentId | path | string | true | Unique identifier of the deployment. |

### Enumerated Values

| Parameter | Value |
| --- | --- |
| segmentAttribute | [DataRobot-Consumer, DataRobot-Remote-IP, DataRobot-Host-IP] |
| metric | [totalPredictions, totalRequests, slowRequests, executionTime, responseTime, userErrorRate, serverErrorRate, numConsumers, cacheHitRatio, medianLoad, peakLoad] |

### Example responses

> 200 Response

```
{
  "properties": {
    "buckets": {
      "description": "An array of bucket, representing service health stats of the deployment over time.",
      "items": {
        "description": "Service health stats of the deployment over a time range.",
        "properties": {
          "modelId": {
            "description": "The id of the model for which metrics are being retrieved.",
            "type": "string",
            "x-versionadded": "v2.37"
          },
          "period": {
            "description": "An object with the keys \"start\" and \"end\" defining the period.",
            "properties": {
              "end": {
                "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "start": {
                "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "type": "object"
          },
          "value": {
            "description": "Value of the metric in the bucket. Null if no value",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "period",
          "value"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "metric": {
      "description": "Name of the metric requested.",
      "type": "string"
    },
    "modelId": {
      "description": "The id of the model for which metrics are being retrieved. Deprecated, use modelId in each bucket instead.",
      "type": "string",
      "x-versiondeprecated": "v2.37"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "summary": {
      "description": "Service health stats of the deployment over a time range.",
      "properties": {
        "modelId": {
          "description": "The id of the model for which metrics are being retrieved.",
          "type": "string",
          "x-versionadded": "v2.37"
        },
        "period": {
          "description": "An object with the keys \"start\" and \"end\" defining the period.",
          "properties": {
            "end": {
              "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "start": {
              "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "type": "object"
        },
        "value": {
          "description": "Value of the metric in the bucket. Null if no value",
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "period",
        "value"
      ],
      "type": "object"
    }
  },
  "required": [
    "buckets",
    "metric"
  ],
  "type": "object"
}
```

### Responses

| Status | Meaning | Description | Schema |
| --- | --- | --- | --- |
| 200 | OK | Service health metric data retrieved. | ServiceStatsOverTimeResponse |

# Schemas

## Batch

```
{
  "description": "Batch info.",
  "properties": {
    "earliestPredictionTimestamp": {
      "description": "Earliest prediction timestamp of a batch.",
      "format": "date-time",
      "type": "string",
      "x-versionadded": "v2.33"
    },
    "id": {
      "description": "Batch ID.",
      "type": "string",
      "x-versionadded": "v2.33"
    },
    "latestPredictionTimestamp": {
      "description": "Latest prediction timestamp of a batch.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "name": {
      "description": "Batch name.",
      "type": "string",
      "x-versionadded": "v2.33"
    }
  },
  "required": [
    "earliestPredictionTimestamp",
    "id",
    "latestPredictionTimestamp",
    "name"
  ],
  "type": "object"
}
```

Batch info.

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| earliestPredictionTimestamp | string(date-time) | true |  | Earliest prediction timestamp of a batch. |
| id | string | true |  | Batch ID. |
| latestPredictionTimestamp | string,null(date-time) | true |  | Latest prediction timestamp of a batch. |
| name | string | true |  | Batch name. |

## ServiceStatsForBatchRetrieveResponse

```
{
  "properties": {
    "batches": {
      "description": "Info of the batches the metric is aggregated on.",
      "items": {
        "description": "Batch info.",
        "properties": {
          "earliestPredictionTimestamp": {
            "description": "Earliest prediction timestamp of a batch.",
            "format": "date-time",
            "type": "string",
            "x-versionadded": "v2.33"
          },
          "id": {
            "description": "Batch ID.",
            "type": "string",
            "x-versionadded": "v2.33"
          },
          "latestPredictionTimestamp": {
            "description": "Latest prediction timestamp of a batch.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ],
            "x-versionadded": "v2.33"
          },
          "name": {
            "description": "Batch name.",
            "type": "string",
            "x-versionadded": "v2.33"
          }
        },
        "required": [
          "earliestPredictionTimestamp",
          "id",
          "latestPredictionTimestamp",
          "name"
        ],
        "type": "object"
      },
      "type": "array",
      "x-versionadded": "v2.33"
    },
    "metrics": {
      "description": "Service health metrics of the deployment",
      "properties": {
        "cacheHitRatio": {
          "description": "Number of cache hits.",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "executionTime": {
          "description": "Request execution time at executionTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "numConsumers": {
          "description": "Number of unique users performing requests.",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "responseTime": {
          "description": "Request response time at responseTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "serverErrorRate": {
          "description": "Ratio of server errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "slowRequests": {
          "description": "Number of requests with response time greater than slowRequestsThreshold",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "totalPredictions": {
          "description": "Total number of prediction rows.",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "totalRequests": {
          "description": "Total number of prediction requests performed.",
          "type": [
            "integer",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "userErrorRate": {
          "description": "Ratio of user errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ],
          "x-versionadded": "v2.33"
        }
      },
      "required": [
        "cacheHitRatio",
        "executionTime",
        "numConsumers",
        "responseTime",
        "serverErrorRate",
        "slowRequests",
        "totalPredictions",
        "totalRequests",
        "userErrorRate"
      ],
      "type": "object"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    }
  },
  "required": [
    "batches",
    "metrics"
  ],
  "type": "object"
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| batches | [Batch] | true |  | Info of the batches the metric is aggregated on. |
| metrics | ServiceStatsMetricsForBatch | true |  | Service health metrics of the deployment |
| segmentAttribute | string,null | false |  | The name of the segment on which segment analysis is being performed. |
| segmentValue | string,null | false |  | The value of the segmentAttribute to segment on. |

## ServiceStatsForTimeRangeResponse

```
{
  "properties": {
    "metrics": {
      "description": "Service health metrics of the deployment",
      "properties": {
        "cacheHitRatio": {
          "description": "Number of cache hits.",
          "type": [
            "number",
            "null"
          ]
        },
        "executionTime": {
          "description": "Request execution time at executionTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ]
        },
        "medianLoad": {
          "description": "Median of the request rate (in requests per minute).",
          "type": [
            "number",
            "null"
          ]
        },
        "numConsumers": {
          "description": "Number of unique users performing requests.",
          "type": [
            "integer",
            "null"
          ]
        },
        "peakLoad": {
          "description": "Maximum of the request rate (in requests per minute).",
          "type": [
            "number",
            "null"
          ]
        },
        "responseTime": {
          "description": "Request response time at responseTimeQuantile (in milliseconds).",
          "type": [
            "number",
            "null"
          ]
        },
        "serverErrorRate": {
          "description": "Ratio of server errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ]
        },
        "slowRequests": {
          "description": "Number of requests with response time greater than slowRequestsThreshold",
          "type": [
            "integer",
            "null"
          ]
        },
        "totalPredictions": {
          "description": "Total number of prediction rows.",
          "type": [
            "integer",
            "null"
          ]
        },
        "totalRequests": {
          "description": "Total number of prediction requests performed.",
          "type": [
            "integer",
            "null"
          ]
        },
        "userErrorRate": {
          "description": "Ratio of user errors to the total number of requests.",
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "cacheHitRatio",
        "executionTime",
        "medianLoad",
        "numConsumers",
        "peakLoad",
        "responseTime",
        "serverErrorRate",
        "slowRequests",
        "totalPredictions",
        "totalRequests",
        "userErrorRate"
      ],
      "type": "object"
    },
    "modelId": {
      "description": "The id of the model for which metrics are being retrieved.",
      "type": "string"
    },
    "period": {
      "description": "An object with the keys \"start\" and \"end\" defining the period.",
      "properties": {
        "end": {
          "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "start": {
          "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    }
  },
  "required": [
    "metrics",
    "period"
  ],
  "type": "object"
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| metrics | ServiceStatsMetricsForTimeRange | true |  | Service health metrics of the deployment |
| modelId | string | false |  | The id of the model for which metrics are being retrieved. |
| period | TimeRange | true |  | An object with the keys "start" and "end" defining the period. |
| segmentAttribute | string,null | false |  | The name of the segment on which segment analysis is being performed. |
| segmentValue | string,null | false |  | The value of the segmentAttribute to segment on. |

## ServiceStatsMetricsForBatch

```
{
  "description": "Service health metrics of the deployment",
  "properties": {
    "cacheHitRatio": {
      "description": "Number of cache hits.",
      "type": [
        "number",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "executionTime": {
      "description": "Request execution time at executionTimeQuantile (in milliseconds).",
      "type": [
        "number",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "numConsumers": {
      "description": "Number of unique users performing requests.",
      "type": [
        "integer",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "responseTime": {
      "description": "Request response time at responseTimeQuantile (in milliseconds).",
      "type": [
        "number",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "serverErrorRate": {
      "description": "Ratio of server errors to the total number of requests.",
      "type": [
        "number",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "slowRequests": {
      "description": "Number of requests with response time greater than slowRequestsThreshold",
      "type": [
        "integer",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "totalPredictions": {
      "description": "Total number of prediction rows.",
      "type": [
        "integer",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "totalRequests": {
      "description": "Total number of prediction requests performed.",
      "type": [
        "integer",
        "null"
      ],
      "x-versionadded": "v2.33"
    },
    "userErrorRate": {
      "description": "Ratio of user errors to the total number of requests.",
      "type": [
        "number",
        "null"
      ],
      "x-versionadded": "v2.33"
    }
  },
  "required": [
    "cacheHitRatio",
    "executionTime",
    "numConsumers",
    "responseTime",
    "serverErrorRate",
    "slowRequests",
    "totalPredictions",
    "totalRequests",
    "userErrorRate"
  ],
  "type": "object"
}
```

Service health metrics of the deployment

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| cacheHitRatio | number,null | true |  | Number of cache hits. |
| executionTime | number,null | true |  | Request execution time at executionTimeQuantile (in milliseconds). |
| numConsumers | integer,null | true |  | Number of unique users performing requests. |
| responseTime | number,null | true |  | Request response time at responseTimeQuantile (in milliseconds). |
| serverErrorRate | number,null | true |  | Ratio of server errors to the total number of requests. |
| slowRequests | integer,null | true |  | Number of requests with response time greater than slowRequestsThreshold |
| totalPredictions | integer,null | true |  | Total number of prediction rows. |
| totalRequests | integer,null | true |  | Total number of prediction requests performed. |
| userErrorRate | number,null | true |  | Ratio of user errors to the total number of requests. |

## ServiceStatsMetricsForTimeRange

```
{
  "description": "Service health metrics of the deployment",
  "properties": {
    "cacheHitRatio": {
      "description": "Number of cache hits.",
      "type": [
        "number",
        "null"
      ]
    },
    "executionTime": {
      "description": "Request execution time at executionTimeQuantile (in milliseconds).",
      "type": [
        "number",
        "null"
      ]
    },
    "medianLoad": {
      "description": "Median of the request rate (in requests per minute).",
      "type": [
        "number",
        "null"
      ]
    },
    "numConsumers": {
      "description": "Number of unique users performing requests.",
      "type": [
        "integer",
        "null"
      ]
    },
    "peakLoad": {
      "description": "Maximum of the request rate (in requests per minute).",
      "type": [
        "number",
        "null"
      ]
    },
    "responseTime": {
      "description": "Request response time at responseTimeQuantile (in milliseconds).",
      "type": [
        "number",
        "null"
      ]
    },
    "serverErrorRate": {
      "description": "Ratio of server errors to the total number of requests.",
      "type": [
        "number",
        "null"
      ]
    },
    "slowRequests": {
      "description": "Number of requests with response time greater than slowRequestsThreshold",
      "type": [
        "integer",
        "null"
      ]
    },
    "totalPredictions": {
      "description": "Total number of prediction rows.",
      "type": [
        "integer",
        "null"
      ]
    },
    "totalRequests": {
      "description": "Total number of prediction requests performed.",
      "type": [
        "integer",
        "null"
      ]
    },
    "userErrorRate": {
      "description": "Ratio of user errors to the total number of requests.",
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "cacheHitRatio",
    "executionTime",
    "medianLoad",
    "numConsumers",
    "peakLoad",
    "responseTime",
    "serverErrorRate",
    "slowRequests",
    "totalPredictions",
    "totalRequests",
    "userErrorRate"
  ],
  "type": "object"
}
```

Service health metrics of the deployment

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| cacheHitRatio | number,null | true |  | Number of cache hits. |
| executionTime | number,null | true |  | Request execution time at executionTimeQuantile (in milliseconds). |
| medianLoad | number,null | true |  | Median of the request rate (in requests per minute). |
| numConsumers | integer,null | true |  | Number of unique users performing requests. |
| peakLoad | number,null | true |  | Maximum of the request rate (in requests per minute). |
| responseTime | number,null | true |  | Request response time at responseTimeQuantile (in milliseconds). |
| serverErrorRate | number,null | true |  | Ratio of server errors to the total number of requests. |
| slowRequests | integer,null | true |  | Number of requests with response time greater than slowRequestsThreshold |
| totalPredictions | integer,null | true |  | Total number of prediction rows. |
| totalRequests | integer,null | true |  | Total number of prediction requests performed. |
| userErrorRate | number,null | true |  | Ratio of user errors to the total number of requests. |

## ServiceStatsOverBatchBucket

```
{
  "description": "Service health stats of the deployment over a batch.",
  "properties": {
    "batch": {
      "description": "Batch info.",
      "properties": {
        "earliestPredictionTimestamp": {
          "description": "Earliest prediction timestamp of a batch.",
          "format": "date-time",
          "type": "string",
          "x-versionadded": "v2.33"
        },
        "id": {
          "description": "Batch ID.",
          "type": "string",
          "x-versionadded": "v2.33"
        },
        "latestPredictionTimestamp": {
          "description": "Latest prediction timestamp of a batch.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ],
          "x-versionadded": "v2.33"
        },
        "name": {
          "description": "Batch name.",
          "type": "string",
          "x-versionadded": "v2.33"
        }
      },
      "required": [
        "earliestPredictionTimestamp",
        "id",
        "latestPredictionTimestamp",
        "name"
      ],
      "type": "object"
    },
    "value": {
      "description": "Value of the metric in the bucket.",
      "type": [
        "number",
        "null"
      ],
      "x-versionadded": "v2.33"
    }
  },
  "required": [
    "batch",
    "value"
  ],
  "type": "object"
}
```

Service health stats of the deployment over a batch.

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| batch | Batch | true |  | Batch info. |
| value | number,null | true |  | Value of the metric in the bucket. |

## ServiceStatsOverBatchResponse

```
{
  "properties": {
    "buckets": {
      "description": "An array of buckets, representing service health stats of the deployment over selected batches.",
      "items": {
        "description": "Service health stats of the deployment over a batch.",
        "properties": {
          "batch": {
            "description": "Batch info.",
            "properties": {
              "earliestPredictionTimestamp": {
                "description": "Earliest prediction timestamp of a batch.",
                "format": "date-time",
                "type": "string",
                "x-versionadded": "v2.33"
              },
              "id": {
                "description": "Batch ID.",
                "type": "string",
                "x-versionadded": "v2.33"
              },
              "latestPredictionTimestamp": {
                "description": "Latest prediction timestamp of a batch.",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ],
                "x-versionadded": "v2.33"
              },
              "name": {
                "description": "Batch name.",
                "type": "string",
                "x-versionadded": "v2.33"
              }
            },
            "required": [
              "earliestPredictionTimestamp",
              "id",
              "latestPredictionTimestamp",
              "name"
            ],
            "type": "object"
          },
          "value": {
            "description": "Value of the metric in the bucket.",
            "type": [
              "number",
              "null"
            ],
            "x-versionadded": "v2.33"
          }
        },
        "required": [
          "batch",
          "value"
        ],
        "type": "object"
      },
      "type": "array",
      "x-versionadded": "v2.33"
    },
    "metric": {
      "description": "Name of the metric requested.",
      "type": "string",
      "x-versionadded": "v2.33"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    }
  },
  "required": [
    "buckets",
    "metric"
  ],
  "type": "object"
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| buckets | [ServiceStatsOverBatchBucket] | true |  | An array of buckets, representing service health stats of the deployment over selected batches. |
| metric | string | true |  | Name of the metric requested. |
| segmentAttribute | string,null | false |  | The name of the segment on which segment analysis is being performed. |
| segmentValue | string,null | false |  | The value of the segmentAttribute to segment on. |

## ServiceStatsOverTimeBucket

```
{
  "description": "Service health stats of the deployment over a time range.",
  "properties": {
    "modelId": {
      "description": "The id of the model for which metrics are being retrieved.",
      "type": "string",
      "x-versionadded": "v2.37"
    },
    "period": {
      "description": "An object with the keys \"start\" and \"end\" defining the period.",
      "properties": {
        "end": {
          "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "start": {
          "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "value": {
      "description": "Value of the metric in the bucket. Null if no value",
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "period",
    "value"
  ],
  "type": "object"
}
```

Service health stats of the deployment over a time range.

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| modelId | string | false |  | The id of the model for which metrics are being retrieved. |
| period | TimeRange | true |  | An object with the keys "start" and "end" defining the period. |
| value | number,null | true |  | Value of the metric in the bucket. Null if no value |

## ServiceStatsOverTimeResponse

```
{
  "properties": {
    "buckets": {
      "description": "An array of bucket, representing service health stats of the deployment over time.",
      "items": {
        "description": "Service health stats of the deployment over a time range.",
        "properties": {
          "modelId": {
            "description": "The id of the model for which metrics are being retrieved.",
            "type": "string",
            "x-versionadded": "v2.37"
          },
          "period": {
            "description": "An object with the keys \"start\" and \"end\" defining the period.",
            "properties": {
              "end": {
                "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "start": {
                "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "type": "object"
          },
          "value": {
            "description": "Value of the metric in the bucket. Null if no value",
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "period",
          "value"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "metric": {
      "description": "Name of the metric requested.",
      "type": "string"
    },
    "modelId": {
      "description": "The id of the model for which metrics are being retrieved. Deprecated, use modelId in each bucket instead.",
      "type": "string",
      "x-versiondeprecated": "v2.37"
    },
    "segmentAttribute": {
      "description": "The name of the segment on which segment analysis is being performed.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "segmentValue": {
      "default": "",
      "description": "The value of the `segmentAttribute` to segment on.",
      "type": [
        "string",
        "null"
      ],
      "x-versionadded": "v2.20"
    },
    "summary": {
      "description": "Service health stats of the deployment over a time range.",
      "properties": {
        "modelId": {
          "description": "The id of the model for which metrics are being retrieved.",
          "type": "string",
          "x-versionadded": "v2.37"
        },
        "period": {
          "description": "An object with the keys \"start\" and \"end\" defining the period.",
          "properties": {
            "end": {
              "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "start": {
              "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "type": "object"
        },
        "value": {
          "description": "Value of the metric in the bucket. Null if no value",
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "period",
        "value"
      ],
      "type": "object"
    }
  },
  "required": [
    "buckets",
    "metric"
  ],
  "type": "object"
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| buckets | [ServiceStatsOverTimeBucket] | true |  | An array of bucket, representing service health stats of the deployment over time. |
| metric | string | true |  | Name of the metric requested. |
| modelId | string | false |  | The id of the model for which metrics are being retrieved. Deprecated, use modelId in each bucket instead. |
| segmentAttribute | string,null | false |  | The name of the segment on which segment analysis is being performed. |
| segmentValue | string,null | false |  | The value of the segmentAttribute to segment on. |
| summary | ServiceStatsOverTimeBucket | false |  | Service health stats of the deployment over a time range. |

## TimeRange

```
{
  "description": "An object with the keys \"start\" and \"end\" defining the period.",
  "properties": {
    "end": {
      "description": "End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "start": {
      "description": "Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: ``2019-08-01T00:00:00Z``.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "type": "object"
}
```

An object with the keys "start" and "end" defining the period.

### Properties

| Name | Type | Required | Restrictions | Description |
| --- | --- | --- | --- | --- |
| end | string,null(date-time) | false |  | End of the period to retrieve monitoring data, defaults to the next top of the hour. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: 2019-08-01T00:00:00Z. |
| start | string,null(date-time) | false |  | Start of the period to retrieve monitoring data, defaults to 7 days ago from the end of the period. Note: this field only accepts top of the hour RFC3339 datetime strings, for example: 2019-08-01T00:00:00Z. |

---
