Observability Best Practices
These are the habits that keep AWS SDK telemetry useful and affordable, instead of noisy and expensive.
Search across all documentation pages
These are the habits that keep AWS SDK telemetry useful and affordable, instead of noisy and expensive.
Walk the list once now, then treat it as a review checklist before adding logging or tracing to a new service.
response["ResponseMetadata"]["RequestId"] (boto3) or response.$metadata.requestId (SDK v3) is the field AWS support needs first.operation, duration_ms, outcome) are what make logs queryable across a fleet, not any single library's features.info, failures at warning/error, so alerting and filtering by severity actually works.json.dumps(...) or a structured logger beats an interpolated sentence for anything you intend to filter or graph later.Authorization header must never reach a log line, structured or not.captureAWSv3Client / patch(["boto3"]) (X-Ray) or the botocore/AWS SDK OTel instrumentation packages once, so every call is traced automatically.Log identifiers and outcomes, never raw payloads. Every other practice here builds on top of that boundary, and getting it wrong is the one mistake with real security and privacy consequences.
No. High-throughput services should sample a percentage of normal traffic while always tracing errors. Low-traffic services can often afford full tracing without meaningful cost.
It is the field AWS support and CloudTrail use to trace a specific call on AWS's side. Without it, an intermittent failure is very hard to correlate to a specific AWS-side event.
The number of distinct values a logged or traced field can take. High-cardinality fields (raw ids, full payload strings) multiply storage and indexing cost far more than a handful of enum-like values.
Just one per service, chosen based on whether your dependencies are AWS-only (X-Ray) or mixed with non-AWS systems (OpenTelemetry). Both produce the trace data an aggregated view needs.
Instrumenting once, at the client, guarantees every call through it gets consistent telemetry automatically. Per-call-site instrumentation is easy to forget and inconsistent across a codebase.
Traffic growth, a noticeable telemetry cost increase, or a new high-volume operation being added. A rate that was fine at launch can quietly become expensive as usage scales.
An end point built on the other layers, not a starting point. It needs logs and trace data flowing first; adding it before instrumenting logging and tracing leaves it with nothing to visualize.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).
Reviewed by Chris St. John·Last updated Jul 23, 2026