メニュー
AWS Lambda
開発者ガイド

AWS Lambda のメトリクス

このトピックでは、AWS Lambda の名前空間、メトリクス、ディメンションについて説明します。AWS Lambda はお客様の代わりに自動的に関数をモニタリングし、Amazon CloudWatch を通じてメトリクスを報告します。これらのメトリクスには、合計の呼び出し、エラー、所要時間、および調整が含まれます。

CloudWatch は、基本的にはメトリクスのレポジトリーです。メトリクスは CloudWatch の基本的概念で、時系列に並んだデータポイントのセットを表しています。ユーザー (または AWS サービス) がメトリクスのデータポイントを CloudWatch にパブリッシュし、ユーザーはこのデータポイントに関する統計を、時系列順に並べられたデータのセットとして取得できます。

メトリクスは名前、名前空間、1 つ以上のディメンションで一意に定義されます。各データポイントには、タイムスタンプと、オプションとして測定単位があります。統計を要求した場合、返されるデータストリームは、名前空間、メトリクス名、ディメンションによって識別されます。CloudWatch の詳細については、『Amazon CloudWatch ユーザーガイド』を参照してください。

AWS Lambda CloudWatch Metrics

The AWS/Lambda namespace includes the following metrics.

Metric Description
Invocations

Measures the number of times a function is invoked in response to an event or invocation API call. This replaces the deprecated RequestCount metric. This includes successful and failed invocations, but does not include throttled attempts. This equals the billed requests for the function. Note that AWS Lambda only sends these metrics to CloudWatch if they have a nonzero value.

Units: Count

Errors

Measures the number of invocations that failed due to errors in the function (response code 4XX). This replaces the deprecated ErrorCount metric. Failed invocations may trigger a retry attempt that succeeds. This includes:

  • Handled exceptions (for example, context.fail(error))

  • Unhandled exceptions causing the code to exit

  • Out of memory exceptions

  • Timeouts

  • Permissions errors

This does not include invocations that fail due to invocation rates exceeding default concurrent limits (error code 429) or failures due to internal service errors (error code 500).

Units: Count

Dead Letter Error

Incremented when Lambda is unable to write the failed event payload to your configured Dead Letter Queues. This could be due to the following:

  • Permissions errors

  • Throttles from downstream services

  • Misconfigured resources

  • Timeouts

Units: Count

Duration

Measures the elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing. This replaces the deprecated Latency metric. The maximum data point value possible is the function timeout configuration. The billed duration will be rounded up to the nearest 100 millisecond. Note that AWS Lambda only sends these metrics to CloudWatch if they have a nonzero value.

Units: Milliseconds

Throttles

Measures the number of Lambda function invocation attempts that were throttled due to invocation rates exceeding the customer’s concurrent limits (error code 429). Failed invocations may trigger a retry attempt that succeeds.

Units: Count

IteratorAge

Emitted for stream-based invocations only (functions triggered by an Amazon DynamoDB stream or Amazon Kinesis stream). Measures the age of the last record for each batch of records processed. Age is the difference between the time Lambda received the batch, and the time the last record in the batch was written to the stream.

Units: Milliseconds

Errors/Invocations Ratio

When calculating the error rate on Lambda function invocations, it’s important to distinguish between an invocation request and an actual invocation. It is possible for the error rate to exceed the number of billed Lambda function invocations. Lambda reports an invocation metric only if the Lambda function code is executed. If the invocation request yields a throttling or other initialization error that prevents the Lambda function code from being invoked, Lambda will report an error, but it does not log an invocation metric.

  • Lambda emits Invocations=1 when the function is executed. If the Lambda function is not executed, nothing is emitted.

  • Lambda emits a data point for Errors for each invoke request. Errors=0 means that there is no function execution error. Errors=1 means that there is a function execution error.

  • Lambda emits a data point for Throttles for each invoke request. Throttles=0 means there is no invocation throttle. Throttles=1 means there is an invocation throttle.

AWS Lambda CloudWatch Dimensions

You can use the dimensions in the following table to refine the metrics returned for your Lambda functions.

Dimension Description
FunctionName

Filters the metric data by Lambda function.

Resource

Filters the metric data by Lambda function resource.

Version

Filters the metric data by Lambda version.

Alias

Filters the metric data by Lambda alias.