Registry /
aws / opentelemetry-instrumentation-boto3sqs
Install & Compatibility
Where this runs
tested against v0.65b0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.052s · 57.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.9s · import 0.940s · 58MB
56MB installed
● package 56MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Boto3SQSInstrumentor
✓ from opentelemetry.instrumentation.boto3sqs import Boto3SQSInstrumentor
This quickstart demonstrates how to set up the OpenTelemetry SDK with a console exporter, instrument `boto3` for SQS, and then perform basic SQS operations (create, send, receive, delete queue/messages). This will output trace spans to the console.
import os
import boto3
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
from opentelemetry.instrumentation.boto3sqs import Boto3SQSInstrumentor
# 1. Configure OpenTelemetry Tracer Provider and Exporter
resource = Resource.create({"service.name": "sqs-test-app"})
provider = TracerProvider(resource=resource)
processor = SimpleSpanProcessor(ConsoleSpanExporter())
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)
# 2. Instrument boto3 SQS
Boto3SQSInstrumentor().instrument()
# 3. Use boto3 SQS client, operations will be traced
session = boto3.Session(
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID", "TEST_ACCESS_KEY"),
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", "TEST_SECRET_KEY"),
region_name=os.environ.get("AWS_REGION", "us-east-1")
)
sqs_client = session.client("sqs")
queue_name = "otel-test-queue"
queue_url = None
try:
print(f"Creating queue: {queue_name}")
response = sqs_client.create_queue(QueueName=queue_name, Attributes={'DelaySeconds': '5'})
queue_url = response['QueueUrl']
print(f"Queue URL: {queue_url}")
print("Sending message...")
sqs_client.send_message(QueueUrl=queue_url, MessageBody="Hello SQS from OpenTelemetry!")
print("Receiving messages...")
messages = sqs_client.receive_message(
QueueUrl=queue_url,
MaxNumberOfMessages=1,
WaitTimeSeconds=10 # Use long polling for testing
)
if messages and 'Messages' in messages:
for message in messages['Messages']:
print(f"Received message: {message['Body']}")
print(f"Deleting message: {message['MessageId']}")
sqs_client.delete_message(
QueueUrl=queue_url,
ReceiptHandle=message['ReceiptHandle']
)
else:
print("No messages received.")
except Exception as e:
print(f"An error occurred: {e}")
finally:
if queue_url:
print(f"Deleting queue: {queue_name}")
try:
sqs_client.delete_queue(QueueUrl=queue_url)
print("Queue deleted.")
except Exception as e:
print(f"Error deleting queue: {e}")
Upgrade
Version history
0.65b0latest on PyPI · released Jul 16, 2026
Audit
Dependencies
boto3requiredThe underlying AWS SDK for Python that this library instruments. Must be installed separately.
opentelemetry-sdkrequiredCore OpenTelemetry SDK components required for trace generation and processing. While often pulled transitively by other OTel packages, it's a fundamental functional requirement for setting up tracing.