查询服务调用详情
更新时间:2025-07-16
接口描述
本接口用于查询服务调用详情。
鉴权说明
调用本文API,使用“基于安全认证AK/SK”进行签名计算鉴权,即使用安全认证中的Access Key ID 和 Secret Access Key进行鉴权,具体鉴权认证机制参考HTTP调用鉴权说明。
请求结构
Bash
1POST /v2/service?Action=DescribeServiceStats HTTP/1.1
2Host: qianfan.baidubce.com
3Authorization: authorization string
4Content-Type: application/json
5
6{
7 "serviceId": ["svco-tv5t4zpkj3za"],
8 "appId": ["1483416575"],
9 "startTime": "2025-03-30T16:00:00Z",
10 "endTime": "2025-03-31T15:59:00Z",
11 "interval": 86400,
12 "protocolVersion":2
13}
请求头域
除公共头域外,无其它特殊头域。
请求参数
- Query参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
Action | string | 是 | 方法名称,固定值DescribeServiceStats |
- Body参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
serviceId | List<string> | 是 | 服务ID,说明: (1)不填写该字段,默认查询全部服务ID (2)可以通过任一方式获取: 方式一:通过调用接口创建服务,返回参数serviceId获取 方式二:通过千帆控制台-在线推理-我的服务页面,点击某服务详情查看,如下图所示: ![]() |
appId | List<string> | 否 | 应用ID,说明: (1)不填写该字段,默认查询全部应用 (2)通过控制台-系统管理与统计-应用接入页面,查看AppID,如下图所示: ![]() |
startTime | string | 是 | 查询起始时间,格式如2025-03-30T16:00:00Z |
endTime | string | 是 | 查询终止时间,格式如2025-03-31T15:59:00Z |
Interval | Integer | 是 | 时间粒度,可选值: · 86400:按天 · 3600:按小时 · 60:按分钟 |
protocolVersion | int | 否 | 服务版本,可选值如下: · 1 · 2 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
名称 | 类型 | 描述 |
---|---|---|
requestId | string | 请求ID |
result | object | 请求结果 |
result说明
名称 | 类型 | 描述 |
---|---|---|
startTime | string | 查询起始时间 |
endTime | string | 查询终止时间 |
serviceList | List<object> | 服务列表 |
serviceList说明
名称 | 类型 | 描述 |
---|---|---|
serviceId | string | 服务ID |
serviceName | string | 服务名 |
appList | List<object> | app列表 |
appList说明
名称 | 类型 | 描述 |
---|---|---|
appId | string | appID |
metrics | List<object> | 监控指标,返回入参指定的指标结果 |
metrics说明
名称 | 类型 | 描述 |
---|---|---|
tpm | List<object> | TPM使用情况,仅时间粒度为分钟时展示 |
rpm | List<object> | RPM使用情况,仅时间粒度为分钟时展示 |
timeToFirstTokenP99 | int | 首Tokens时延P99分位(ms) |
timeToFirstTokenP90 | int | 首Tokens时延P90分位(ms) |
timeToFirstTokenP50 | int | 首Tokens时延P50分位(ms) |
latencyP99 | int | 整句时延P99分位(ms) |
latencyP90 | int | 整句时延P90分位(ms) |
latencyP50 | int | 整句时延P50分位(ms) |
outputTokensPerSecondP99 | float | OTPS P99分位(tokens/s) |
outputTokensPerSecondP90 | float | OTPS P90分位(tokens/s) |
outputTokensPerSecondP50 | float | OTPS P50分位(tokens/s) |
inputTokensTotal | float | 输入token数(千tokens) |
outputTokensTotal | float | 输出token数(千tokens) |
tokensTotal | float | 总token数(千tokens) |
succeedCallTotal | int | 调用成功次数 |
failureCallTotal | int | 调用失败次数 |
callTotal | int | 调用总次数 |
searchCountTotal | int | 搜索触发次数,说明:模型触发此功能时,返回该字段 |
searchTokensTotal | float | 搜索膨胀Tokens数(千tokens),说明:模型触发此功能时,返回该字段 |
cachedCountTotal | int | Prompt cache触发次数,说明:模型触发此功能时,返回该字段 |
cachedTokensTotal | float | Prompt cache Tokens数(千tokens),说明:模型触发此功能时,返回该字段 |
chatfileplusCountTotal | int | ChatfilePlus触发次数,说明:模型触发此功能时,返回该字段 |
chatfileplusTokensTotal | float | ChatfilePlus触发tokens数(千tokens),说明:模型触发此功能时,返回该字段 |
successQpsAvg | float | 单位时间内成功请求的平均QPS |
successQpsMax | int | 单位时间内成功请求的最大QPS |
failureQpsAvg | float | 单位时间内失败请求的平均QPS |
failureQpsMax | int | 单位时间内失败请求的最大QPS |
tpm说明
名称 | 类型 | 描述 |
---|---|---|
timestamp | int | 时间戳,只展示有变化的时间点及数据 |
tpmRateLimit | int | TPM限额 |
rpm说明
名称 | 类型 | 描述 |
---|---|---|
timestamp | int | 时间戳,只展示有变化的时间点和数据 |
rpmRateLimit | int | RPM限额 |
rpm | int | RPM实际使用量 |
请求示例
Bash
1curl --location 'https://qianfan.baidubce.com/v2/service?Action=DescribeServiceStats' \
2--header 'Authorization: bce-auth-v1/047ab241bad24xxx28b1ac/2024-01-10T08:39:09Z/180000/host;x-bce-date/eae9855604cxxxxe03cfcbaff' \
3--header 'x-bce-date: 2024-01-10T08:37:40Z' \
4--header 'Content-Type: application/json' \
5--data '{
6 "serviceId": ["svco-tv5t4zpkj3za"],
7 "appId": ["1483416575"],
8 "startTime": "2025-03-30T16:00:00Z",
9 "endTime": "2025-03-31T15:59:00Z",
10 "interval": 86400,
11 "protocolVersion":2
12}'
响应示例
JSON
1{
2 "requestId": "1bef3f87-c5b2-4419-936b-50f9884f10d4",
3 "result": {
4 "startTime": "2025-03-30T16:00:00Z",
5 "endTime": "2025-03-31T15:59:00Z",
6 "serviceList": [
7 {
8 "serviceId": "svco-tv5t4zpkj3da",
9 "serviceName": "sunyueru0506",
10 "appList": [
11 {
12 "appId": "1483416575",
13 "metrics": [
14 {
15 "timeStamp": 1746002820,
16 "tpm": [],
17 "rpm": [],
18 "timeToFirstTokenP99": 0,
19 "timeToFirstTokenP90": 0,
20 "timeToFirstTokenP50": 0,
21 "latencyP99": 11416,
22 "latencyP90": 11416,
23 "latencyP50": 11416,
24 "outputTokensPerSecondP99": 0,
25 "outputTokensPerSecondP90": 0,
26 "outputTokensPerSecondP50": 0,
27 "inputTokensTotal": 555.555,
28 "outputTokensTotal": 22.222,
29 "tokensTotal": 577.777,
30 "succeedCallTotal": 880,
31 "failureCallTotal": 120,
32 "callTotal": 1000,
33 "searchCountTotal": 50,
34 "searchTokensTotal": 525.525,
35 "cachedCountTotal": 0,
36 "cachedTokensTotal": 0,
37 "chatfileplusCountTotal": 6,
38 "chatfileplusTokensTotal": 6.666,
39 "successQpsAvg": 0.5,
40 "successQpsMax": 15,
41 "failureQpsAvg": 0.1,
42 "failureQpsMax": 3
43 }
44 ]
45 }
46 ]
47 }
48 ]
49 }
50}
错误码
若请求错误,服务器将返回的JSON文本包含以下参数:
名称 | 描述 |
---|---|
requestId | 请求ID |
code | 错误码 |
message | 错误描述信息,帮助理解和解决发生的错误 |
例如错误返回:
Plain Text
1{
2 "requestId":"6ba7b810-xxxc04fd430c8",
3 "code":"AccessDenied",
4 "message":"Access denied."
5}
更多相关错误码,请查看错误码说明。