Django 用户是 Sentry 中的 SimpleLazyObject

Django user is SimpleLazyObject in Sentry

正在尝试将登录的用户名发送到 Sentry。如果在设置中进行硬编码,我会在 Sentry 仪表板上得到预期的结果。但是我无法在设置中设置用户名。

#settings.py
from sentry_sdk import configure_scope
    with configure_scope() as scope:
        scope.user = {"username": "Joe Soap"}

所以我不确定我应该在哪里做这个:

    with configure_scope() as scope:
        scope.user = {"username": request.user.username}

我已经尝试了登陆视图和登录视图。但只需在哨兵仪表板上取回我的 IP 地址即可。

#views.py
@login_required
def landing(request):
    context={}

    with configure_scope() as scope:
        scope.user = {"username": request.user.username}


    return render(request,'paysched/landing.html',context)

Python 和 Django 不是我的母语,所以我的问题确实是
A)我可以这样做吗?
B) 如果是,where/how。

提前感谢您对此提供的任何帮助。

更新后的Sentry SDK 0.10.2,解决了这个问题。