open-telemetry / open-telemetry/opentelemetry-python-contrib

urllib3 does not work with boto3

Open Beginner friendly
#1,235 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted instrumentation
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in opentelemetry/instrumentation/urllib3/init.py at instrumented_urlopen around line 214, then reproduce the failure with the example Python script from the linked gist. Check the request-body length handling for BytesIO and verify that the boto3 example completes without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability-sre
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.