Skip to content

urllib3 does not work with boto3 #1235

@camerondavison

Description

@camerondavison

I put the stack trace, my poetry file, and an example python script. but after instrumenting urllib3 boto3 does not work.

https://gist.github.com/camerondavison/010b2cad69dd4bf307a77fa1f0b2549e

It looks like

Traceback (most recent call last):
  File "/Users/cameron/Library/Caches/pypoetry/virtualenvs/instrument-play-SYEDf4cJ-py3.9/lib/python3.9/site-packages/botocore/httpsession.py", line 448, in send
    urllib_response = conn.urlopen(
  File "/Users/cameron/Library/Caches/pypoetry/virtualenvs/instrument-play-SYEDf4cJ-py3.9/lib/python3.9/site-packages/opentelemetry/instrumentation/urllib3/__init__.py", line 214, in instrumented_urlopen
    request_size = 0 if body is None else len(body)
TypeError: object of type '_io.BytesIO' has no len()

we just need to look at the body and call a different method for length if it is a BytesIO

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions