Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit b3c298f

Browse files
geobeauc24t
authored andcommitted
Enforce str for some django attributes (#434)
1 parent d0409fc commit b3c298f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

opencensus/trace/ext/django/middleware.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _set_django_attributes(span, request):
101101
span.add_attribute('django.user.id', str(user_id))
102102

103103
if user_name is not None:
104-
span.add_attribute('django.user.name', user_name)
104+
span.add_attribute('django.user.name', str(user_name))
105105

106106

107107
class OpencensusMiddleware(MiddlewareMixin):
@@ -207,7 +207,7 @@ def process_request(self, request):
207207
attribute_value=request.method)
208208
tracer.add_attribute_to_current_span(
209209
attribute_key=HTTP_URL,
210-
attribute_value=request.path)
210+
attribute_value=str(request.path))
211211

212212
# Add the span to thread local
213213
# in some cases (exceptions, timeouts) currentspan in

0 commit comments

Comments
 (0)