fix(bedrock): refectored using _attributes functions #1566
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This MR Updates the AWS Bedrock Agent Instrumentation for Multi agent collaboration.
The OpenInference instrumentation for AWS Bedrock implements a sophisticated trace ID-based system to track and correlate events across the lifecycle of agent interactions. This implementation enables detailed observability into the execution flow of Bedrock agents, including model invocations, tool calls, knowledge base lookups, and agent collaborations.
1. SpanManager
The
SpanManager
class serves as the central component for managing OpenTelemetry spans in the Bedrock instrumentation:Hierarchical Span Structure: Maintains a multi-level hierarchy of spans:
Trace ID Generation and Management:
{trace_event}-{trace_id}
to ensure uniquenessParent-Child Relationship:
2. ResponseAccumulator
The
_ResponseAccumulator
class processes responses from the Bedrock service:3. AttributeExtractor
The
AttributeExtractor
class extracts and processes attributes from various types of trace data:Specialized Extractors: Contains methods for extracting attributes from different event types:
Standardized Attribute Format: Converts Bedrock-specific data into OpenTelemetry-compatible attributes(we have used methods for creating span attribues using attributes.py)
Multi agent collaborator hierarchy example
cloases #1530