code: def _set_django_attributes(span, request):
      
      django_user = getattr(request, 'user', None)
  
      if django_user is None:
          return
  
      user_id = django_user.pk
      try:
          user_name = django_user.get_username()
      except AttributeError:
          # AnonymousUser in some older versions of Django doesn't implement
          # get_username
          return
  
      # User id is the django autofield for User model as the primary key
      if user_id is not None:
          span.add_attribute('django.user.id', str(user_id))
  
      if user_name is not None:
          span.add_attribute('django.user.name', str(user_name))
docs: Set the django related attributes.