google-cloud-platform - GCP控制台: How are percentile charts calculated?

标签 google-cloud-platform stackdriver percentile google-cloud-stackdriver

我不明白 Google Cloud Platform 监控 UI 中显示百分位数的图表是如何计算的。

以下是我创建标准图表的方法:

日志事件示例

enter image description here

为请求持续时间创建基于日志的指标

这里我配置了20个桶的直方图,从0开始,每个桶耗时100ms。

  • 0 - 100,
  • 100 - 200,
  • ...直到 2 秒

enter image description here

创建图表来显示一段时间内的百分位数

enter image description here

我不明白这些直方图桶如何与“聚合器”、“对齐器”和“对齐周期”一起使用。

UI 强制使用“对齐器”和“对齐周期”。

问题

  • A.如果我尝试计算百分位数,为什么我要对每个“调整周期”的所有响应时间求和?

  • B.为基于日志的指标配置的直方图存储桶是否会影响这些总和?

最佳答案

我几天来一直在研究同一个问题,并找到了 Understanding distribution percentiles官方文档中的部分非常有帮助。

The percentile value is a computed value. The computation takes into account the number of buckets, the width of the buckets, and the total count of samples. Because the actual measured values aren't known, the percentile computation can't rely on this data.

他们有一个很好的存储桶示例 [0, 1) [1, 2) [2, 4) [ 4, 8) [8, 16) [16, 32) [32, 64) [64, 128) [128, 256) 并且最后一个存储桶中只有一个测量结果 [128, 256) (所有其他存储桶中都没有)。

  1. You use the bucket counts to determine that the [128, 256) bucket contains the 50th percentile.
  2. You assume that the measured values within the selected bucket are uniformly distributed and therefore the best estimate of the 50th percentile is the bucket midpoint.

A.如果我尝试计算百分位数,为什么我要对每个“调整周期”的所有响应时间求和?

我发现 Metrics Explorer 的 GCP Console UI 的措辞也有点误导/困惑(但也许只是我不熟悉他们的术语)。这里的关键概念是 Alignment and Reduction ,我认为。

The aligner produces a single value placed at the end of each alignment period.

A reducer is a function that is applied to the values across a set of time series to produce a single value.

两者之间的区别在于水平聚合与垂直聚合。对于 UI,聚合器(主要的和辅助的)都是reducers

回到问题,在 percentile reducer 之前应用 sum 对齐似乎在其他用例中比您的用例更有用。简而言之,meanmax 对齐器可能对您的“duration_ms”指标更有用,但它们在 UI 的下拉列表中不可用,老实说,我也没有弄清楚如何在 MQL 编辑器中实现它们。只是引用这里的文档。还有其他对准器也可能有用,但我暂时将它们排除在外。


B。为基于日志的指标配置的直方图存储桶是否会影响这些总和?

与@Anthony一样,我也不太确定这个问题意味着什么。假设您询问是否可以使用这些对齐器/缩减器对齐/减少基于日志的指标,答案是。但是,您需要知道您使用的指标类型(counterdistribution),并根据需要以相应的方式聚合它们。

关于google-cloud-platform - GCP控制台: How are percentile charts calculated?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59635115/

相关文章:

google-cloud-storage - 我想使用 gcs 将多个域链接到一个存储桶

java - 追踪第二代java应用引擎

logging - 如何关联 Cloud Run 中的请求日志?

numpy - 计算 xarray 中每个网格点的百分位

python - 属性错误 : 'module' object has no attribute 'percentile'

kubernetes - storageclass.storage.k8s.io "standard"在裸机 Kubernetes 集群上找不到 pvc

google-cloud-platform - 在欧洲地区创建了 GCE,但 IP 地址在美国显示

java - Objectify 单元测试将数据持久保存到 Google Cloud Datastore

node.js - 如何从 stackdriver nodejs lib 获取当前跟踪 id 和跨度 id