Amazon Lambda

このページは、Amazon CloudWatch からの AWS Lambda メトリクスの取り込みに特化された文書となっています。Lambda 関数から直接リアルタイムにテレメトリーを収集することについては、Datadog サーバーレスドキュメントを参照してください。

概要

Amazon Lambda は、イベントに応答してコードを実行し、そのコードが必要とするコンピューティングリソースを自動的に管理するコンピューティングサービスです。

このインテグレーションを有効にすると、CloudWatch メトリクスが収集されるようになります。このページでは、Lambda 関数のカスタムメトリクス、ログ、トレースを設定する方法についても説明します。

セットアップ

インストール

Amazon Web Services インテグレーションをまだセットアップしていない場合は、最初にセットアップします。

メトリクスの収集

AWS Lambda メトリクス

  1. AWS インテグレーションページで、Metric Collection タブの下にある Lambda が有効になっていることを確認します。

  2. Amazon Lambda のメトリクスを収集するには、次のアクセス許可を Datadog IAM ポリシーに追加します。詳細については、AWS ウェブサイト上の Lambda ポリシーを参照してください。

    AWS アクセス許可説明
    lambda:List*Lambda 関数、メタデータ、およびタグを一覧表示します。
    tag:GetResourcesLambda 関数に適用されたカスタムタグを取得します。
    cloudtrail:LookupEventsCloudTrail History を使用して Lambda 関数への変更を検出
  3. Datadog - AWS Lambda インテグレーションをインストールします。

完了したら、Datadog Serverless ビューにすべての Lambda 関数が表示されます。このページは、サーバーレスアプリケーションを実行している AWS Lambda 関数からのメトリクス、トレース、ログを 1 つのビューにまとめて表示します。この機能の詳細については、Datadog Serverless のドキュメントを参照してください。

収集データ

メトリクス

aws.lambda.duration
(gauge)
Measures the average elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.maximum
(gauge)
Measures the maximum elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.minimum
(gauge)
Measures the minimum elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.sum
(gauge)
Measures the total execution time of the lambda function executing.
Shown as millisecond
aws.lambda.duration.p50
(gauge)
Measures the p50 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p80
(gauge)
Measures the p80 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p95
(gauge)
Measures the p95 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p99
(gauge)
Measures the p99 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p99.9
(gauge)
Measures the p99.9 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.timeout
(gauge)
Measures the amount of allowed execution time for the function before the Lambda runtime stops it.
Shown as second
aws.lambda.memorysize
(gauge)
Measures the amount of allocated memory available to the function during execution.
Shown as mebibyte
aws.lambda.errors
(count)
Measures the number of invocations that failed due to errors in the function.
Shown as error
aws.lambda.invocations
(count)
Measures the number of times a function is invoked in response to an event or invocation API call.
Shown as invocation
aws.lambda.throttles
(count)
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.
Shown as throttle
aws.lambda.iterator_age
(gauge)
Measures the age of the last record for each batch of records processed
Shown as millisecond
aws.lambda.iterator_age.minimum
(gauge)
Measures the minimum age of the last record for each batch of records processed
Shown as millisecond
aws.lambda.iterator_age.maximum
(gauge)
Measures the maximum age of the last record for each batch of records processed
Shown as millisecond
aws.lambda.iterator_age.sum
(gauge)
Measures the sum of the ages of the last record for each batch of records processed
Shown as millisecond
aws.lambda.dead_letter_errors
(count)
Measures the sum of times Lambda is unable to write the failed event payload to your configured Dead Letter Queues.
Shown as error
aws.lambda.concurrent_executions
(gauge)
Measures the average of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions.minimum
(gauge)
Measures the minimum of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions.maximum
(gauge)
Measures the maximum of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions.sum
(gauge)
Measures the sum of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global
(gauge)
Measures the average of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global.minimum
(gauge)
Measures the minimum of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global.maximum
(gauge)
Measures the maximum of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global.sum
(gauge)
Measures the sum of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.unreserved_concurrent_executions
(gauge)
Measures the sum of the concurrency of the functions that don't have a custom concurrency limit specified.
Shown as execution
aws.lambda.post_runtime_extensions_duration
(gauge)
Measures the average amount of time that the runtime spends running code for extensions after the function code has completed.
Shown as millisecond
aws.lambda.post_runtime_extensions_duration.maximum
(gauge)
Measures the maximum amount of time that the runtime spends running code for extensions after the function code has completed.
Shown as millisecond
aws.lambda.post_runtime_extensions_duration.minimum
(gauge)
Measures the minimum amount of time that the runtime spends running code for extensions after the function code has completed.
Shown as millisecond
aws.lambda.post_runtime_extensions_duration.sum
(gauge)
Measures the cumulative amount of time that the runtime spends running code for extensions after the function code has completed.
Shown as millisecond
aws.lambda.post_runtime_extensions_duration.p50
(gauge)
Measures the p50 elapsed wall time that the runtime spends running code for extensions after the function code has completed.
Shown as millisecond
aws.lambda.post_runtime_extensions_duration.p99
(gauge)
Measures the p90 elapsed wall time that the runtime spends running code for extensions after the function code has completed.
Shown as millisecond
aws.lambda.provisioned_concurrent_executions
(gauge)
Measures the average number of events that are being processed on provisioned concurrency
Shown as execution
aws.lambda.provisioned_concurrent_executions.minimum
(gauge)
Measures the minimum number of events that are being processed on provisioned concurrency
Shown as execution
aws.lambda.provisioned_concurrent_executions.maximum
(gauge)
Measures the maximum number of events that are being processed on provisioned concurrency
Shown as execution
aws.lambda.provisioned_concurrency_invocations
(count)
Measures the number of invocations that are run on provisioned concurrency
Shown as invocation
aws.lambda.provisioned_concurrency_spillover_invocations
(count)
Measures the number of invocations that are run on non-provisioned concurrency when all provisioned concurrency is in use
Shown as invocation
aws.lambda.provisioned_concurrency_utilization
(gauge)
Measures the average fraction of provisioned concurrency in use for a given function at a given point in time
Shown as percent
aws.lambda.provisioned_concurrency_utilization.minimum
(gauge)
Measures the minimum fraction of provisioned concurrency in use for a given function at a given point in time
Shown as percent
aws.lambda.provisioned_concurrency_utilization.maximum
(gauge)
Measures the maximum fraction of provisioned concurrency in use for a given function at a given point in time
Shown as percent
aws.lambda.signature_validation_errors
(count)
Measures the number of times a function is successfully deployed but fails a signature check
Shown as error
aws.lambda.url_request_count
(count)
The number of requests hit this Function URL.
Shown as request
aws.lambda.url_4xx_error
(count)
The number of requests that returned a 4xx HTTP status code.
Shown as error
aws.lambda.url_5xx_error
(count)
The number of requests that returned a 5xx HTTP status code.
Shown as error
aws.lambda.url_latency
(gauge)
The time between when a request was received by the Function URL and when it receives a response from the function
Shown as millisecond
aws.lambda.url_latency.minimum
(gauge)
The minimum time between when a request was received by the Function URL and when it receives a response from the function
Shown as millisecond
aws.lambda.url_latency.maximum
(gauge)
The maximum time between when a request was received by the Function URL and when it receives a response from the function
Shown as millisecond
aws.lambda.url_latency.p50
(gauge)
The 50th percentile time between when a request was received by the Function URL and when it receives a response from the function
Shown as millisecond
aws.lambda.url_latency.p99
(gauge)
The 99th percentile time between when a request was received by the Function URL and when it receives a response from the function
Shown as millisecond
aws.lambda.enhanced.invocations
(count)
Measures the number of times a function is invoked in response to an event or invocation API call.
Shown as invocation
aws.lambda.enhanced.errors
(count)
Measures the number of invocations that failed due to errors in the function.
Shown as error
aws.lambda.enhanced.max_memory_used
(gauge)
Measures the maximum amount of memory (mb) used by the function.
Shown as mebibyte
aws.lambda.enhanced.duration
(gauge)
Measures the elapsed seconds from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as second
aws.lambda.enhanced.billed_duration
(gauge)
Measures the billed amount of time the function ran for.
Shown as second
aws.lambda.enhanced.init_duration
(gauge)
Measures the initialization time (second) of a function during a cold start.
Shown as second
aws.lambda.enhanced.estimated_cost
(gauge)
Measures the total estimated cost of the function invocation (US dollars).
Shown as dollar
aws.lambda.enhanced.timeouts
(count)
Measures the number of times a function times out.
Shown as timeout
aws.lambda.enhanced.out_of_memory
(count)
Measures the number of times a function runs out of memory.
Shown as error
aws.lambda.enhanced.memorysize
(gauge)
Measures the amount of allocated memory (mb) available to the function during execution.
Shown as mebibyte
aws.lambda.enhanced.runtime_duration
(gauge)
Measures the elapsed milliseconds from when the function code starts to when it returns the response.
Shown as millisecond
aws.lambda.enhanced.post_runtime_duration
(gauge)
Measures the elapsed milliseconds from when the function returns the response to when the extensions finish performing activities like sending telemetry data to a preferred destination after the function’s response is returned.
Shown as millisecond
aws.lambda.enhanced.response_latency
(gauge)
Measures the elapsed time in milliseconds from when the invocation request is received to when the first byte of response is sent to the client.
Shown as millisecond
aws.lambda.enhanced.response_duration
(gauge)
Measures the elapsed time in milliseconds from when the first byte of response to the last byte of response is sent to the client.
Shown as millisecond
aws.lambda.enhanced.produced_bytes
(gauge)
Measures the number of bytes returned by a function.
Shown as byte

AWS から取得される各メトリクスには、関数名やセキュリティグループなど、AWS コンソールに表示されるタグと同じタグが割り当てられます。

イベント

AWS Lambda インテグレーションは、Datadog サーバーレスデプロイの追跡を有効にすると、AWS CloudTrail から Lambda のデプロイイベントを収集することができます。

サービスのチェック

AWS Lambda インテグレーションには、サービスのチェック機能は含まれません。

リアルタイムの拡張 Lambda メトリクス

詳細は、サーバーレスドキュメントでご確認ください。

カスタムメトリクス

詳細は、サーバーレスドキュメントでご確認ください。

ログの収集

詳細は、サーバーレスドキュメントでご確認ください。

トレースの収集

詳細は、サーバーレスドキュメントでご確認ください。

Lambda@Edge

Datadog は、Lambda のメトリクスに at_edgeedge_master_nameedge_master_arn タグを自動的に追加し、Lambda 関数のメトリクスとログが Edge ロケーションで実行されると集約的に表示されるようにします。

Lambda@Edge 関数では、分散型トレーシングは_サポートされていません_。

トラブルシューティング

ご不明な点は、Datadog のサポートチームまでお問合せください。

その他の参考資料