{"id":3194,"library":"opentelemetry-instrumentation-boto","title":"OpenTelemetry Boto Instrumentation","description":"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.","status":"active","version":"0.61b0","language":"en","source_language":"en","source_url":"https://github.com/open-telemetry/opentelemetry-python-contrib","tags":["opentelemetry","observability","tracing","boto","aws","instrumentation"],"install":[{"cmd":"pip install opentelemetry-instrumentation-boto","lang":"bash","label":"Install library"}],"dependencies":[{"reason":"This instrumentation targets the `boto` library (AWS SDK v2). You must install `boto` separately for the instrumentation to function.","package":"boto","optional":false}],"imports":[{"note":"This instrumentation specifically targets `boto` (AWS SDK v2). For `boto3` (AWS SDK v3), use `opentelemetry-instrumentation-botocore` instead.","wrong":"from opentelemetry.instrumentation.boto3 import BotoInstrumentor","symbol":"BotoInstrumentor","correct":"from opentelemetry.instrumentation.boto import BotoInstrumentor"}],"quickstart":{"code":"import os\nimport boto\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor\nfrom opentelemetry.instrumentation.boto import BotoInstrumentor\n\n# Configure OpenTelemetry TracerProvider\nprovider = TracerProvider()\nprocessor = SimpleSpanProcessor(ConsoleSpanExporter())\nprovider.add_span_processor(processor)\ntrace.set_tracer_provider(provider)\n\n# Instrument boto\nBotoInstrumentor().instrument()\n\n# Example boto usage (requires AWS credentials or configuration)\n# For a real application, ensure AWS credentials are set up via env vars, ~/.aws/credentials, etc.\n# Using dummy credentials for a non-functional example to demonstrate instrumentation.\n# DO NOT use real credentials in quickstart.\nos.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY_ID')\nos.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET_KEY')\n\nprint('Attempting to create S3 connection (may fail without real credentials, but traces will appear if instrumentation works):')\ntry:\n    conn = boto.connect_s3(is_secure=False, port=8000, host='localhost') # Use a dummy host to avoid actual calls\n    # Attempt to list buckets, this will likely fail but trigger instrumentation\n    conn.get_all_buckets()\n    print('S3 buckets retrieved (this might be an empty list or error out gracefully)')\nexcept Exception as e:\n    print(f'S3 operation failed: {e}')\nfinally:\n    # Explicitly shutdown the provider to ensure all spans are exported\n    provider.shutdown()\n","lang":"python","description":"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."},"warnings":[{"fix":"If using `boto3`, install `opentelemetry-instrumentation-botocore` and ensure you use the correct instrumentor: `BotocoreInstrumentor().instrument()`.","message":"This 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Monitor release notes for potential breaking changes when upgrading. Consider pinning to specific beta versions if stability is critical.","message":"The 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.","severity":"gotcha","affected_versions":"All `0.x.x` beta versions"},{"fix":"Ensure `BotoInstrumentor().instrument()` is called early in your application's startup process, typically after setting up your `TracerProvider` and `SpanProcessor`.","message":"You must explicitly call `BotoInstrumentor().instrument()` after configuring your OpenTelemetry `TracerProvider` for the instrumentation to become active.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Run `pip install boto` alongside `pip install opentelemetry-instrumentation-boto`.","message":"The `boto` library itself must be installed separately. `opentelemetry-instrumentation-boto` does not automatically install `boto` as a dependency.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}