The `opentelemetry-instrumentation-bedrock` library provides automatic instrumentation for AWS Bedrock API calls made using Boto3. It captures telemetry data such as prompts, completions, and embeddings, enabling observability into Large Language Model (LLM) applications within the OpenTelemetry ecosystem. This library is part of the broader OpenLLMetry project and is currently at version 0.58.0, with a frequent release cadence.
pip install opentelemetry-instrumentation-bedrock boto3Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up the OpenTelemetry SDK with a console exporter, instrument the Bedrock client, and then invoke a Bedrock model. The instrumentation automatically creates spans for the Bedrock interaction, which are then printed to the console by the `ConsoleSpanExporter`.
Review existing dashboards, alerts, and querying logic that rely on OpenTelemetry span attributes. Update them to use the new semantic convention attribute names. For a transition period, you might use the `OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental` environment variable to explicitly enable the latest experimental conventions or facilitate dual emission, though direct adaptation is recommended for stable setups. Consult the OpenTelemetry semantic conventions documentation for specific changes.
To disable logging of this content, set the environment variable `TRACELOOP_TRACE_CONTENT` to `false`.
Check the AWS SDK documentation for `boto3` and `botocore` for version requirements related to specific Bedrock functionalities you are using. Upgrade `boto3` and `botocore` if necessary: `pip install --upgrade boto3 botocore`.