Get Knowledge Base Monitoring

Updated at:

Get storage usage and QPS metrics for a Knowledge Base over a given time range.

Prerequisites

Get an API key and a workspace ID, and configure authentication first. See API overview and Authentication.

Endpoint

POST /api/v1/indices/rag/index/monitor

Get storage usage and QPS metrics for a Knowledge Base over a given time range.

WarningTimestamps are second-level Unix timestamps (not milliseconds). We recommend passing them as strings (for example "1780900000"); the integer format is also supported.

Request body

FieldRequiredTypeDescription
indexIdYesstringKnowledge Base ID.
startTimestampYesstring or integerQuery start time as a second-level Unix timestamp (not milliseconds). Both string and integer formats are supported (for example "1780900000" or 1780900000).
endTimestampYesstring or integerQuery end time, in the same format as startTimestamp. The end time can be at most 30 days after the start time.

Request example

curl -X POST "$BASE_URL/api/v1/indices/rag/index/monitor" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "indexId": "your-kb-id",
    "startTimestamp": "1780900000",
    "endTimestamp": "1781000000"
  }'

BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.

Response example

Returns 200 on success.

{
  "code": "Success",
  "status_code": 200,
  "data": {
    "storageMonitorData": [],
    "qpsMonitorData": []
  },
  "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response fields

FieldTypeDescription
codestringResponse code. Success when successful.
status_codeintegerHTTP status code.
request_idstringUnique request identifier. Provide this ID when troubleshooting.
successbooleanWhether the request succeeded.
messagestringResponse message. success when successful.
statusstringRequest status: SUCCESS or FAILED.
dataobjectMonitoring data. See the table below for sub-fields.

data fields

FieldTypeDescription
pipelineCommercialTypestringCommercial type of the Knowledge Base, for example standard.
storageMonitorDataobjectStorage usage monitoring data. Sub-fields: indexStorageLimit (number, storage limit in GB), indexStorageUsage (number, used storage in GB).
qpsMonitorDataobjectQPS monitoring data. Sub-fields: peakQps (integer, peak QPS within the statistical interval), totalRequests (integer, total requests within the window), avgQpsOfActiveSeconds (number, average QPS over active seconds within the window), monitorData (array, monitoring data aggregated by time window; see the table below for element fields).

monitorData element fields

FieldTypeDescription
windowRangeintegerWindow start time as a Unix timestamp in seconds.
windowRangeEndintegerWindow end time as a Unix timestamp in seconds.
peakQpsInWindowRangeintegerPeak QPS within the window.
totalRequestsintegerTotal requests within the window.
avgQpsOfActiveSecondsnumberAverage QPS over active seconds within the window.
successDataobjectSub-fields: peakQpsInWindowRange (integer, peak QPS within the window), totalRequests (integer, total requests), avgQpsOfActiveSeconds (number, average QPS over active seconds).
limitDataobjectSub-fields: peakQpsInWindowRange (integer, peak QPS within the window), totalRequests (integer, total requests), avgQpsOfActiveSeconds (number, average QPS over active seconds).
failDataobjectSub-fields: peakQpsInWindowRange (integer, peak QPS within the window), totalRequests (integer, total requests), avgQpsOfActiveSeconds (number, average QPS over active seconds).