cls_query_range_metric
Query metric data over time ranges using PromQL syntax to analyze trends, monitor historical performance, and compare metrics across different periods.
Instructions
查询 CLS 指标数据(时间范围)。支持 PromQL 兼容查询语法,获取一段时间内的指标变化趋势。
参数说明
topic_id: 指标主题 ID(必填),注意是时序指标主题 ID,非普通日志主题 ID。格式不固定,可能是 UUID 或自定义字符串。当用户提供的值不确定是 ID 还是名称时,优先当作 topic_id 直接使用;如果报错,再通过 cls_describe_topics(biz_type=1) 按名称搜索获取正确的指标主题 ID
query: 指标查询语句(必填),PromQL 兼容语法
start_time: 起始时间,Unix 时间戳(秒)
end_time: 结束时间,Unix 时间戳(秒)
step: 步长(秒),数据点之间的间隔,默认 60
region: 地域(可选),如 ap-guangzhou、na-ashburn,不传则使用默认地域,可通过 cls_describe_regions 查询所有可用地域
适用场景
查看指标随时间的变化趋势
告警前查看历史指标走势
对比不同时间段的指标数据
注意事项
⏰ start_time/end_time 为秒级时间戳,请先调用 cls_convert_time 工具转换,不要手动计算
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic_id | Yes | ||
| query | Yes | ||
| start_time | Yes | ||
| end_time | Yes | ||
| step | No | ||
| region | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |