You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cloudwatch使用问题:如何在查询中正确使用percentile百分位统计功能?

CloudWatch 百分位功能说明

CloudWatch 完全支持百分位统计能力,你遇到的报错是函数拼写错误导致的:你写的precentile是错误拼写,正确的函数名是percentile。

正确使用方式

你要获取指标someValue的p90值,正确的CloudWatch Logs Insights查询语句为:

| stats percentile(someValue, 90) as p90_someValue

扩展常用场景

  • 同时统计多个百分位数值,比如同步获取p50、p95、p99:
| stats percentile(someValue, 50) as p50, percentile(someValue, 95) as p95, percentile(someValue, 99) as p99
  • 搭配分组规则统计不同维度的百分位,比如按接口路径分组统计各接口的p90响应耗时:
| stats percentile(request_time, 90) as p90_time by request_path

如果你是直接查询CloudWatch原生指标而非日志,在控制台或者API调用时,直接选择统计方式为p+对应百分位数值即可,比如选择p90作为统计函数就能得到该指标的90百分位值。

内容的提问来源于stack exchange,提问作者Gambit2007

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.23 19:36:02