更新应用配置
更新时间:2026-06-26
UpdateServiceConfig
更新应用配置,支持将配置同时更新到多个服务,包括采样配置、日志关联配置、调用配置、拓扑图配置和多模态数据转储配置。
API Explorer
去调试
您可以在 API Explorer 中直接运行该接口,免去您计算签名的困扰。运行成功后,API Explorer 可以自动生成 SDK 代码示例。
请求结构
Plain Text
1POST /v1/apm?action=UpdateServiceConfig HTTP/1.1
2Host: apm.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "serviceNames": ["mall-gateway"],
7 "sampleConfig": {
8 "enabled": true,
9 "processors": [
10 {
11 "name": "component采样器",
12 "enabled": true,
13 "filters": [
14 {
15 "key": "attributes.apm_component",
16 "op": "=",
17 "value": "http"
18 }
19 ],
20 "sampleRate": 0.2
21 }
22 ]
23 },
24 "loggingConfig": {
25 "enabled": true,
26 "region": "bj",
27 "project": "default",
28 "logStoreName": "bcm_csm_log",
29 "traceIdIndex": "FIELD",
30 "traceIdKey": "trace_id",
31 "spanIdIndex": "FIELD",
32 "spanIdKey": "span_id"
33 },
34 "requestConfig": {
35 "global": true,
36 "serverSlowRequestThresholdSeconds": 0.5,
37 "dbSlowRequestThresholdSeconds": 0.5,
38 "okHttpStatus": [400, 403, 404]
39 },
40 "topoConfig": {
41 "global": true,
42 "requestSecondsThreshold": 0.5,
43 "errorRateThreshold": 0.2
44 },
45 "mllmResourceDumpConfig": {
46 "retentionDays": 20,
47 "bucket": "bostest"
48 }
49}
请求头域
除公共头域外,无其他特殊头域
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号,当前取值为v1 |
| serviceNames | List |
是 | RequestBody参数 | 应用名列表,支持将配置同时更新到多个服务 |
| sampleConfig | SampleConfig | 否 | RequestBody参数 | 采样配置,若未填写则不更新该配置 |
| loggingConfig | LoggingConfig | 否 | RequestBody参数 | 日志关联配置,若未填写则不更新该配置 |
| requestConfig | ServiceRequestConfig | 否 | RequestBody参数 | 调用配置,若未填写则不更新该配置 |
| topoConfig | ServiceTopoConfig | 否 | RequestBody参数 | 拓扑图配置,若未填写则不更新该配置 |
| mllmResourceDumpConfig | MllmResourceDumpConfig | 否 | RequestBody参数 | 多模态数据转储配置,若未填写则不更新该配置 |
返回状态码
成功返回200,失败返回见错误码
返回头域
除公共头域外,无其他特殊头域
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| success | Boolean | 请求是否成功 |
| code | String | 状态码 |
| message | String | 错误信息 |
请求示例
Plain Text
1POST /v1/apm?action=UpdateServiceConfig HTTP/1.1
2HOST apm.bj.baidubce.com
3Authorization bce-auth-v1/...
4
5{
6 "serviceNames": ["mall-gateway"],
7 "sampleConfig": {
8 "enabled": true,
9 "processors": [
10 {
11 "name": "component采样器",
12 "enabled": true,
13 "filters": [
14 {
15 "key": "attributes.apm_component",
16 "op": "=",
17 "value": "http"
18 }
19 ],
20 "sampleRate": 0.2
21 }
22 ]
23 },
24 "loggingConfig": {
25 "enabled": true,
26 "region": "bj",
27 "project": "default",
28 "logStoreName": "bcm_csm_log"
29 },
30 "requestConfig": {
31 "global": true,
32 "serverSlowRequestThresholdSeconds": 0.5,
33 "dbSlowRequestThresholdSeconds": 0.5,
34 "okHttpStatus": [400, 403, 404]
35 },
36 "topoConfig": {
37 "global": true,
38 "requestSecondsThreshold": 0.5,
39 "errorRateThreshold": 0.2
40 },
41 "mllmResourceDumpConfig": {
42 "retentionDays": 20,
43 "bucket": "bostest"
44 }
45}
响应示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: request-id-example
3Date: Wed, 08 Jan 2025 03:25:48 GMT
4Transfer-Encoding: chunked
5Content-Type: application/json;charset=UTF-8
6Server: BWS
7
8{
9 "success": true,
10 "code": "OK",
11 "message": ""
12}
评价此篇文章
