简体   繁体   English

CloudWatch 不会为自定义资源跨维度聚合数据——这究竟意味着什么?

[英]CloudWatch doesn't aggregate data across dimensions for custom resources - what does it really mean?

Let's lay out some definitions before getting to the question itself.在回答问题本身之前,让我们列出一些定义。 Based on the CloudWatch concepts page in the docs.基于文档中的CloudWatch 概念页面。

So we have metric , which is a set of time-oredered set of datapoints.所以我们有metric ,它是一组按时间排序的数据点集。 A metric is uniquely identitfied by it's namespace, name, and set of dimensions .度量由其名称空间、名称和维度集唯一标识。

A dimension is a key=value pair which is part of the identity of a metric.维度是键=值对,它是度量标识的一部分。 So for example a metric called ServerStats with the dimensions Domain=Frankfurt,Server=Prod is not the same metric as the metric called ServerStats with the dimensions Domain=Rio,Server=Beta .因此,例如,名为ServerStats且维度为Domain=Frankfurt,Server=Prod的指标与名为ServerStats且维度为Domain=Rio,Server=Beta的指标不同。

Now let's move to an example, and from there to the question:现在让我们转到一个示例,然后从那里转到问题:

Let's ride on the example given in the docs.让我们以文档中给出的示例为例。 Say I have 2 servers (Prod and Beta) in Frankfurt, and 2 servers (Prod and Beta) in Rio, which are publishing data points (which represent some count) regularly to CloudWatch, as such:假设我在法兰克福有 2 台服务器(Prod 和 Beta),在里约热内卢有 2 台服务器(Prod 和 Beta),它们定期向 CloudWatch 发布数据点(代表一些计数),如下所示:

Dimensions: Server=Prod, Domain=Frankfurt, Unit: Count, Timestamp: 2016-10-31T12:30:00Z, Value: 105
Dimensions: Server=Beta, Domain=Frankfurt, Unit: Count, Timestamp: 2016-10-31T12:31:00Z, Value: 115
Dimensions: Server=Prod, Domain=Rio,       Unit: Count, Timestamp: 2016-10-31T12:32:00Z, Value: 95
Dimensions: Server=Beta, Domain=Rio,       Unit: Count, Timestamp: 2016-10-31T12:33:00Z, Value: 97

I've created a script to simulate this situation.我创建了一个脚本来模拟这种情况。 If I go to my CloudWatch console, I can see my metrics:如果我 go 到我的 CloudWatch 控制台,我可以看到我的指标: 在此处输入图像描述

So now that we have our example set up, I want to understand the statement in the docs:所以现在我们已经设置了示例,我想了解文档中的声明:

For metrics produced by certain AWS services, such as Amazon EC2, CloudWatch can aggregate data across dimensions.对于某些 AWS 服务(例如 Amazon EC2)生成的指标,CloudWatch 可以跨维度聚合数据。 For example, if you search for metrics in the AWS/EC2 namespace but do not specify any dimensions, CloudWatch aggregates all data for the specified metric to create the statistic that you requested.例如,如果您在 AWS/EC2 命名空间中搜索指标但未指定任何维度,CloudWatch 会聚合指定指标的所有数据以创建您请求的统计数据。 CloudWatch does not aggregate across dimensions for your custom metrics. CloudWatch 不会跨维度聚合您的自定义指标。

If I understand correctly, aggregating dimensions mean to specify a namespace of metrics, or a metric name, without any dimensions, and get an aggregate of the metrics of that name.如果我理解正确的话,聚合维度意味着指定一个度量的命名空间,或者一个度量名称,没有任何维度,并获得该名称的度量的聚合。 So for example, in the AWS/EC2 namespace there are metrics called CPUUtilization .因此,例如,在AWS/EC2命名空间中有称为CPUUtilization的指标。 Some of them have the dimension InstanceId , and some have the dimension ImageId , and CloudWatch can aggregate those metrics to give us an overall CPUUtilization of all those metrics.其中一些具有维度InstanceId ,一些具有维度ImageId ,CloudWatch 可以聚合这些指标,为我们提供所有这些指标的总体 CPUUtilization。

Now, in our example, It is possible to get an aggregate of all the Server=Prod metrics.现在,在我们的示例中,可以获得所有Server=Prod指标的聚合。 If I run the following query:如果我运行以下查询:

SELECT SUM(ServerStats) FROM DataCenter WHERE Server = 'Prod'

I get an aggregate of 2 metrics: Server=Prod,Location=Frankfurt and Server=Prod,Location=Rio :我得到了 2 个指标的总和: Server=Prod,Location=FrankfurtServer=Prod,Location=Rio

在此处输入图像描述

You can see that the Query1 metric's value is the addition of both other values (which are Prod Frankfurt and Prod Rio)您可以看到Query1指标的值是其他两个值(分别是 Prod Frankfurt 和 Prod Rio)的相加

So I don't quite understand what is meant by this paragraph I've cited above, about that CloudWatch cannot aggregate data across dimensions for custom metrics.所以我不太明白我上面引用的这一段是什么意思,关于 CloudWatch 无法跨维度聚合自定义指标的数据。

Can someone clarify this?有人可以澄清一下吗?

It is poorly worded and out of date documentation on CloudWatch side. CloudWatch 方面的措辞不佳且文档已过时。 What they mean is that they won't aggregate and store your data as a new metric.他们的意思是他们不会将您的数据汇总并存储为新指标。 There will be no one particular metric that will contain the aggregation you need.不会有任何一个特定指标包含您需要的聚合。

You can however use metric math and metric insight feature to calculate the aggregation on the fly, like you did above.但是,您可以使用度量数学和度量洞察功能来动态计算聚合,就像您在上面所做的那样。 These methods have limits though.这些方法虽然有局限性。 Metric math is limited to 500 metrics.度量数学限制为 500 个度量。 Metric Insights can aggregate up to 10000 metrics, but it's limited to latest 3 hours of data. Metric Insights 最多可以聚合 10000 个指标,但仅限于最近 3 小时的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM