Types of metrics for Lambda functions (original) (raw)

This section describes the types of Lambda metrics available in the CloudWatch console.

Topics

Invocation metrics

Invocation metrics are binary indicators of the outcome of a Lambda function invocation. View these metrics with the Sum statistic. 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 theSum of the Errors metric with a period of 1 minute.

Performance metrics

Performance metrics provide performance details about a single function invocation. For example, the Duration metric indicates the amount of time in milliseconds that your function spends processing an event. To get a sense of how fast your function processes events, view these metrics with the Average or Max statistic.

Duration also supports percentile (p) statistics. Use percentiles to exclude outlier values that skew Average andMaximum statistics. For example, the p95 statistic shows the maximum duration of 95 percent of invocations, excluding the slowest 5 percent. For more information, see Percentiles in the Amazon CloudWatch User Guide.

Concurrency metrics

Lambda reports concurrency metrics as an aggregate count of the number of instances processing events across a function, version, alias, or AWS Region. To see how close you are to hitting concurrency limits, view these metrics with the Max statistic.

Asynchronous invocation metrics

Asynchronous invocation metrics provide details about asynchronous invocations from event sources and direct invocations. You can set thresholds and alarms to notify you of certain changes. For example, when there's an undesired increase in the number of events queued for processing (AsyncEventsReceived). Or, when an event has been waiting a long time to be processed (AsyncEventAge).

Event source mapping metrics

Event source mapping metrics provide insights into the processing behavior of your event source mapping. These metrics help you monitor the flow and status of events, including events that your event source mapping successfully processed, filtered, or dropped.

You must opt-in to receive metrics related to counts (PolledEventCount,FilteredOutEventCount, InvokedEventCount,FailedInvokeEventCount, DroppedEventCount,OnFailureDestinationDeliveredEventCount, and DeletedEventCount). To opt-in, you can use the console or the Lambda API.

To enable metrics or an event source mapping (console)
  1. Open the Functions page of the Lambda console.
  2. Choose the function you want to enable metrics for.
  3. Choose Configuration, then choose Triggers.
  4. Choose the event source mapping that you want to enable metrics for, then chooseEdit.
  5. Under Event source mapping configuration, choose Enable metrics.
  6. Choose Save.

Alternatively, you can enable metrics for your event source mapping programmatically using the EventSourceMappingMetricsConfig object in your EventSourceMappingConfiguration. For example, the following UpdateEventSourceMapping CLI command enables metrics for an event source mapping:

aws lambda update-event-source-mapping \
    --uuid a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
    --metrics-config Metrics=EventCount

View metrics related to event counts with the Sum statistic.

Warning

Lambda event source mappings process each event at least once, and duplicate processing of records can occur. Because of this, events may be counted multiple times in metrics that involve event counts.

Note

The timestamp for the FailedInvokeEventCount metric represents the end of the function invocation. This behavior differs from other Lambda invocation error metrics, which are timestamped at the start of the function invocation.

If your event source mapping is disabled, you won't receive event source mapping metrics. You may also see missing metrics if CloudWatch or Lambda is experiencing degraded availability.

Not every event source mapping metric is available for each event source. Currently, event source mapping metrics are available for Amazon SQS, Kinesis, and DynamoDB streams event sources. The following availability matrix summarizes the supported metrics for each type of event source.

Event source mapping metric Support for Amazon SQS Support for Kinesis and DynamoDB streams
PolledEventCount Yes Yes
FilteredOutEventCount Yes Yes
InvokedEventCount Yes Yes
FailedInvokeEventCount Yes Yes
DroppedEventCount No Yes
OnFailureDestinationDeliveredEventCount No Yes
DeletedEventCount Yes No

In addition, if your event source mapping is in provisioned mode, Lambda provides the following metric: