Skip to main content

Bedrock OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the Bedrock framework. It enables tracing and monitoring of applications built with Bedrock.

Installation

  1. Install traceAI Bedrock
pip install traceAI-bedrock
  1. Install boto3
pip install boto3

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI.

import os

os.environ["AWS_ACCESS_KEY_ID"] = AWS_ACCESS_KEY_ID
os.environ["AWS_SECRET_ACCESS_KEY"] = AWS_SECRET_ACCESS_KEY
os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="bedrock_app"
)

Configure Bedrock Instrumentation

Instrument the Bedrock client to enable telemetry collection. This step ensures that all interactions with the Bedrock SDK are tracked and monitored.

from traceai_bedrock import BedrockInstrumentor

BedrockInstrumentor().instrument(tracer_provider=trace_provider)

Create Bedrock Components

Set up your Bedrock client with built-in observability.

def converse_with_claude():
    system_prompt = [{"text": "You are an expert at creating music playlists"}]
    messages = [
        {
            "role": "user",
            "content": [{"text": "Hello, how are you?"}, {"text": "What's your name?"}],
        }
    ]
    inference_config = {"maxTokens": 1024, "temperature": 0.0}

    try:
        response = client.converse(
            modelId="model_id",
            system=system_prompt,
            messages=messages,
            inferenceConfig=inference_config,
        )
        out = response["output"]["message"]
        messages.append(out)
        print(out)
    except Exception as e:
        print(f"Error: {str(e)}")

if __name__ == "__main__":
    converse_with_claude()

Metadata

Release files for traceAI-bedrock 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-bedrock 0.1.10
File Size Uploaded
traceai_bedrock-0.1.10.tar.gz 35.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-bedrock 0.1.10
File Interpreter ABI Platform
traceai_bedrock-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 79.0 kB

Release files / traceai_bedrock-0.1.10.tar.gz

Download URL traceai_bedrock-0.1.10.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
601a5e319b0bec545e2df3c92189778f90a5484c5d3b3594b4e96c90024bf656
BLAKE2b-256 checksum
How to use checksums
0811bae070334c3d9d2e91b45f4b5d4bfb765c640dd80849769463ab3a04e17f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / traceai_bedrock-0.1.10-py3-none-any.whl

Download URL traceai_bedrock-0.1.10-py3-none-any.whl
Size 43.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
083b5e4368ac63b5c599ee1bd313f28d9a76f79380fa63b2482a997b6155146a
BLAKE2b-256 checksum
How to use checksums
51b1b7e5571b9c2df2e97668de2a3e155874abae4879d3cfc08a518101bdd6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

3 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page