Cloudwatch 指标中的元数据(替代维度?)

Metadata in Cloudwatch metrics (alternative to dimensions?)

我正在将自定义指标数据记录到 AWS Cloudwatch 中并尝试绘制图表。我假设 Cloudwatch 中的 Dimensions 是用于丰富我的数据的元数据,但似乎一旦添加维度就可以 no longer query across different combinations of dimensions。因此,对于一个人来说,我并没有真正看到维度的意义,因为任何独特的组合基本上只是一个新指标。但更重要的是,有一种方法可以记录一组具有不同标签或维度的数据,然后对该数据进行切片和切块(例如,在 Grafana 中)。

为了使其更具体,我在我的应用程序中记录了缓存加载时间。我有一个名为“cache-miss”的指标,有几个维度,例如:

  1. 缓存的集合
  2. 与缓存数据关联的客户

我想要几张不同的图表:

是否有一些方法可以通过 Cloudwatch 指标 and/or Grafana(或替代工具)实现这一点?

如您所述 - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html :

CloudWatch treats each unique combination of dimensions as a separate metric, even if the metrics have the same metric name. You can only retrieve statistics using combinations of dimensions that you specifically published. When you retrieve statistics, specify the same values for the namespace, metric name, and dimension parameters that were used when the metrics were created.

因此,如果您使用 2 个维度推送了 Total cache misses,则您只能使用 2 个维度查询此指标。所以你真的不能只看到一段时间内的计数。

可能的解决方法:

或者您可以从 CloudWatch 切换到更适合您的用例的 TSDB。