-
Notifications
You must be signed in to change notification settings - Fork 821
Description
Describe your environment
Python version: Python 3.10 (I would guess 3.10.17, but we're just using the 3.10 tagged docker image)
Package version: opentelemetry-instrumentation-botocore==0.53b1, botocore==1.38.7, boto3==1.38.7
What happened?
I'm getting a bunch of errors with a stacktrace that looks like this:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/opentelemetry/instrumentation/botocore/__init__.py", line 401, in _safe_invoke
function(*args)
File "/usr/local/lib/python3.10/site-packages/opentelemetry/instrumentation/botocore/extensions/bedrock.py", line 327, in before_service_call
for event in message_to_event(message, capture_content):
File "/usr/local/lib/python3.10/site-packages/opentelemetry/instrumentation/botocore/extensions/bedrock_utils.py", line 456, in message_to_event
if tool_calls := extract_tool_calls(message, capture_content):
File "/usr/local/lib/python3.10/site-packages/opentelemetry/instrumentation/botocore/extensions/bedrock_utils.py", line 377, in extract_tool_calls
tool_uses = [
File "/usr/local/lib/python3.10/site-packages/opentelemetry/instrumentation/botocore/extensions/bedrock_utils.py", line 378, in <listcomp>
item for item in content if item.get("type") == "tool_use"
AttributeError: 'str' object has no attribute 'get'
and the message
Error when invoking function 'before_service_call'
As near as I can tell, the problem is just one of noisy logs, I actually still see botocore calls to bedrock in my traces but I'm seeing an error log like this basically every time I call Bedrock.
Steps to Reproduce
I have two calls to Bedrock that it could be, not sure if it's one or both, but I call both bedrock.invoke_model and bedrock_runtime.apply_guardrail. I've been doing this for a while without issues, but I think this error appeared when I updated a bunch of my libraries.
Expected Result
Just not the errors. Again, not sure what they're causing besides noise, my app still runs fine and my traces look reasonable as well.
Actual Result
The noisy log
Additional context
No response
Would you like to implement a fix?
No