You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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
The text was updated successfully, but these errors were encountered:
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)
I fixed it by defining a subclass of the original LoggingHandler and use that class for the otlp handler instead:
from logging import LogRecord
from opentelemetry.sdk._logs import LoggingHandler as OpenTelemetryLoggingHandler
class LoggingHandler(OpenTelemetryLoggingHandler):
@staticmethod
def _get_attributes(record: LogRecord):
attributes = OpenTelemetryLoggingHandler._get_attributes(record)
if "request" in attributes:
attributes["request"] = f'{attributes["request"].method} {attributes["request"].path}'
return attributes
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
Added the following to my Dockerfile
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
The text was updated successfully, but these errors were encountered: