Registry / observability / opentelemetry-instrumentation-boto

opentelemetry-instrumentation-boto

JSON →
library0.61b0pypypi✓ verified 29d ago

This library provides instrumentation for the `boto` (AWS SDK v2) Python library, allowing it to emit traces and metrics compatible with OpenTelemetry. It helps monitor interactions with AWS services made using `boto`. The current version is `0.61b0`, and it's released as part of the `opentelemetry-python-contrib` project, with frequent beta releases.

pip install opentelemetry-instrumentation-boto
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-boto
observabilitypythonv0.61b0
Install
2.7s avg
Import
—
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.61b0 · 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
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.7s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BotoInstrumentor
✓ from opentelemetry.instrumentation.boto import BotoInstrumentor
✗ from opentelemetry.instrumentation.boto import BotoInstrumentor

This quickstart demonstrates how to instrument the `boto` library. It initializes a simple `ConsoleSpanExporter` to print traces to the console, then calls `BotoInstrumentor().instrument()`. An example `boto` S3 operation is included, which will show traces even if the AWS call itself fails due to missing or invalid credentials. Ensure you have `boto` installed (`pip install boto`) for this to run.

import os import boto from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor from opentelemetry.instrumentation.boto import BotoInstrumentor # Configure OpenTelemetry TracerProvider provider = TracerProvider() processor = SimpleSpanProcessor(ConsoleSpanExporter()) provider.add_span_processor(processor) trace.set_tracer_provider(provider) # Instrument boto BotoInstrumentor().instrument() # Example boto usage (requires AWS credentials or configuration) # For a real application, ensure AWS credentials are set up via env vars, ~/.aws/credentials, etc. # Using dummy credentials for a non-functional example to demonstrate instrumentation. # DO NOT use real credentials in quickstart. os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY_ID') os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET_KEY') print('Attempting to create S3 connection (may fail without real credentials, but traces will appear if instrumentation works):') try: conn = boto.connect_s3(is_secure=False, port=8000, host='localhost') # Use a dummy host to avoid actual calls # Attempt to list buckets, this will likely fail but trigger instrumentation conn.get_all_buckets() print('S3 buckets retrieved (this might be an empty list or error out gracefully)') except Exception as e: print(f'S3 operation failed: {e}') finally: # Explicitly shutdown the provider to ensure all spans are exported provider.shutdown()
Debug
Known issues
gotchaThis instrumentation is for the `boto` library (AWS SDK v2) only. It will NOT instrument `boto3` (AWS SDK v3). For `boto3`, use `opentelemetry-instrumentation-botocore` instead.
fix
If using `boto3`, install `opentelemetry-instrumentation-botocore` and ensure you use the correct instrumentor: `BotocoreInstrumentor().instrument()`.
affects: All versions
gotchaThe library is currently in a beta release (`0.61b0`). APIs and behavior may not be stable and could change in future releases without adhering to strict semantic versioning.
fix
Monitor release notes for potential breaking changes when upgrading. Consider pinning to specific beta versions if stability is critical.
affects: All `0.x.x` beta versions
gotchaYou must explicitly call `BotoInstrumentor().instrument()` after configuring your OpenTelemetry `TracerProvider` for the instrumentation to become active.
fix
Ensure `BotoInstrumentor().instrument()` is called early in your application's startup process, typically after setting up your `TracerProvider` and `SpanProcessor`.
affects: All versions
gotchaThe `boto` library itself must be installed separately. `opentelemetry-instrumentation-boto` does not automatically install `boto` as a dependency.
fix
Run `pip install boto` alongside `pip install opentelemetry-instrumentation-boto`.
affects: All versions
Upgrade
Version history
0.61b0latest on PyPI · released Mar 4, 2026
Audit
Dependencies
botorequiredThis instrumentation targets the `boto` library (AWS SDK v2). You must install `boto` separately for the instrumentation to function.
Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources