open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
698 stars 579 forks source link

Invalid type WSGIRequest for attribute 'request' value opentelemetry #2808

Open saichander17 opened 3 weeks ago

saichander17 commented 3 weeks ago

Describe your environment

OS: (Alpine Docker) Python version: (Python 3.8) SDK version: (e.g., 1.22.0) API version: (e.g., 1.22.0)

What happened?

Invalid type WSGIRequest for attribute 'request' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

I'm getting this warning when I integrated opentelemetry in my Django application. I don't know if it's a bug or I'm doing something wrong. Has anyone encountered this previously?

Steps to Reproduce

Added these to my requirements

opentelemetry-distro==0.43b0
opentelemetry-exporter-otlp==1.22.0

Added the following to my Dockerfile

RUN opentelemetry-bootstrap --action=install
ENV DJANGO_SETTINGS_MODULE myapp.settings
CMD OTEL_RESOURCE_ATTRIBUTES=service.name=testing_app OTEL_EXPORTER_OTLP_ENDPOINT="http://<IP>:4317" OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument gunicorn myapp.wsgi:application -c gunicorn.conf.py

Expected Result

I shouldn't get that warning? I'm not sure here!

Actual Result

I'm getting the warning Invalid type WSGIRequest for attribute 'request' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

Additional context

I raised the issue first in opentelemtry-python but was suggested that I raise it here.

Would you like to implement a fix?

None

jeremydvoss commented 3 weeks ago

I have not been able to reproduce this. Could you provide a greater list of dependency versions for the docker container. For instance: opentelemetry-instrumentation-django gunicorn

Consider providing a full repro (Dockerfile + dependencies)