Serverless Function Error Rate Monitored (AWS)

  • Updated

This test looks at all CloudWatch alarms where the namespace is AWS/Lambda and the metricName is Errors. These are CloudWatch alarms that are specific to Lambdas.




Test Data Insights

  • This test evaluates monitoring status using the resource data below to determine your Alarm's association with your Lambda functions
  • To view your test data, Export it as a CSV or View the raw JSON as seen below
  • A dimensions property contains a FunctionName that should be equal to the name of the Lambda function it monitors. This would mean you'd see as many alarms as lambda's (in most cases).
  • The raw data has all lambda functions listed an all CloudWatch alarms with the namespace AWS/Lambda and the metricName Errors . So, it’s all cloudwatch alarms relevant to this test. 

Once you've Graphed your Errors Metric: You can easily create an Alarm by clicking the Graphed metric's Details followed by Create Alarm:

View the below AWS Article snippets to learn more about AWS Lambda invocation Metrics and how to Graph your Errors metric.


Viewing metrics on the CloudWatch console

The CloudWatch console can filter and sort function metrics by function name, alias, or version.

To view metrics on the CloudWatch console
  • Open the Metrics page (AWS/Lambda namespace) of the CloudWatch console.

  • On the Browse tab, under Metrics, choose any of the following dimensions:

    • By Function Name (FunctionName) – View aggregate metrics for all versions and aliases of a function.

    • By Resource (Resource) – View metrics for a version or alias of a function.

    • By Executed Version (ExecutedVersion) – View metrics for a combination of alias and version. Use the ExecutedVersion dimension to compare error rates for two versions of a function that are both targets of a weighted alias.

    • Across All Functions (none) – View aggregate metrics for all functions in the current AWS Region.

  • Choose a metric, then choose Add to graph or another graphing option.

By default, graphs use the Sum statistic for all metrics. To choose a different statistic and customize the graph, use the options on the Graphed metrics tab.


Types of metrics

The following section describes the types of Lambda metrics available on the CloudWatch console.


Invocation metrics

Invocation metrics are binary indicators of the outcome of a Lambda function invocation. For example, if the function returns an error, then Lambda sends the Errors metric with a value of 1. To get a count of the number of function errors that occurred each minute, view the Sum of the Errors metric with a period of 1 minute.


View the following invocation metrics with the Sum statistic.

  • Invocations – The number of times that your function code is invoked, including successful invocations and invocations that result in a function error. Invocations aren't recorded if the invocation request is throttled or otherwise results in an invocation error. The value of Invocations equals the number of requests billed.

  • Errors – The number of invocations that result in a function error. Function errors include exceptions that your code throws and exceptions that the Lambda runtime throws. The runtime returns errors for issues such as timeouts and configuration errors. To calculate the error rate, divide the value of Errors by the value of Invocations. Note that the timestamp on an error metric reflects when the function was invoked, not when the error occurred.