Skip to content

🐛 Bug Report: #2961

@chenxqdu

Description

@chenxqdu

Which component is this bug for?

Bedrock Instrumentation

📜 Description

It bugs out when streaming is enabled. 'text' field is not always available.
The code in opentelemetry-instrumentation-bedrock/opentelemetry/instrumentation/bedrock/init.py line 393 - 394 needs to be fixed with condition.
From

                if "contentBlockDelta" in event:
                    response_msg.append(event["contentBlockDelta"]["delta"]["text"])

To

                if "contentBlockDelta" in event:
                    if "delta" in event["contentBlockDelta"] and "text" in event["contentBlockDelta"]["delta"]:
                        response_msg.append(event["contentBlockDelta"]["delta"]["text"])

👟 Reproduction steps

when converse streaming and traceloop are enabled at the same time.

👍 Expected behavior

N/A

👎 Actual Behavior with Screenshots

N/A

🤖 Python Version

No response

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions