cdk-monitoring-constructs icon indicating copy to clipboard operation
cdk-monitoring-constructs copied to clipboard

[core] Support query metrics

Open echeung-amzn opened this issue 2 years ago • 2 comments

Currently MetricsFactory has createMetricMath, createMetricSearch, createMetricAnomaly. It doesn't have createMetricQuery.

Why I need this?

I have metric with dimension: [Program, Operation, EntityType, StatusFamily, StatusCode]

Now to compute availability metrics, it will be 1- count(fault_request)/count(valid_request)

success_request: StatusFamily=SUCCESSFUL fault_request: StatusFamily=SERVER_ERROR error_request: StatusFamily=CLIENT_ERROR

Now, in each family there can be multiple statusCode. This can be better done using query metrics.

echeung-amzn avatar Mar 08 '22 21:03 echeung-amzn

Let me please clarify. So there would be a new method, taking a string query as an input, and returning an IMetric object to be used in metric math, like this?

voho avatar Jul 06 '22 07:07 voho

The original requester had requested it a while back, but they were likely referring to Metric Insights, which are usable with MathExpressions.

It might be possible that you can just pass a query to createMetricMath and have it work, but would need to be confirmed.

echeung-amzn avatar Jul 15 '22 19:07 echeung-amzn