tencent cloud

日志服务

动态与公告
产品动态
公告
新手指引
产品简介
产品概述
产品优势
地域和访问域名
规格与限制
基本概念
购买指南
计费概述
产品定价
按量计费(后付费)
欠费说明
清理日志服务资源
成本优化
常见问题
快速入门
一分钟入门指南
入门指南
使用 Demo 日志快速体验 CLS
操作指南
资源管理
权限管理
日志采集
指标采集
日志存储
指标存储
检索分析(日志主题)
检索分析(指标主题)
仪表盘
数据处理
投递与消费
监控告警
云产品中心
DataSight 独立控制台
历史文档
实践教程
日志采集
检索分析
仪表盘
监控告警
投递和消费
成本优化
开发者指南
通过 iframe 内嵌 CLS(旧方案)
通过 Grafana 使用 CLS
API 文档
History
Introduction
API Category
Making API Requests
Topic Management APIs
Log Set Management APIs
Index APIs
Topic Partition APIs
Machine Group APIs
Collection Configuration APIs
Log APIs
Metric APIs
Alarm Policy APIs
Data Processing APIs
Kafka Protocol Consumption APIs
CKafka Shipping Task APIs
Kafka Data Subscription APIs
COS Shipping Task APIs
SCF Delivery Task APIs
Scheduled SQL Analysis APIs
COS Data Import Task APIs
Data Types
Error Codes
常见问题
健康监测问题解释
采集相关
检索分析相关
其他问题
服务等级协议
CLS 政策
隐私协议
数据处理和安全协议
联系我们
词汇表

兼容 Promethues 接口

PDF
聚焦模式
字号
最后更新时间: 2026-01-07 15:32:33
指标主题兼容 Prometheus 指标数据模型及如下接口:

指标查询接口

Prometheus HTTP API

兼容如下 HTTP API,常用于对接 Grafana。
Instant queries : /api/v1/query
Range queries : /api/v1/query_range
Finding series by label matchers : /api/v1/series
Getting label names : /api/v1/labels
Querying label values : /api/v1/label/<label_name>/values
Querying exemplars : /api/v1/query_exemplars
不兼容用于原生 Prometheus 采集配置、告警规则和集群管理等功能的 API,例如: Targets、Rules、Alerts、Querying target metadata、Querying metric metadata、Alertmanagers、Status、TSDB Admin APIs 等。
对接 Grafana 操作步骤:
1. Grafana Data Sources 页面,单击 Add data source
2. 选择 Prometheus,在表单中配置如下信息:



URL:请替换其中的 ${region} 及 ${topicId} ,${region} 为 地域简称,${topicId} 为指标主题 ID。
外网地址:https://${region}.cls.tencentcs.com/prometheus/${topicId}
内网地址:https://${region}.cls.tencentyun.com/prometheus/${topicId}
Basic auth:打开该开关
Basic Auth Details:接口采用 Basic Auth 进行鉴权,将 API 密钥 中的 SecretId 及 SecretKey 分别作为 username 及 password。
username:${SecretId}
password:${SecretKey}
说明:
建议您单独创建一个子账号,使用该账号的 SecretId 及 SecretKey。该账号仅授予如下权限即可,以保障账号安全,配置方式详见 子账号授权
{
"version": "2.0",
"statement": [
{
"effect": "allow",
"action": [
"cls:MetricsSeries",
"cls:MetricsQueryExemplars",
"cls:MetricsLabelValues",
"cls:MetricsQueryRange",
"cls:MetricsLabels",
"cls:MetricsQuery"
],
"resource": [
"*"
]
}
]
}
Manage alerts via Alerting UI:关闭该开关,CLS 不兼容 Prometheus Alerts 相关接口,不支持该功能。
3. 单击底部 Save & Test 测试配置信息是否正确并保存配置。

Prometheus Remote Read API

常用于使用自建 Prometheus 读取指标主题数据,在 Prometheus 配置文件 中添加如下配置(更多配置说明详见 Prometheus 官方文档):
# 读取地址,请替换其中的${region}及${topicId},本示例采用外网地址,如果网络条件允许建议使用内网地址
# 内网地址 url: https://${region}.cls.tencentyun.com/prometheus/${topicId}/api/v1/read
url: https://${region}.cls.tencentcs.com/prometheus/${topicId}/api/v1/read

# 鉴权信息,请替换其中的${SecretId}及${SecretKey}
basic_auth:
username: ${SecretId}
password: ${SecretKey}
url 中 ${region} 为 地域简称,${topicId} 为指标主题 ID。
接口采用 Basic Auth 进行鉴权,将 API 密钥 中的 SecretId 及 SecretKey 分别作为 username 及 password。
username:${SecretId}
password:${SecretKey}
说明:
建议您单独创建一个子账号,使用该账号的 SecretId 及 SecretKey。该账号仅授予如下权限即可,以保障账号安全,配置方式详见 子账号授权
{
"version": "2.0",
"statement": [
{
"effect": "allow",
"action": [
"cls:MetricsRemoteRead"
],
"resource": [
"*"
]
}
]
}

指标上报接口

Prometheus Remote Write API

常用于使用兼容 Prometheus Remote Write 协议的各类采集器采集指标并上报至指标主题,例如 vmagent 及 telegraf。也可将本地 Prometheus 中的指标通过该接口上报至指标主题。使用说明详见 指标上报

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈