AWS Lambda monitoring in production: metrics, cold starts, tracing and failed events in serverless systems

Which Lambda metrics actually matter, how to measure cold starts and memory, how to trace requests across API Gateway, SQS, SNS, EventBridge and Step Functions with OpenTelemetry, and how to make sure no event disappears silently.

Obseria TeamObseria
Summary
  • AWS Lambda monitoring starts with a handful of CloudWatch metrics: Errors relative to Invocations, Duration percentiles against the timeout, Throttles and ConcurrentExecutions, plus IteratorAge, AsyncEventAge and AsyncEventsDropped for event-driven workloads.
  • Cold starts are visible as Init Duration in the REPORT log line, and since August 2025 the INIT phase is billed for on-demand ZIP functions too, so they matter for latency and cost.
  • OpenTelemetry Lambda layers, JSON log format and partial batch responses with dead-letter queues or on-failure destinations turn a collection of functions into a system you can trace end to end.

AWS Lambda monitoring looks simple at first: there are no hosts to watch, no disks to fill and no processes to restart. In practice, serverless monitoring shifts the hard questions somewhere else. Did every event get processed, which function behind an API request is slow, and why did the bill go up?

This guide focuses on the Lambda-specific layer: the metrics worth alerting on, cold starts and memory sizing, structured logs, distributed tracing across managed AWS services, failed and dropped events, and cost visibility. It ends with an alerting table and a checklist you can copy. For the broader AWS picture, see our AWS monitoring integration.

The Lambda metrics that matter

Lambda publishes its metrics to CloudWatch automatically. According to the AWS documentation, invocation metrics should be read with the Sum statistic, performance metrics with Average, Max or percentiles, and concurrency metrics with Max. The core set:

  • Invocations and Errors: divide Errors by Invocations to get the error rate. Errors include exceptions from your code and runtime errors such as timeouts. Throttled requests count as neither.
  • Duration: time spent in your handler, with percentile statistics such as p95 and p99. Duration does not include cold start time, so read it together with Init Duration (see below).
  • Throttles: invocation requests rejected because no concurrency was available. For synchronous callers these surface as TooManyRequestsException errors.
  • ConcurrentExecutions and ClaimedAccountConcurrency: how close a function, or the whole Region, is to its reserved concurrency or account quota.
  • IteratorAge: for Kinesis, DynamoDB Streams and DocumentDB sources, the age of the last record in a batch. A growing IteratorAge means the consumer is falling behind. Kafka sources use OffsetLag instead.
  • AsyncEventsReceived, AsyncEventAge and AsyncEventsDropped: for asynchronous invocations (S3, SNS, EventBridge and direct async calls). AsyncEventAge rises when events are retried; AsyncEventsDropped counts events that were discarded without successful execution.
  • DeadLetterErrors and DestinationDeliveryFailures: your safety net failed. Lambda could not write to the DLQ or the destination, often because of permissions or size limits.

Event source mappings for SQS, Kinesis, DynamoDB and Kafka can also emit opt-in metrics such as PolledEventCount, FailedInvokeEventCount and DroppedEventCount once you enable the metrics config on the mapping. They are worth turning on for critical pipelines.

Cold starts: Init Duration, SnapStart and provisioned concurrency

A cold start happens when Lambda creates a new execution environment: it downloads your code, starts the runtime and runs your initialization code outside the handler. You see it in the REPORT line that Lambda writes after every invocation (example values):

REPORT RequestId: 3f2a... Duration: 182.41 ms Billed Duration: 612 ms
Memory Size: 512 MB Max Memory Used: 141 MB Init Duration: 429.17 ms

The Init Duration field only appears on cold starts. A CloudWatch Logs Insights query gives you the cold start rate and its cost in latency:

filter @type = "REPORT"
| stats count(*) as invocations,
        count(@initDuration) as coldStarts,
        avg(@initDuration) as avgInit,
        max(@initDuration) as maxInit
  by bin(1h)

Two facts make cold starts more than a latency issue. First, AWS standardized INIT billing on August 1, 2025: the INIT phase is now included in billed duration for on-demand invocations of ZIP-packaged functions on managed runtimes as well. Second, cold starts cluster: a traffic spike, a deployment or a scale-out after throttling creates many at once, exactly when users notice.

Your options, according to the AWS documentation:

  • SnapStart snapshots the initialized environment when you publish a version and resumes new environments from it. It currently supports Java 11 and later, Python 3.12 and later and .NET 8 and later, only on published versions or aliases, and not together with provisioned concurrency, EFS or ephemeral storage above 512 MB. For Python and .NET, caching and restore are charged; for Java there is no extra charge. Watch for Restore Duration instead of Init Duration.
  • Provisioned concurrency keeps environments initialized. Monitor ProvisionedConcurrencyUtilization and ProvisionedConcurrencySpilloverInvocations; spillover means requests fell back to on-demand environments and may hit cold starts again.

Timeouts and memory sizing

Lambda allocates CPU in proportion to memory. You can configure 128 MB to 10,240 MB, and at 1,769 MB a function has the equivalent of one vCPU. That makes memory the main performance lever, and it is why the REPORT line is so useful: compare Max Memory Used with Memory Size, and Duration with the configured timeout.

  • Track the duration-to-timeout ratio. If p99 Duration sits at 80 % of the timeout, you will see timeouts on the next slow dependency. Timeouts appear as errors with "Task timed out" in the logs; count them separately.
  • Track memory headroom. A function regularly using more than 90 % of its memory is at risk of out-of-memory errors, and probably CPU-starved as well.
  • Test, do not guess. The open source AWS Lambda Power Tuning tool runs a function at different memory sizes and measures speed and cost; AWS Compute Optimizer can also recommend memory settings for x86_64 functions.
  • Align timeouts along the chain. An API Gateway integration timeout shorter than the function timeout means the client gets an error while the function keeps running and billing.

Structured logs with the Lambda JSON log format

Lambda's advanced logging controls let you switch the log format from Text to JSON in the function's LoggingConfig. For supported runtimes and built-in loggers (for example Python's logging module, Node.js console methods, Java's LambdaLogger or Log4j2, and .NET's ILambdaLogger), application logs are then written as JSON with timestamp, level, message and requestId. System logs such as the report become platform.report records with fields like durationMs, maxMemoryUsedMB and initDurationMs.

aws lambda update-function-configuration \
  --function-name orders-api \
  --logging-config LogFormat=JSON,ApplicationLogLevel=INFO,SystemLogLevel=WARN

With JSON enabled, ApplicationLogLevel and SystemLogLevel filter logs before they reach CloudWatch, which directly reduces ingestion volume. You can also route several functions into a shared custom log group. Add the trace ID, the business key (order ID, tenant) and a cold start flag to every line; our post on structured logging best practices covers field naming and what to keep out of logs.

Distributed tracing across API Gateway, SQS, SNS, EventBridge and Step Functions

A single user action in a serverless system often passes through API Gateway, one or two functions, a queue or topic, an EventBridge rule and a Step Functions workflow. Without context propagation, each hop is its own island.

X-Ray context in managed services

AWS services carry the X-Ray trace header (X-Amzn-Trace-Id) between hops. For SQS, the reserved AWSTraceHeader message system attribute carries it with the message, and when Lambda is the consumer, propagation is automatic. Inside the function, active tracing exposes the current header in the _X_AMZN_TRACE_ID environment variable. Note that the X-Ray SDKs and daemon entered maintenance mode on February 25, 2026, with end of support planned for February 25, 2027; AWS recommends OpenTelemetry-based instrumentation going forward.

OpenTelemetry Lambda layers

There are two families of layers:

  • Community OpenTelemetry layers from the opentelemetry-lambda project, published on its GitHub releases page: instrumentation layers for Java, JavaScript, Python and Ruby, plus a separate Collector layer. You set AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler and the wrapper starts your handler with instrumentation applied.
  • AWS Distro for OpenTelemetry (ADOT) layers for Python, Node.js, Java and .NET, which AWS maintains and which integrate with CloudWatch Application Signals.
# Function environment (example, community layers)
AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
OTEL_SERVICE_NAME=orders-api
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production
OTEL_PROPAGATORS=tracecontext,baggage,xray
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

Include the xray propagator when traces must connect to AWS-managed hops, and tracecontext for your own services. Layers are regional, so use the ARN for your Region and publish a new version after adding them. Because a function can be frozen right after it returns, telemetry must be flushed before the invocation ends; the Collector layer handles this, and our guide to OpenTelemetry Collector best practices applies to where you send it next.

Asynchronous hops like queues often produce linked traces rather than a single parent-child chain, especially when one invocation processes a batch of messages from different requests. Make sure your distributed tracing backend shows span links, otherwise the trail stops at every queue.

Partial batch failures, DLQs and on-failure destinations

The most dangerous serverless failure is the silent one: an event that was retried, expired and dropped, with no error page anywhere. How it happens depends on the invocation type:

  • Asynchronous invocations are retried twice by default after function errors; throttled events are retried for up to six hours by default. You can lower MaximumRetryAttempts and MaximumEventAgeInSeconds, and you should capture what is left with an on-failure destination or a dead-letter queue.
  • SQS event sources: by default, one failing message makes the whole batch visible again. Enable ReportBatchItemFailures and return a batchItemFailures list with the failed itemIdentifier values, so only those messages are retried. Configure a redrive policy on the source queue so poison messages end up in a DLQ.
  • Kinesis and DynamoDB Streams: a failing record blocks its shard until it succeeds or expires. Set MaximumRetryAttempts, MaximumRecordAgeInSeconds and bisect on error, and add an on-failure destination.

Then monitor the safety net itself: DLQ depth via ApproximateNumberOfMessagesVisible and the age of its oldest message, AsyncEventsDropped, DroppedEventCount, DeadLetterErrors and DestinationDeliveryFailures. For SQS sources, AWS suggests watching NumberOfMessagesDeleted and ApproximateAgeOfOldestMessage to confirm batch failure reporting works. Queue monitoring next to the function metrics makes backlogs visible before they turn into dropped events.

Cost visibility: GB-seconds, requests and telemetry

Lambda compute cost is driven by requests and by duration multiplied by memory, usually expressed in GB-seconds. A function with 1,024 MB that runs 300 ms consumes 0.3 GB-seconds per invocation (example values). Since the REPORT line contains Billed Duration and Memory Size, you can compute GB-seconds per function, per endpoint or per tenant from logs, without waiting for the bill. Check current prices on the AWS Lambda pricing page; they differ by Region and architecture.

  • Track GB-seconds per function per day, and annotate dashboards with deployments so you see which release changed the curve.
  • Watch for retry storms: every retry is a billed invocation, and so is every recursive loop (Lambda's loop detection reports RecursiveInvocationsDropped).
  • Remember that telemetry itself costs money. Debug logs at high volume and full tracing of every invocation add up quickly. Filtering and sampling before storage, as described in reducing observability costs pipeline-first, keeps the signal without the noise.

Alerting recommendations and an AWS Lambda monitoring checklist

The thresholds below are examples to start from. Calibrate them against your own baseline, and for user-facing functions prefer SLO-based alerts as described in SLOs in practice.

SignalWhy it mattersAlert (example)
Errors / InvocationsDirect failure rate including timeoutsAbove 1 % for 5 min on a critical function
Duration p99 vs. timeoutTimeouts are nextp99 above 80 % of timeout for 10 min
ThrottlesRequests rejected or delayedAny sustained throttles on a synchronous API
ConcurrentExecutions vs. limitCapacity headroomAbove 80 % of reserved or account concurrency
Cold start rate / Init DurationTail latency and billed INIT timeRate or p95 Init above baseline after a deploy
Max Memory Used / Memory SizeOOM risk, CPU starvationAbove 90 % on repeated invocations
IteratorAge / OffsetLagStream consumer falling behindGrowing for 15 min or above your freshness target
AsyncEventAgeAsync retries piling upAbove 5 min for 10 min
AsyncEventsDropped / DroppedEventCountData lossAny non-zero value
DLQ depth and oldest message ageFailed work waiting for a humanAny new message on a critical DLQ
DeadLetterErrors / DestinationDeliveryFailuresThe safety net is brokenAny non-zero value
GB-seconds per functionCost regressionsDaily value above 1.5x the 14-day average

AWS Lambda monitoring checklist

  • Error rate, Duration p95/p99 and Throttles per function and alias
  • ConcurrentExecutions and ClaimedAccountConcurrency compared with limits
  • Cold start rate and Init Duration (or Restore Duration with SnapStart) from REPORT lines
  • Memory headroom and duration-to-timeout ratio reviewed after each release
  • LogFormat set to JSON with application and system log levels
  • Trace ID, business key and cold start flag on every log line
  • OpenTelemetry or ADOT layer installed, with xray and tracecontext propagators
  • Span links visible for SQS, SNS and EventBridge hops
  • ReportBatchItemFailures enabled on SQS event source mappings
  • Retry limits, maximum event age and on-failure destinations or DLQs configured
  • Alerts on dropped events, DLQ depth, DeadLetterErrors and DestinationDeliveryFailures
  • IteratorAge or OffsetLag alerts for every stream consumer
  • GB-seconds per function tracked; deployment markers on dashboards

How Obseria helps with serverless monitoring

Obseria is an OpenTelemetry-native observability platform, so the community and ADOT Lambda layers, JSON logs and CloudWatch metrics described above work without a proprietary agent. The AWS Lambda integration and serverless monitoring bring function metrics, REPORT data, traces and logs from the same invocation into one view.

  • Obseria Pipeline filters, samples and masks personal data in Lambda telemetry before it is stored in the EU.
  • Obseria TopoGraph maps functions to their queues, topics, event buses and databases, including span links across asynchronous hops.
  • Obseria Intelligence connects a throttling spike, a growing DLQ and a recent deployment into one root cause with evidence.
  • SLOs with burn-rate alerts cover serverless APIs as well as container services.

You can connect your first Lambda functions in minutes with a free Obseria trial.

Share

Observability that delivers answers.

Start for free with OpenTelemetry, no credit card required.