OpenTelemetry Boto3 SQS Instrumentation
OpenTelemetry instrumentation that traces Boto3 calls to Amazon SQS and propagates context across messages.
Repository Health
Technical Analysis
opentelemetry-instrumentation-boto3sqs is an OpenTelemetry instrumentation library that traces interactions between the AWS Boto3 client and Amazon SQS. It creates spans for queue operations such as sending, receiving, and deleting messages, and injects and extracts trace context through SQS message attributes so producers and consumers remain linked in a single distributed trace.
Part of the opentelemetry-python-contrib project, it builds on the standard OpenTelemetry API and SDK, giving message-driven Python systems end-to-end visibility across asynchronous SQS boundaries without hand-written instrumentation.
What You Get
- Spans for Boto3 SQS operations including send, receive, and delete message calls
- Trace-context injection into and extraction from SQS message attributes
- Producer-to-consumer trace continuity across asynchronous queue boundaries
- Messaging semantic-convention attributes on emitted spans
- Integration with the OpenTelemetry API/SDK and any configured exporter
Common Use Cases
- Tracing message flow through Amazon SQS in an event-driven Python system
- Correlating an SQS producer with the consumer that later processes the message
- Diagnosing latency and failures in queue-based background processing
Under The Hood
Architecture - The package lives at instrumentation/opentelemetry-instrumentation-boto3sqs in the opentelemetry-python-contrib monorepo. Its instrumentor (opentelemetry.instrumentation.boto3sqs) uses wrapt to patch Boto3’s SQS client methods, opening producer/consumer spans and reading or writing W3C trace context inside SQS MessageAttributes so context survives the queue hop.
Tech Stack - Pure Python, depending on opentelemetry-api (~=1.12), opentelemetry-instrumentation, opentelemetry-semantic-conventions, and wrapt for method wrapping. It targets the boto3/botocore SQS surface and emits through the host application’s configured OpenTelemetry SDK and exporter.
Code Quality - Developed under the opentelemetry-python-contrib project (Apache-2.0) with shared CI, linting, and an extensive instrumentation test suite. The module concentrates the SQS-specific wrapping logic while reusing common propagation and semantic-convention helpers from the wider OpenTelemetry Python packages.
API Design - Follows the uniform BaseInstrumentor pattern used across contrib: a single instrument() call enables tracing, and context propagation through message attributes is automatic, so developers get cross-service queue tracing without touching their Boto3 call sites.