I would like to create a widget on an AWS dashboard that measures how many invocations per minute of a given Lambda function exceed a certain duration threshold (for instance, 1 second).
This should be achieved _without using CloudWatch Logs / grepping log files.
My idea was to add a math function that transforms the duration time series into a new time series with values 1 or 0 (depending on whether or whether not the duration is above or below the threshold), and sum up the latter one, so I ended up in something like:
{
"title": "My function: Durations > 1000 ms",
"metrics": [
[ { "expression": "m1>1000", "id": "e1" } ],
[ "AWS/Lambda", "Duration", "FunctionName", "myFunction", { "id": "m1", "visible": false} ]
],
"period": 60,
"stat": "Sum",
"region": "eu-central-1"
}
But – contrary to my expectation – this never leads to a value larger than 1, so it seems not to sum up the data points.
Did anybody come along the same or similar problem and has a solution for it?
Thomas Dupré is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.