Skip to content

ext/requests - crashes when used with socket-io #642

@nirsky

Description

@nirsky

Describe your environment
Python 3.8.2
opentelemetry-sdk==0.6b0
opentelemetry-ext-http-requests==0.6b0 (was able to reproduce on 0.7.dev0 as well)
requests==2.23.0
python-socketio==4.5.1
python-socketio-client==1.1
websocket-client==0.57.0

Steps to reproduce
After enabling requests ext, like this:

http_requests.enable(trace_provider)

when using socketio client and connecting as follow:

import socketio

sio = socketio.Client()
sio.connect("socketio-server-url")

From this line of code (propagators.inject(type(headers).__setitem__, headers)), the following errors is thrown:
AttributeError("type object 'NoneType' has no attribute '__setitem__'")

This happens because for some reason the headers is None.
A possible fix will be adding if headers is not None: before calling the propagators.inject.

What is the expected behavior?
Expected to see the trace being sent.

What is the actual behavior?
app crashed.

Additional context
Happened on both 0.7.dev0 and 0.6b0 versions of the ext.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogbugSomething isn't workinginstrumentationRelated to the instrumentation of third party libraries or frameworks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions