获取指标采集配置

最近更新时间:2025-12-23 01:28:49

我的收藏

1. 接口描述

接口请求域名: cls.tencentcloudapi.com 。

获取指标订阅配置

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:DescribeTopicMetricConfigs。
Version String 公共参数,本接口取值:2020-10-16。
Region String 公共参数,详见产品支持的 地域列表
TopicId String 指标日志主题id。
- 通过 获取日志主题列表 获取日志主题Id。注意BizType 0:日志主题(默认值), 1:指标主题
- 通过 创建日志主题 获取日志主题Id。注意BizType 0:日志主题(默认值), 1:指标主题
示例值:5871c48d-219b-4274-829b-5aa7fb24229b
Filters.N Array of Filter configId按照【指标采集配置id】进行过滤。类型:String 必选:否
name按照【配置名称】进行过滤。类型:String 必选:否
每次请求的Filters的上限为10,所有Filter.Values总和上限为100。
Offset Integer 分页的偏移量,默认值为0。
示例值:0
Limit Integer 分页单页限制数目,默认值为20,最大值100。
示例值:20

3. 输出参数

参数名称 类型 描述
TotalCount Integer 总数目
示例值:0
Datas Array of MetricCollectConfig 指标采集配置列表
注意:此字段可能返回 null,表示取不到有效值。
RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 获取指标主题的采集配置

输入示例

POST / HTTP/1.1
Host: cls.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeTopicMetricConfigs
<公共请求参数>

{
    "TopicId": "d7adf66d-88a7-4321-8b4b-6f2c7a9773b8",
    "Offset": 0,
    "Limit": 10
}

输出示例

{
    "Response": {
        "Datas": [
            {
                "ConfigId": "1bfadff7-9c5d-48c2-b985-21670d9d007e",
                "CreateTime": 1724308693,
                "Flag": 1,
                "GroupIds": [
                    "886bf7a8-7340-4314-8d64-b360da0ffd78"
                ],
                "HonorLabels": false,
                "Name": "test-test",
                "Operate": 0,
                "Scheme": "",
                "ScrapeInterval": "",
                "ScrapeTimeout": "",
                "Source": 0,
                "TopicIds": [
                    "d7adf66d-88a7-4321-8b4b-6f2c7a9773b8"
                ],
                "Type": 1,
                "UpdateTime": 1724308693,
                "YamlSpec": {
                    "Spec": "typemeta:\n  kind: ServiceMonitor\n  apiversion: monitoring.coreos.com/v1\nobjectmeta:\n  name: test-test\n  generatename: \"\"\n  namespace: test\n  selflink: \"\"\n  uid: \"\"\n  resourceversion: \"\"\n  generation: 0\n  creationtimestamp: \"0001-01-01T00:00:00Z\"\n  deletiontimestamp: null\n  deletiongraceperiodseconds: null\n  labels: {}\n  annotations: {}\n  ownerreferences: []\n  finalizers: []\n  managedfields: []\nspec:\n  joblabel: \"\"\n  targetlabels: []\n  podtargetlabels: []\n  endpoints:\n  - port: 8080-8080-tcp\n    targetport: null\n    path: /metrics\n    scheme: \"\"\n    params: {}\n    interval: 15s\n    scrapetimeout: \"\"\n    tlsconfig: null\n    bearertokenfile: \"\"\n    bearertokensecret: null\n    authorization: null\n    honorlabels: false\n    honortimestamps: null\n    tracktimestampsstaleness: null\n    basicauth: null\n    oauth2: null\n    metricrelabelconfigs: []\n    relabelconfigs:\n    - sourcelabels:\n      - __meta_kubernetes_pod_label_app\n      separator: null\n      targetlabel: application\n      regex: \"\"\n      modulus: 0\n      replacement: null\n      action: replace\n    proxyurl: null\n    followredirects: null\n    enablehttp2: null\n    filterrunning: null\n  selector:\n    matchlabels:\n      app: test\n    matchexpressions: []\n  namespaceselector:\n    any: false\n    matchnames:\n    - test\n  samplelimit: null\n  scrapeprotocols: []\n  targetlimit: null\n  labellimit: null\n  labelnamelengthlimit: null\n  labelvaluelengthlimit: null\n  keepdroppedtargets: null\n  attachmetadata: null\n  scrapeclassname: null\n  bodysizelimit: null\n",
                    "Type": "ServiceMonitor"
                }
            },
            {
                "ConfigId": "fd6dced0-5cc1-4d81-b0d3-c42ee56842cd",
                "CreateTime": 1723640091,
                "Flag": 0,
                "GroupIds": [
                    "886bf7a8-7340-4314-8d64-b360da0ffd78"
                ],
                "HonorLabels": false,
                "MetricLabel": {
                    "CustomLabels": [],
                    "Label": {
                        "Keys": [],
                        "Type": 0
                    },
                    "Metadata": [
                        "namespace",
                        "pod_name",
                        "pod_ip",
                        "pod_uid",
                        "container_name",
                        "container_id",
                        "image_name"
                    ]
                },
                "Name": "test1",
                "Operate": 0,
                "Scheme": "http",
                "ScrapeInterval": "60s",
                "ScrapeTimeout": "30s",
                "Source": 0,
                "Spec": {
                    "CustomSpecs": [
                        {
                            "Namespaces": [
                                ""
                            ],
                            "Path": "/erq",
                            "PodLabel": [
                                {
                                    "Key": "ab",
                                    "Operate": "=",
                                    "Values": [
                                        "em",
                                        "q"
                                    ]
                                }
                            ],
                            "Port": "8080"
                        }
                    ]
                },
                "TopicIds": [
                    "d7adf66d-88a7-4321-8b4b-6f2c7a9773b8"
                ],
                "Type": 1,
                "UpdateTime": 1723709068
            }
        ],
        "RequestId": "a725cc9c-2de7-4180-b1dc-b4bae8a79707",
        "TotalCount": 2
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
AuthFailure CAM签名/鉴权错误。
AuthFailure.UnauthorizedOperation 请求未授权。
FailedOperation 操作失败。
InternalError 内部错误。
InternalError.DbError DB错误。
InternalError.IllegalRole 角色非法。
InvalidParameter 参数错误。
InvalidParameter.ParamError 参数错误。
InvalidParameterValue 参数取值错误。
LimitExceeded.RecordOutOfLimit 记录超过限制
MissingParameter 缺少参数错误。
OperationDenied.AccountNotExists 账户不存在。
UnauthorizedOperation 未授权操作。
UnknownParameter 未知参数错误。
UnsupportedOperation 操作不支持。