CloudWatch Lambda Insights 中的示例遥测事件
每次调用启用了 Lambda Insights 的 Lambda 函数,都会向 /aws/lambda-insights
日志组写入一个日志事件。每个日志事件都包含嵌入式指标格式的指标。有关嵌入式指标格式的更多信息,请参阅在日志中嵌入指标。
您可以使用以下方法分析这些日志事件:
CloudWatch 控制台的 Lambda Insights 部分(见 查看 Lambda Insights 指标 中的说明)。
使用 CloudWatch Logs Insights 记录事件查询。有关更多信息,请参阅使用 CloudWatch Logs Insights 分析日志数据。
LambdaInsights
命名空间中收集的指标,您可以通过使用 CloudWatch 指标来绘制这些指标的图形。
以下是嵌入式指标格式的 Lambda Insights 日志事件示例。
{ "_aws": { "Timestamp": 1605034324256, "CloudWatchMetrics": [ { "Namespace": "LambdaInsights", "Dimensions": [ [ "function_name" ], [ "function_name", "version" ] ], "Metrics": [ { "Name": "memory_utilization", "Unit": "Percent" }, { "Name": "total_memory", "Unit": "Megabytes" }, { "Name": "used_memory_max", "Unit": "Megabytes" }, { "Name": "cpu_total_time", "Unit": "Milliseconds" }, { "Name": "tx_bytes", "Unit": "Bytes" }, { "Name": "rx_bytes", "Unit": "Bytes" }, { "Name": "total_network", "Unit": "Bytes" }, { "Name": "init_duration", "Unit": "Milliseconds" } ] } ], "LambdaInsights": { "ShareTelemetry": true } }, "event_type": "performance", "function_name": "cpu-intensive", "version": "Blue", "request_id": "12345678-8bcc-42f7-b1de-123456789012", "trace_id": "1-5faae118-12345678901234567890", "duration": 45191, "billed_duration": 45200, "billed_mb_ms": 11571200, "cold_start": true, "init_duration": 130, "tmp_free": 538329088, "tmp_max": 551346176, "threads_max": 11, "used_memory_max": 63, "total_memory": 256, "memory_utilization": 24, "cpu_user_time": 6640, "cpu_system_time": 50, "cpu_total_time": 6690, "fd_use": 416, "fd_max": 32642, "tx_bytes": 4434, "rx_bytes": 6911, "timeout": true, "shutdown_reason": "Timeout", "total_network": 11345, "agent_version": "1.0.72.0", "agent_memory_avg": 10, "agent_memory_max": 10 }