Monitoring guide
AWS Lambda monitoring
Lambda hides the servers, not the problems. Errors, throttles, cold starts and slow downstream calls still need watching, per function.
3 min read11 sectionsUpdated
On this page
| Metric | Worry when |
|---|---|
| Errors | Above 0 sustained, or above a small rate |
| Throttles | Any: concurrency limit reached |
| Duration (p95, max) | Approaching the configured timeout |
| ConcurrentExecutions | Near the account or reserved limit |
| IteratorAge (stream triggers) | Growing: the function cannot keep up |
| DLQ / on-failure destination messages | Any |
Cold starts
Each REPORT log line includes Init Duration when the invocation was a cold start. Large deployment packages, heavy imports and VPC setup lengthen it. Options: smaller packages, lazy imports, provisioned concurrency for latency-sensitive functions, and SnapStart where supported.
REPORT RequestId: 3f1c... Duration: 182.43 ms Billed Duration: 183 ms Memory Size: 512 MB Max Memory Used: 141 MB Init Duration: 612.08 msTracing
The OpenTelemetry Lambda layers (per language) instrument the handler and outgoing calls and export through an embedded Collector. Configure it to send traces to an OTLP endpoint; for VitalRix, the collector's otlphttp exporter with your API key, as in what is OTLP. Flush before the function returns, or spans can be lost when the environment freezes.
Lambda monitoring with VitalRix
Pull AWS/Lambda metrics through the CloudWatch integration and alert on errors, throttles and duration; send traces with OpenTelemetry for APM views per function; and add uptime checks on the API Gateway URLs that front them.
Structured logs from functions
Lambda writes everything you print to CloudWatch Logs. Write JSON lines with a request id and, when traced, the trace id, so a failed invocation's log lines can be found and linked to its trace. Keep debug output off by default; log volume is billed per GB ingested.
export const handler = async (event, context) => {
console.log(JSON.stringify({ level: 'info', msg: 'order received', requestId: context.awsRequestId, orderId: event.orderId }));
// ...
};Concurrency and throttles
All functions in a region share the account's concurrency limit unless you reserve some for a function. A traffic spike in one function can throttle others. Reserve concurrency for critical functions, alert on Throttles for each, and watch ConcurrentExecutions against the account limit.
Check it now, free
- Is AWS down? Live status: checked every few minutes, with outage history.
Related reading
- What is a span in tracing?: What a span is in distributed tracing: its fields, parent and child spans, span kinds, attributes and status, with an annotated example you can read.
- How to monitor a Next.js app: How to monitor a Next.js app in production: uptime checks, Core Web Vitals, server and edge errors, OpenTelemetry traces for SSR and API routes, and alerts.
- OpenTelemetry for FastAPI: Trace a FastAPI service with OpenTelemetry: instrument the app, async database drivers and httpx, run uvicorn workers correctly and export.
- OpenTelemetry for Go: Instrument a Go service with OpenTelemetry: set up the tracer provider, wrap net/http with otelhttp, pass context everywhere and export the spans.
- OpenTelemetry for PHP and Laravel: Trace a Laravel app with OpenTelemetry: install the PHP extension and auto-instrumentation packages, configure PHP-FPM and trace queries.
- OpenTelemetry for NestJS: Trace a NestJS service with OpenTelemetry: load the SDK before Nest boots, instrument HTTP, Express and NestJS core, and export JSON to VitalRix.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.