Let's say my application publishes AWS CloudWatch metrics with a single dimension. The value of that dimension can be any string. Then, in any given time interval, I'll have something like this:
(myDimension: "foo", value: 12)
(myDimension: "bar", value: 5)
(myDimension: "foo", value: 99)
(myDimension: "quux", value: 42)
Now I want to create an alarm based on a metric derived from this. I want to ignore the values and only count the unique occurrences of each dimension. In this case, the value would be 3 -- 1 for "foo" (even though it appeared twice), 1 for "bar" and 1 for "quux".
How can I do that? I've looked at the Metric Math documentation, but I didn't find any function that could help me. The one that seems to get close is IF
, but I'm not sure if I can use it to solve this problem.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…