Querying the Calling Data of a Service Version
Function
This API is used to query all versions of a service and their corresponding monitoring metric data. Data is retained for 30 days only.
Constraints
- Region restrictions: Only the CN-Hong Kong region is supported.
- API rate limiting: The total number of requests for this API from all users cannot exceed 1,000 within one minute.
- User request limit: The number of requests for this API from a single user cannot exceed 200 within one minute.
- Rate-limiting response: When the rate limit is exceeded, the API returns the HTTP status code 429 "Too Many Requests".
- Retry suggestion: If the rate limit is exceeded, wait 60 seconds and try again.
URI
POST /v1/{project_id}/maas/monitoring/{service_id}/list-version-statistics
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID and Name. Constraints: N/A Range: The value can contain 32 characters. Only lowercase letters and digits are allowed. Default Value: N/A |
| service_id | Yes | String | Definition: Service IDs to be queried. Services are filtered based on the input service ID list. If this parameter is not specified, all service names corresponding to the IDs are returned. You can obtain the service ID from the response body during service creation, or call the API for obtaining the service list. The service_id field indicates the service ID. Constraints: N/A Range: The value can contain 1 to 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | No | String | Definition: User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details, see Authentication. Constraints: N/A Range: N/A Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| api_keys | No | Array of strings | Definition: API key tag list, which is used for filtering. MaaS services support API key calls. Go to the API key management page to get the API key tag. The Tag field in the API key list shows the API key tag.
Constraints: N/A Range:
Default Value: N/A |
| ips | No | Array of strings | Definition: IP address list, which indicates the source IP addresses of the clients that have been called. If this parameter is not specified, all IP addresses are queried. To query the IP address, you can call the API for obtaining the IP address list. Constraints: The value must be in the IP address format. Range: N/A Default Value: N/A |
| start_time | Yes | Long | Definition: Timestamp of the start time, in milliseconds. Constraints: The end time must be within 30 days from the start time. Range: The value must be greater than 0 and no greater than the value of end_time. Default Value: N/A |
| end_time | Yes | Long | Definition: Timestamp of the end time, in milliseconds. Constraints: The end time must be within 30 days from the start time. Range: The value must be greater than 0. Default Value: N/A |
| timezone | No | String | Definition: Time zone. Constraints: N/A Range: The value must comply with the IANA time zone specifications, such as Asia/Shanghai and UTC. Default Value: Asia/Shanghai (GMT+8) |
| infer_type | Yes | String | Definition: Service inference type. Range:
Constraints: N/A Default Value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Definition: Total number of queried versions. Range: N/A |
| count | Integer | Definition: Total number of queried versions. Range: N/A |
| items | Array of VersionStatItem objects | Definition: Version information list. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| service_id | String | Definition: Service ID. Range: N/A |
| version_id | String | Definition: Version ID. Range: N/A |
| version_name | String | Definition: Version name. Range: N/A |
| request_count | Integer | Definition: Number of calls. Range: N/A |
| error_count | Integer | Definition: Number of failed calls. If batch inference is used, this parameter indicates the number of failed inference times. However, batch inference is under restricted use. To use it, submit a service ticket. Range: N/A |
| error_rate | Double | Definition: Call failure rate. If batch inference is used, this parameter indicates the inference failure rate. However, batch inference is under restricted use. To use it, submit a service ticket. Range: 0 to 1 |
| total_token | Double | Definition: Total number of called tokens, in thousands. If batch inference is used, this parameter indicates the total number of tokens. However, batch inference is under restricted use. To use it, submit a service ticket. Range: N/A |
| prompt_token | Double | Definition: Number of input tokens Range: N/A |
| completion_token | Double | Definition: Number of output tokens Range: N/A |
| avg_latency | Double | Definition: Average response time (ms) Range: N/A |
| avg_ttft | Double | Definition: Average TTFT (ms) Range: N/A |
| avg_tpot | Double | Definition: Average TPOT (ms) Range: N/A |
| completion_tasks_count | Integer | Definition: Number of completed tasks Range: N/A |
| infer_times | Integer | Definition: Total number of inference times. (This parameter is related to batch inference. However, batch inference is under restricted use. To use it, submit a service ticket.) Range: N/A |
| avg_consume_time | Double | Definition: Average task handling duration, in minutes. This parameter is related to batch inference. However, batch inference is under restricted use. To use it, submit a service ticket. Range: N/A |
| avg_generation_time | Double | Definition: Average generation duration (s), that is, the average time generating an image or video. Only video and image generation models are supported. Range: N/A |
| cache_token | Double | Definition: Number of cache hit tokens (in thousands). Range: N/A |
| cache_hit_ratio | Double | Definition: Cache hit rate, which is number of cache hit tokens/number of input tokens. Range: 0 to 1 |
| scc_count | Integer | Definition: Number of successful calls. If batch inference is used, this parameter indicates the number of successful inference times. However, batch inference is under restricted use. To use it, submit a service ticket. Range: N/A |
| video_generate_duration | Double | Definition: Total duration of the generated video. Range: N/A |
| image_generate_nums | Integer | Definition: Total number of generated images. Range: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code, which identifies the error type. For details, see MaaS Error Codes. Range: N/A |
| error_msg | String | Definition: Error description. For details, see MaaS Error Codes. Range: N/A |
Request Example
Query the version information and metric data of the real-time inference service whose service ID is {service-ID} in GMT+8.
/v1/{project_id}/maas/monitoring/{service_id}/list-version-statistics
{
"start_time" : 1768406400000,
"end_time" : 1769531307195,
"timezone" : "Asia/Shanghai",
"infer_type" : "real_time"
} Response Example
Status code: 200
Success response
{
"total" : 1,
"count" : 1,
"items" : [ {
"service_id" : "4f6d50ec-0e80-4ea0-983b-d0ad1ede7596",
"version_id" : "ac73463d-4453-4d62-a3d9-31b627a116b1",
"version_name" : "Qwen2-7B-3.1",
"request_count" : 6,
"error_count" : 2,
"error_rate" : 0.3333,
"total_token" : 2.066,
"prompt_token" : 0.277,
"completion_token" : 1.789,
"avg_latency" : 16439.75,
"avg_ttft" : 326.46,
"avg_tpot" : 29.58,
"completion_tasks_count" : 0,
"infer_times" : 0,
"avg_consume_time" : 0,
"avg_generation_time" : 0,
"cache_token" : 0,
"cache_hit_ratio" : 0,
"scc_count" : 0,
"video_generate_duration": 0,
"image_generate_nums": 0
} ]
} Status code: 400
Failure response
{
"error_code" : "ModelArts.0104",
"error_msg" : "Invalid parameter. Issue: The end time cannot be earlier than the start time."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Success response |
| 400 | Failure response |
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
